Skip to content

Commit dd216c1

Browse files
authored
Fix Inconsistencies with Paper Plugin Names (#9098)
1 parent 6d2121e commit dd216c1

21 files changed

+101
-65
lines changed

LICENSE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ Kieran Wallbanks <kieran.wallbanks@gmail.com>
5656
Denery <dorofeevij@gmail.com>
5757
Jakubk15 <jakubk15@protonmail.com>
5858
Redned <redned235@gmail.com>
59+
Luke Chambers <consolelogluke@gmail.com>
5960
```

patches/api/0008-Paper-Plugins.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Subject: [PATCH] Paper Plugins
55

66

77
diff --git a/build.gradle.kts b/build.gradle.kts
8-
index bb1f3b3d5a22ca391f4362e5d4cf016e7e9be0e3..f900b73c52971fe682171e7f99246afdb8b080f3 100644
8+
index cff3eb363b17c2a8245b3b2ceb02cbdc1efe3896..03b2fc4c6dd9cbc9f28add7da9420c816f8faa2b 100644
99
--- a/build.gradle.kts
1010
+++ b/build.gradle.kts
1111
@@ -45,7 +45,7 @@ dependencies {

patches/server/0013-Paper-Plugins.patch

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ index 0000000000000000000000000000000000000000..89bf48fd581ee6580b91e2eb31dd532c
594594
+}
595595
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContextImpl.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContextImpl.java
596596
new file mode 100644
597-
index 0000000000000000000000000000000000000000..2e450a9fce66e63ec94ee3d2579265eda28a1c3f
597+
index 0000000000000000000000000000000000000000..deffde92350f7c74694c2aa69799de446a3c3e0a
598598
--- /dev/null
599599
+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContextImpl.java
600600
@@ -0,0 +1,45 @@
@@ -612,13 +612,13 @@ index 0000000000000000000000000000000000000000..2e450a9fce66e63ec94ee3d2579265ed
612612
+ ComponentLogger logger, Path pluginSource) implements PluginProviderContext {
613613
+
614614
+ public static PluginProviderContextImpl of(PluginMeta config, ComponentLogger logger, Path pluginSource) {
615-
+ Path dataFolder = PluginInitializerManager.instance().pluginDirectoryPath().resolve(config.getDisplayName());
615+
+ Path dataFolder = PluginInitializerManager.instance().pluginDirectoryPath().resolve(config.getName());
616616
+
617617
+ return new PluginProviderContextImpl(config, dataFolder, logger, pluginSource);
618618
+ }
619619
+
620620
+ public static PluginProviderContextImpl of(PluginProvider<?> provider, Path pluginFolder) {
621-
+ Path dataFolder = pluginFolder.resolve(provider.getMeta().getDisplayName());
621+
+ Path dataFolder = pluginFolder.resolve(provider.getMeta().getName());
622622
+
623623
+ return new PluginProviderContextImpl(provider.getMeta(), dataFolder, provider.getLogger(), provider.getSource());
624624
+ }
@@ -813,7 +813,7 @@ index 0000000000000000000000000000000000000000..f9a2c55a354c877749db3f92956de802
813813
+}
814814
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperPluginClassLoader.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperPluginClassLoader.java
815815
new file mode 100644
816-
index 0000000000000000000000000000000000000000..79995ab1b624d7c7aaaa467a86255ad97385cf72
816+
index 0000000000000000000000000000000000000000..56fc3e0984861e8ddb597cad3c0a0e0aca9606e6
817817
--- /dev/null
818818
+++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperPluginClassLoader.java
819819
@@ -0,0 +1,207 @@
@@ -966,7 +966,7 @@ index 0000000000000000000000000000000000000000..79995ab1b624d7c7aaaa467a86255ad9
966966
+ PluginMeta config = this.configuration;
967967
+ PluginDescriptionFile pluginDescriptionFile = new PluginDescriptionFile(
968968
+ config.getName(),
969-
+ config.getName().replace('_', ' '),
969+
+ config.getName(),
970970
+ config.getProvidedPlugins(),
971971
+ config.getMainClass(),
972972
+ "", // Classloader load order api
@@ -4387,12 +4387,13 @@ index 0000000000000000000000000000000000000000..e3430f535e8e9c3b8b44bf2daece8c47
43874387
+}
43884388
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
43894389
new file mode 100644
4390-
index 0000000000000000000000000000000000000000..7605efe37ac4a63cb95c8c64c576e93c0e676cc0
4390+
index 0000000000000000000000000000000000000000..95cc4dbe336e37f01d9f478068fd21a387754a91
43914391
--- /dev/null
43924392
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
4393-
@@ -0,0 +1,227 @@
4393+
@@ -0,0 +1,232 @@
43944394
+package io.papermc.paper.plugin.provider.configuration;
43954395
+
4396+
+import com.google.common.base.Preconditions;
43964397
+import com.google.common.collect.ImmutableList;
43974398
+import io.leangen.geantyref.TypeToken;
43984399
+import io.papermc.paper.configuration.constraint.Constraint;
@@ -4411,6 +4412,7 @@ index 0000000000000000000000000000000000000000..7605efe37ac4a63cb95c8c64c576e93c
44114412
+import org.bukkit.plugin.PluginLoadOrder;
44124413
+import org.jetbrains.annotations.NotNull;
44134414
+import org.jetbrains.annotations.Nullable;
4415+
+import org.jetbrains.annotations.TestOnly;
44144416
+import org.spongepowered.configurate.CommentedConfigurationNode;
44154417
+import org.spongepowered.configurate.ConfigurateException;
44164418
+import org.spongepowered.configurate.loader.HeaderMode;
@@ -4456,8 +4458,6 @@ index 0000000000000000000000000000000000000000..7605efe37ac4a63cb95c8c64c576e93c
44564458
+ @PluginConfigConstraints.PluginVersion
44574459
+ private String apiVersion;
44584460
+
4459-
+ private transient String displayName;
4460-
+
44614461
+ public PaperPluginMeta() {
44624462
+ }
44634463
+
@@ -4500,8 +4500,6 @@ index 0000000000000000000000000000000000000000..7605efe37ac4a63cb95c8c64c576e93c
45004500
+ .build();
45014501
+ }
45024502
+
4503-
+ pluginConfiguration.displayName = pluginConfiguration.name.replace('_', ' ') + " v" + pluginConfiguration.version;
4504-
+
45054503
+ return pluginConfiguration;
45064504
+ }
45074505
+
@@ -4510,6 +4508,12 @@ index 0000000000000000000000000000000000000000..7605efe37ac4a63cb95c8c64c576e93c
45104508
+ return this.name;
45114509
+ }
45124510
+
4511+
+ @TestOnly
4512+
+ public void setName(@NotNull String name) {
4513+
+ Preconditions.checkNotNull(name, "name");
4514+
+ this.name = name;
4515+
+ }
4516+
+
45134517
+ @Override
45144518
+ public @NotNull String getMainClass() {
45154519
+ return this.main;
@@ -4520,9 +4524,10 @@ index 0000000000000000000000000000000000000000..7605efe37ac4a63cb95c8c64c576e93c
45204524
+ return this.version;
45214525
+ }
45224526
+
4523-
+ @Override
4524-
+ public @NotNull String getDisplayName() {
4525-
+ return this.displayName;
4527+
+ @TestOnly
4528+
+ public void setVersion(@NotNull String version) {
4529+
+ Preconditions.checkNotNull(version, "version");
4530+
+ this.version = version;
45264531
+ }
45274532
+
45284533
+ @Override
@@ -7052,6 +7057,40 @@ index 0000000000000000000000000000000000000000..726eba26470e62b0e94a91418512e242
70527057
+ assertThat(pm.getPermissions(), is(empty()));
70537058
+ }
70547059
+}
7060+
diff --git a/src/test/java/io/papermc/paper/plugin/PluginNamingTest.java b/src/test/java/io/papermc/paper/plugin/PluginNamingTest.java
7061+
new file mode 100644
7062+
index 0000000000000000000000000000000000000000..860a2bc8200cf41b216a2e37cfbd2f5464d6542c
7063+
--- /dev/null
7064+
+++ b/src/test/java/io/papermc/paper/plugin/PluginNamingTest.java
7065+
@@ -0,0 +1,28 @@
7066+
+package io.papermc.paper.plugin;
7067+
+
7068+
+import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta;
7069+
+import org.junit.Assert;
7070+
+import org.junit.Test;
7071+
+
7072+
+public class PluginNamingTest {
7073+
+ private static final String TEST_NAME = "Test_Plugin";
7074+
+ private static final String TEST_VERSION = "1.0";
7075+
+
7076+
+ private final PaperPluginMeta pluginMeta;
7077+
+
7078+
+ public PluginNamingTest() {
7079+
+ this.pluginMeta = new PaperPluginMeta();
7080+
+ this.pluginMeta.setName(TEST_NAME);
7081+
+ this.pluginMeta.setVersion(TEST_VERSION);
7082+
+ }
7083+
+
7084+
+ @Test
7085+
+ public void testName() {
7086+
+ Assert.assertEquals(TEST_NAME, this.pluginMeta.getName());
7087+
+ }
7088+
+
7089+
+ @Test
7090+
+ public void testDisplayName() {
7091+
+ Assert.assertEquals(TEST_NAME + " v" + TEST_VERSION, this.pluginMeta.getDisplayName());
7092+
+ }
7093+
+}
70557094
diff --git a/src/test/java/io/papermc/paper/plugin/SyntheticEventTest.java b/src/test/java/io/papermc/paper/plugin/SyntheticEventTest.java
70567095
new file mode 100644
70577096
index 0000000000000000000000000000000000000000..51c08740edffd152c8e2b6d3676ff7f1ce6090c6

patches/server/0404-Wait-for-Async-Tasks-during-shutdown.patch

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ index e189de6d2aa94e9bbb20f1477ee2e34431adb324..4a58843f7ce2dd9e50f9daf3065d056a
2222
// CraftBukkit end
2323
if (this.getConnection() != null) {
2424
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
25-
index bec471a617780e4fa88d4c559c42175370687d7b..9e278a740cf7cb7a593d76f01d6aa590407b087b 100644
25+
index 4d51834b6e7bc9058579ce5c6b88f5e9e1c3155d..670ad9f79e2430e956ef204c7e7bf0c651810c06 100644
2626
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2727
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
28-
@@ -1002,6 +1002,35 @@ public final class CraftServer implements Server {
28+
@@ -1002,6 +1002,31 @@ public final class CraftServer implements Server {
2929
org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload
3030
}
3131

@@ -44,14 +44,10 @@ index bec471a617780e4fa88d4c559c42175370687d7b..9e278a740cf7cb7a593d76f01d6aa590
4444
+ List<BukkitWorker> overdueWorkers = getScheduler().getActiveWorkers();
4545
+ for (BukkitWorker worker : overdueWorkers) {
4646
+ Plugin plugin = worker.getOwner();
47-
+ String author = "<NoAuthorGiven>";
48-
+ if (plugin.getDescription().getAuthors().size() > 0) {
49-
+ author = plugin.getDescription().getAuthors().get(0);
50-
+ }
5147
+ getLogger().log(Level.SEVERE, String.format(
52-
+ "Nag author: '%s' of '%s' about the following: %s",
53-
+ author,
54-
+ plugin.getDescription().getName(),
48+
+ "Nag author(s): '%s' of '%s' about the following: %s",
49+
+ plugin.getPluginMeta().getAuthors(),
50+
+ plugin.getPluginMeta().getDisplayName(),
5551
+ "This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies."
5652
+ ));
5753
+ }

patches/server/0493-Add-getOfflinePlayerIfCached-String.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
55

66

77
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
8-
index 7971be6c5e9daa6d7f206aafac7479bd5cc0aad5..a133e0a0a7a5b646ac3df9c2521d4deed6a1761d 100644
8+
index 24f0e19f0ce76d9efa2acae2d8514c97cd4415fa..689ee858c4c0635f03390d30f84f635be4758c49 100644
99
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
1010
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
11-
@@ -1812,6 +1812,28 @@ public final class CraftServer implements Server {
11+
@@ -1808,6 +1808,28 @@ public final class CraftServer implements Server {
1212
return result;
1313
}
1414

patches/server/0581-Expand-world-key-API.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ index 9db48bd6dcf0d24132123b86670341c1d8113840..d7ac103b82e9aac1e2f3b807d7b69fdf
2020
// Paper end
2121
}
2222
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
23-
index a133e0a0a7a5b646ac3df9c2521d4deed6a1761d..574f50314c17eb12b519ba14fb1dddbc6c8e40c6 100644
23+
index 689ee858c4c0635f03390d30f84f635be4758c49..90230aec6707400fe07ab4431235b4f6383bdac0 100644
2424
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2525
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
26-
@@ -1134,9 +1134,15 @@ public final class CraftServer implements Server {
26+
@@ -1130,9 +1130,15 @@ public final class CraftServer implements Server {
2727
File folder = new File(this.getWorldContainer(), name);
2828
World world = this.getWorld(name);
2929

@@ -41,7 +41,7 @@ index a133e0a0a7a5b646ac3df9c2521d4deed6a1761d..574f50314c17eb12b519ba14fb1dddbc
4141

4242
if ((folder.exists()) && (!folder.isDirectory())) {
4343
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
44-
@@ -1225,7 +1231,7 @@ public final class CraftServer implements Server {
44+
@@ -1221,7 +1227,7 @@ public final class CraftServer implements Server {
4545
} else if (name.equals(levelName + "_the_end")) {
4646
worldKey = net.minecraft.world.level.Level.END;
4747
} else {
@@ -50,7 +50,7 @@ index a133e0a0a7a5b646ac3df9c2521d4deed6a1761d..574f50314c17eb12b519ba14fb1dddbc
5050
}
5151

5252
ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, worlddimension, this.getServer().progressListenerFactory.create(11),
53-
@@ -1317,6 +1323,15 @@ public final class CraftServer implements Server {
53+
@@ -1313,6 +1319,15 @@ public final class CraftServer implements Server {
5454
return null;
5555
}
5656

patches/server/0615-Add-basic-Datapack-API.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c
9292
+ }
9393
+}
9494
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
95-
index 574f50314c17eb12b519ba14fb1dddbc6c8e40c6..a8116749fb7a2b30e2623165eedb9ee167ee6120 100644
95+
index 90230aec6707400fe07ab4431235b4f6383bdac0..d3256d726dda08da8f3e9facfd2cb242c2c08655 100644
9696
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
9797
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
9898
@@ -291,6 +291,7 @@ public final class CraftServer implements Server {
@@ -111,7 +111,7 @@ index 574f50314c17eb12b519ba14fb1dddbc6c8e40c6..a8116749fb7a2b30e2623165eedb9ee1
111111
}
112112

113113
public boolean getCommandBlockOverride(String command) {
114-
@@ -2778,5 +2780,11 @@ public final class CraftServer implements Server {
114+
@@ -2774,5 +2776,11 @@ public final class CraftServer implements Server {
115115
public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
116116
return mobGoals;
117117
}

patches/server/0621-Fix-and-optimise-world-force-upgrading.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,10 @@ index b294ef87fb93e7f4651dc04128124f297575860d..65fd57609e45ccd49ebfc1ba80d25243
359359
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
360360
}
361361
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
362-
index 418af5eca12c17c95fb5ec8f6af761372d84a4c1..cfa6915e17d2fcc0cac4030aef8a71503df89e85 100644
362+
index d3256d726dda08da8f3e9facfd2cb242c2c08655..a469b39c47b1b9feba344672646ee14c11b42a81 100644
363363
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
364364
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
365-
@@ -1210,12 +1210,7 @@ public final class CraftServer implements Server {
365+
@@ -1206,12 +1206,7 @@ public final class CraftServer implements Server {
366366
worlddata.customDimensions = iregistry;
367367
worlddata.checkName(name);
368368
worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified());
@@ -376,7 +376,7 @@ index 418af5eca12c17c95fb5ec8f6af761372d84a4c1..cfa6915e17d2fcc0cac4030aef8a7150
376376

377377
long j = BiomeManager.obfuscateSeed(creator.seed());
378378
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
379-
@@ -1226,6 +1221,13 @@ public final class CraftServer implements Server {
379+
@@ -1222,6 +1217,13 @@ public final class CraftServer implements Server {
380380
biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
381381
}
382382

patches/server/0659-Add-System.out-err-catcher.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Subject: [PATCH] Add System.out/err catcher
66

77
diff --git a/src/main/java/io/papermc/paper/logging/SysoutCatcher.java b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java
88
new file mode 100644
9-
index 0000000000000000000000000000000000000000..76d0d00cd6742991e3f3ec827a75ee87d856b6c9
9+
index 0000000000000000000000000000000000000000..a8e813ca89b033f061e695288b3383bdcf128531
1010
--- /dev/null
1111
+++ b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java
1212
@@ -0,0 +1,94 @@
@@ -88,8 +88,8 @@ index 0000000000000000000000000000000000000000..76d0d00cd6742991e3f3ec827a75ee87
8888
+ Bukkit.getLogger().warning(
8989
+ String.format("Nag author(s): '%s' of '%s' about their usage of System.out/err.print. "
9090
+ + "Please use your plugin's logger instead (JavaPlugin#getLogger).",
91-
+ plugin.getDescription().getAuthors(),
92-
+ plugin.getName())
91+
+ plugin.getPluginMeta().getAuthors(),
92+
+ plugin.getPluginMeta().getDisplayName())
9393
+ );
9494
+ } catch (final IllegalArgumentException | IllegalStateException e) {
9595
+ // If anything happens, the calling class doesn't exist, there is no JavaPlugin that "owns" the calling class, etc
@@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..76d0d00cd6742991e3f3ec827a75ee87
105105
+ }
106106
+}
107107
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
108-
index 29d8b20d1e90b0097a98f454f2f1209b27fdfa61..a6be09d67043343dc26942d9a0a4d6cebdd6b627 100644
108+
index 8e07aadd4225df5a7f5ac95de6a91309ed036ffa..e90ddf2f2039a954971f23a6dc28d460ab6f18b2 100644
109109
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
110110
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
111111
@@ -293,6 +293,7 @@ public final class CraftServer implements Server {

patches/server/0695-Add-paper-mobcaps-and-paper-playermobcaps.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ index a1770e5ae4b3014c3538b52d4912c60864e186a8..906def91bba96bab7c7aea9b87d9ec56
278278
// Paper start - add parameters and int ret type
279279
spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null);
280280
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
281-
index 46755f34fb0af5dea2db8d8321caebfc163a8268..9b3f01e84b5855b64e9f59ca29e5ff9a598084a4 100644
281+
index 4fcfad88374430b03e6ea8aa4a45e110f644a36b..5c4221f8ea476ea218a6222904c6af3841bdb1dc 100644
282282
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
283283
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
284-
@@ -2165,6 +2165,11 @@ public final class CraftServer implements Server {
284+
@@ -2161,6 +2161,11 @@ public final class CraftServer implements Server {
285285

286286
@Override
287287
public int getSpawnLimit(SpawnCategory spawnCategory) {

0 commit comments

Comments
 (0)