mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: cae142b85 Enable Hex colors on PaperAdventure.LEGACY_SECTION_UXRC, and use it for sending messages to console command sender (#5230) c1635eabb PlayerDeathEvent#getDeathMessage should provide translation for legacy reasons #5227 3f74af202 Fix Log4J converter not parsing hex without named colors (#5228)
59 lines
2.8 KiB
Diff
59 lines
2.8 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..02924766a4c655f149b58bf1ded8e0610f8900a3 100644
|
|
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
|
|
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
|
|
@@ -10,6 +10,13 @@ import org.apache.logging.log4j.Logger;
|
|
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
// CraftBukkit end
|
|
|
|
+// Purpur start
|
|
+import io.papermc.paper.adventure.PaperAdventure;
|
|
+import net.kyori.adventure.text.Component;
|
|
+
|
|
+import static net.kyori.adventure.text.format.TextDecoration.ITALIC;
|
|
+// Purpur end
|
|
+
|
|
public class ContainerAnvil extends ContainerAnvilAbstract {
|
|
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
|
@@ -251,6 +258,17 @@ 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")) {
|
|
+ final Component renameTextComponent;
|
|
+ if (renameText.startsWith("&r") && player.getBukkitEntity().hasPermission("purpur.anvil.remove_italics")) {
|
|
+ renameTextComponent = PaperAdventure.LEGACY_AMPERSAND.deserialize(renameText.substring(2)).decoration(ITALIC, false);
|
|
+ } else {
|
|
+ renameTextComponent = PaperAdventure.LEGACY_AMPERSAND.deserialize(renameText);
|
|
+ }
|
|
+ itemstack1.a(PaperAdventure.asVanilla(renameTextComponent));
|
|
+ } 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 ade194e572b37365cc2becc69081bac8ca34ca46..227bdc2d24d4d6dbacbf5b93497d1a4b61290af0 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -234,6 +234,11 @@ public class PurpurWorldConfig {
|
|
});
|
|
}
|
|
|
|
+ public boolean anvilAllowColors = false;
|
|
+ private void anvilSettings() {
|
|
+ anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
|
|
+ }
|
|
+
|
|
public boolean bedExplode = true;
|
|
public double bedExplosionPower = 5.0D;
|
|
public boolean bedExplosionFire = true;
|