Paper/patches/server/0189-Add-method-to-open-already-placed-sign.patch
2021-11-30 19:26:33 +01:00

29 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Sun, 1 Apr 2018 02:29:37 +0300
Subject: [PATCH] Add method to open already placed sign
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index cc1caa32ea430f69d0dcfb76e1a08fb78650877d..87bc05f2eef1555ad3346d1d1bda72d4feb0fa1b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -610,6 +610,17 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
}
+ // Paper start - Add method to open already placed sign
+ @Override
+ public void openSign(org.bukkit.block.Sign sign) {
+ org.apache.commons.lang.Validate.isTrue(sign.getWorld().equals(this.getWorld()), "Sign must be in the same world as player is in");
+ org.bukkit.craftbukkit.block.CraftSign craftSign = (org.bukkit.craftbukkit.block.CraftSign) sign;
+ net.minecraft.world.level.block.entity.SignBlockEntity teSign = craftSign.getTileEntity();
+ // Make sign editable temporarily, will be set back to false in PlayerConnection later
+ teSign.isEditable = true;
+ this.getHandle().openTextEdit(teSign);
+ }
+ // Paper end
@Override
public boolean dropItem(boolean dropAll) {
if (!(this.getHandle() instanceof ServerPlayer)) return false;