9
0
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:
MrPowerGamerBR
2025-07-29 01:37:57 -03:00
parent b5cbd7fba1
commit aa171f36eb
3 changed files with 25 additions and 3 deletions

View File

@@ -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
}
});

View File

@@ -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

View File

@@ -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());
}