mirror of
https://github.com/PurpurMC/Purpur.git
synced 2025-02-23 13:09:31 +08:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@a9f252e Replace third party repos with Paper repo (#7733) PaperMC/Paper@b8fa41e [ci skip] Remove Mojang repo from test-plugin PaperMC/Paper@c6e631a Use username instead of display name in PlayerList#getPlayerStats (#7740) PaperMC/Paper@1cfd363 Updated Upstream (Bukkit/CraftBukkit/Spigot)
55 lines
2.8 KiB
Diff
55 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/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
|
index a88efd9b435349ae00c4152f09d87ebf4f724659..75e1f6b593a23c88f34cc25db580930066bfb7bb 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
|
@@ -3,6 +3,9 @@ package net.minecraft.world.inventory;
|
|
import com.mojang.logging.LogUtils;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
+
|
|
+import io.papermc.paper.adventure.PaperAdventure;
|
|
+import net.kyori.adventure.text.format.TextDecoration;
|
|
import net.minecraft.nbt.IntTag;
|
|
import net.minecraft.network.chat.TextComponent;
|
|
import net.minecraft.network.protocol.game.ClientboundContainerSetDataPacket;
|
|
@@ -276,6 +279,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 = PaperAdventure.LEGACY_AMPERSAND.deserialize(itemName.substring(2)).decoration(TextDecoration.ITALIC, false);
|
|
+ } else {
|
|
+ renameTextComponent = PaperAdventure.LEGACY_AMPERSAND.deserialize(itemName);
|
|
+ }
|
|
+ itemstack1.setHoverName(PaperAdventure.asVanilla(renameTextComponent));
|
|
+ } else
|
|
+ // Purpur end
|
|
itemstack1.setHoverName(new TextComponent(this.itemName));
|
|
}
|
|
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index e6b649f80931a70e40d1949d964df52ef6517cef..6319654f2560a1d035d13b2a1ada30c91c4d9cdb 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -296,6 +296,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;
|