testserver/Spigot-Server-Patches/0207-Add-method-to-open-alr...

37 lines
1.8 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2018-03-31 23:30:41 +00:00
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
2021-03-16 15:50:45 +00:00
index 8661f97ac885daca068057c1fcc4eed54c6d7f14..db7ad5a94d449f58a5749115776e61f448ff2f52 100644
2018-03-31 23:30:41 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
2021-03-16 15:50:45 +00:00
@@ -30,6 +30,7 @@ import net.minecraft.world.level.block.BlockWorkbench;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntityContainer;
+import net.minecraft.world.level.block.entity.TileEntitySign;
import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.GameMode;
import org.bukkit.Location;
@@ -603,6 +604,17 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
2018-03-31 23:30:41 +00:00
}
}
2018-03-31 23:30:41 +00:00
+ // 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;
2021-03-16 15:50:45 +00:00
+ TileEntitySign teSign = craftSign.getTileEntity();
2018-03-31 23:30:41 +00:00
+ // Make sign editable temporarily, will be set back to false in PlayerConnection later
+ teSign.isEditable = true;
+ getHandle().openSign(teSign);
+ }
+ // Paper end
@Override
public boolean dropItem(boolean dropAll) {
return getHandle().dropItem(dropAll);