mirror of
https://github.com/PurpurMC/Purpur.git
synced 2025-02-17 13:00:04 +08:00
45 lines
2.6 KiB
Diff
45 lines
2.6 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/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
|
index 0363d2263b2d6bd6166fa21d7849297e95eddd77..800df3b7c04ce7ed52f265d681e7752f63ae4ec7 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
|
@@ -280,6 +280,17 @@ public class AnvilMenu extends ItemCombinerMenu {
|
|
} else if (!this.itemName.equals(itemstack.getHoverName().getString())) {
|
|
b1 = 1;
|
|
i += b1;
|
|
+ // Purpur start
|
|
+ if (player != null && player.level.purpurConfig.anvilAllowColors && player.getBukkitEntity().hasPermission("purpur.anvil.color")) {
|
|
+ final net.kyori.adventure.text.Component renameTextComponent;
|
|
+ if (itemName.startsWith("&r") && player.getBukkitEntity().hasPermission("purpur.anvil.remove_italics")) {
|
|
+ renameTextComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacyAmpersand().deserialize(itemName.substring(2)).decoration(net.kyori.adventure.text.format.TextDecoration.ITALIC, false);
|
|
+ } else {
|
|
+ renameTextComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacyAmpersand().deserialize(itemName);
|
|
+ }
|
|
+ itemstack1.setHoverName(io.papermc.paper.adventure.PaperAdventure.asVanilla(renameTextComponent));
|
|
+ } else
|
|
+ // Purpur end
|
|
itemstack1.setHoverName(Component.literal(this.itemName));
|
|
}
|
|
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 8137db4239792b114b7f5886a502e6a10176304f..f619f15d5f1e71af80b9df73d3632eeef38a9d5d 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -299,6 +299,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;
|