mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-27 02:49:06 +00:00
Fix item desync bug when creating items that have custom colors
https://github.com/PaperMC/Paper/issues/12902
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
--- a/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java
|
||||
@@ -96,7 +_,7 @@
|
||||
if (textColor instanceof NamedTextColor named) {
|
||||
return NamedTextColor.NAMES.keyOrThrow(named);
|
||||
} else {
|
||||
- return textColor.asHexString();
|
||||
+ return textColor.asHexString().toUpperCase(java.util.Locale.ROOT); // SparklyPaper - (Adventure Bug #1275) Fix item desyncs with items that have custom colors
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1045,6 +_,7 @@
|
||||
@@ -1048,6 +_,7 @@
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
@@ -8,7 +8,7 @@
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -1060,6 +_,7 @@
|
||||
@@ -1063,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1077,6 +_,7 @@
|
||||
@@ -1080,6 +_,7 @@
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
this.spark.registerCommandBeforePlugins(this); // Paper - spark
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/test/java/io/papermc/paper/adventure/AdventureCodecsTest.java
|
||||
+++ b/src/test/java/io/papermc/paper/adventure/AdventureCodecsTest.java
|
||||
@@ -85,7 +_,7 @@
|
||||
void testTextColor() {
|
||||
final TextColor color = color(0x1d38df);
|
||||
final Tag result = TEXT_COLOR_CODEC.encodeStart(NbtOps.INSTANCE, color).result().orElseThrow();
|
||||
- assertEquals("\"" + color.asHexString() + "\"", result.toString());
|
||||
+ assertEquals("\"" + color.asHexString().toUpperCase(java.util.Locale.ROOT) + "\"", result.toString());
|
||||
final net.minecraft.network.chat.TextColor nms = net.minecraft.network.chat.TextColor.CODEC.decode(NbtOps.INSTANCE, result).result().orElseThrow().getFirst();
|
||||
assertEquals(color.value(), nms.getValue());
|
||||
}
|
||||
Reference in New Issue
Block a user