aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0246-Add-method-to-open-already-placed-sign.patch
blob: dc0b2ed43b150ea060aaea819b4ab152ec6b8209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 72a83e45b01f592f4f0bed57cb341631b515b925 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 d5dbc4ca81..9b19dce9bd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -655,4 +655,17 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
             entity.remove();
         }
     }
+
+    // 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.server.TileEntitySign teSign = craftSign.getTileEntity();
+        // Make sign editable temporarily, will be set back to false in PlayerConnection later
+        teSign.isEditable = true;
+
+        getHandle().openSign(teSign);
+    }
+    // Paper end
 }
-- 
2.21.0