mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 0514fc4e2 Add missing effects 8f5d9effd Add getMainThreadExecutor to BukkitScheduler 313b5020b Allow adding items to BlockDropItemEvent (#5093) 9a556d9da [CI-SKIP] [Auto] Rebuild Patches 72b2768ad Inline shift fields in EnumDirection (#5082) ffff53fa7 added option to disable pathfinding updates on block changes (#5123) b67081fd7 add DragonEggFormEvent (fixes #5110) (#5112) 3eefafbaf Fix javadoc build 0081ed1c4 Add javadoc step to GH Actions 01082503e Add dropLeash variable to EntityUnleashEvent (#5130) 31f9f869a [CI-SKIP] Fix YourKit links in readme, fixes #5091 8ac27aa38 [Auto] Updated Upstream (CraftBukkit) c4d9cc831 [Auto] Updated Upstream (Bukkit/CraftBukkit) d0477d326 [Auto] Updated Upstream (CraftBukkit) d9f5f7018 EntityMoveEvent (#4614)
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 059c66a2d3f878cde8896c8f10f71bfecaea4685..95d13aafc468532f66abd265657f463e361f2297 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;
|