mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Update paper plugin check in PluginRemapper
This commit is contained in:
parent
15221cd4ac
commit
8cb49c8d67
1 changed files with 22 additions and 21 deletions
|
@ -374,6 +374,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import io.papermc.paper.plugin.provider.type.PluginFileType;
|
||||
+import io.papermc.paper.util.AtomicFiles;
|
||||
+import io.papermc.paper.util.MappingEnvironment;
|
||||
+import io.papermc.paper.util.concurrent.ScalingThreadPool;
|
||||
|
@ -557,8 +558,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ final long start = System.currentTimeMillis();
|
||||
+ final IMappingFile reversed = mappings.reverse();
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Done reversing mappings in {}ms.", System.currentTimeMillis() - start);
|
||||
+ }
|
||||
+ LOGGER.info("Done reversing mappings in {}ms.", System.currentTimeMillis() - start);
|
||||
+ }
|
||||
+ return reversed;
|
||||
+ }
|
||||
+
|
||||
|
@ -615,30 +616,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ try (final FileSystem fs = FileSystems.newFileSystem(inputFile, new HashMap<>())) {
|
||||
+ // Leave dummy files if no remapping is required, so that we can check if they exist without copying the whole file
|
||||
+ /*if (Files.exists(fs.getPath(PluginFileType.PAPER_PLUGIN_YML))) { // TODO Uncomment on release
|
||||
+ final Path manifestPath = fs.getPath("META-INF/MANIFEST.MF");
|
||||
+ final @Nullable String ns;
|
||||
+ if (Files.exists(manifestPath)) {
|
||||
+ final Manifest manifest;
|
||||
+ try (final InputStream in = new BufferedInputStream(Files.newInputStream(manifestPath))) {
|
||||
+ manifest = new Manifest(in);
|
||||
+ }
|
||||
+ ns = manifest.getMainAttributes().getValue(InsertManifestAttribute.PAPERWEIGHT_NAMESPACE_MANIFEST_KEY);
|
||||
+ } else {
|
||||
+ ns = null;
|
||||
+ }
|
||||
+ if (ns != null && (ns.equals(InsertManifestAttribute.MOJANG_NAMESPACE) || ns.equals(InsertManifestAttribute.MOJANG_PLUS_YARN_NAMESPACE))) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Plugin '{}' is a Paper plugin, no remapping necessary.", inputFile);
|
||||
+ LOGGER.info("Plugin '{}' is already Mojang mapped.", inputFile);
|
||||
+ }
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ } else {*/
|
||||
+ // Check for paperweight mojang mapped marker
|
||||
+ final Path manifestPath = fs.getPath("META-INF/MANIFEST.MF");
|
||||
+ if (Files.exists(manifestPath)) {
|
||||
+ final Manifest manifest;
|
||||
+ try (final InputStream in = new BufferedInputStream(Files.newInputStream(manifestPath))) {
|
||||
+ manifest = new Manifest(in);
|
||||
+ }
|
||||
+ final String ns = manifest.getMainAttributes().getValue(InsertManifestAttribute.PAPERWEIGHT_NAMESPACE_MANIFEST_KEY);
|
||||
+ if (ns != null && (ns.equals(InsertManifestAttribute.MOJANG_NAMESPACE) || ns.equals(InsertManifestAttribute.MOJANG_PLUS_YARN_NAMESPACE))) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Plugin '{}' is already Mojang mapped.", inputFile);
|
||||
+ }
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ }
|
||||
+ } else if (ns == null && Files.exists(fs.getPath(PluginFileType.PAPER_PLUGIN_YML))) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Plugin '{}' is a Paper plugin with no namespace specified.", inputFile);
|
||||
+ }
|
||||
+ //}
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ }
|
||||
+ } catch (final IOException ex) {
|
||||
+ throw new RuntimeException("Failed to open plugin jar " + inputFile, ex);
|
||||
+ }
|
||||
|
|
Loading…
Reference in a new issue