mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 03:32:46 +01:00
Merge pull request #1070 from mikroskeem/feature/open-placed-sign
Add method to open already placed sign
This commit is contained in:
commit
c719bcbe4c
2 changed files with 58 additions and 0 deletions
|
@ -0,0 +1,27 @@
|
|||
From 68549b0d344a01f477843cb2023716f2db573f32 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Sun, 1 Apr 2018 02:28:43 +0300
|
||||
Subject: [PATCH] Add method to open already placed sign
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
index 3939d4af..dd95773e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
@@ -335,4 +335,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, Inv
|
||||
*/
|
||||
@Deprecated
|
||||
public void setShoulderEntityRight(Entity entity);
|
||||
+
|
||||
+ // Paper start - Add method to open already placed sign
|
||||
+ /**
|
||||
+ * Opens an editor window for the specified sign
|
||||
+ *
|
||||
+ * @param sign The sign to open
|
||||
+ */
|
||||
+ void openSign(org.bukkit.block.Sign sign);
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.16.3
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
From 7c3df4fa912a9bb2192a0d96cefc191085afd673 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 a0128426f..d85b5defc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -507,4 +507,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.16.3
|
||||
|
Loading…
Reference in a new issue