mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: fb36f15d6 Let some more packets be send immediately, closes #4140 (#4896) ede41fe16 Emancipate more features to PlayerHandshakeEvent 3fdeba1f5 [CI-SKIP] [Auto] Rebuild Patches 5fc07bd63 Maded Title-Objects directy sendable to targets e7b9a478e Player Chunk Load/Unload Events 1d0cfc0cc MC-4 Fix item position desync 458db6206 Limit auto recipe packets
53 lines
3.0 KiB
Diff
53 lines
3.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Tue, 4 Aug 2020 22:08:23 -0500
|
|
Subject: [PATCH] Allow anvil colors
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
|
|
index 4aa6b035a6a8ea39401c6566cd286de39f60e942..5e4e59e5c8478b76078fdda14e5ced76304d489c 100644
|
|
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
|
|
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
|
|
@@ -251,6 +251,25 @@ public class ContainerAnvil extends ContainerAnvilAbstract {
|
|
} else if (!this.renameText.equals(itemstack.getName().getString())) {
|
|
b1 = 1;
|
|
i += b1;
|
|
+ // Purpur start
|
|
+ if (player != null && player.world.purpurConfig.anvilAllowColors && player.getBukkitEntity().hasPermission("purpur.anvil.color")) {
|
|
+ String json = "";
|
|
+ try {
|
|
+ String coloredText = net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', this.renameText);
|
|
+ net.md_5.bungee.api.chat.BaseComponent[] bungeeComp = net.md_5.bungee.api.chat.TextComponent.fromLegacyText(coloredText);
|
|
+ json = net.md_5.bungee.chat.ComponentSerializer.toString(bungeeComp);
|
|
+ IChatBaseComponent nmsComp = IChatBaseComponent.ChatSerializer.jsonToComponent(json);
|
|
+ itemstack1.a(nmsComp);
|
|
+ } catch (Exception e) {
|
|
+ MinecraftServer.LOGGER.warn("There was a problem processing item name json component on anvil!");
|
|
+ MinecraftServer.LOGGER.warn("We have fallen back to legacy colorless item name to prevent real errors");
|
|
+ MinecraftServer.LOGGER.warn("Please report this to Purpur!");
|
|
+ MinecraftServer.LOGGER.warn("JSON: " + json);
|
|
+ MinecraftServer.LOGGER.warn("The following error describes what went wrong:");
|
|
+ e.printStackTrace();
|
|
+ }
|
|
+ } else
|
|
+ // Purpur end
|
|
itemstack1.a((IChatBaseComponent) (new ChatComponentText(this.renameText)));
|
|
}
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 73969ac4480594b5c78cdb2c30fa4d49370a6a6d..876a51801f6acdbc062de743106c5a63ed94b13c 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -216,6 +216,11 @@ public class PurpurWorldConfig {
|
|
});
|
|
}
|
|
|
|
+ public boolean anvilAllowColors = false;
|
|
+ private void anvilSettings() {
|
|
+ anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
|
|
+ }
|
|
+
|
|
public int bambooMaxHeight = 16;
|
|
public int bambooSmallHeight = 10;
|
|
private void bambooSettings() {
|