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: 840e72091 [CI-SKIP] [Auto] Rebuild Patches a33232d4a Add beacon activation and deactivation events (#5121) bc7ea673a Add internal channel initialization listeners (#5557) b28ad17ac Check for world change in MoveEvent API methods 3095c7592 [Auto] Updated Upstream (CraftBukkit) f56989c97 Add RespawnFlags to PlayerRespawnEvent (#5533) 7579c2667 Add more API to PlayerMoveEvent (#5553)
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/world/inventory/ContainerAnvil.java b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java
|
|
index 1b2d633f3d5d735039f18f27fb1387bd5a74f0d8..77810fbb70bf2e1ad03c28c0d69ceaa63221d94c 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java
|
|
@@ -28,6 +28,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();
|
|
@@ -269,6 +276,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 0d29894033d648c3588f4d02646ebe6cdd11f334..87eb9d7a9d15640fe8d5892ae609d63dc6754379 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -268,6 +268,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;
|