Paper/patches/server/0189-Add-openSign-method-to-HumanEntity.patch

47 lines
2.4 KiB
Diff
Raw Normal View History

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 openSign method to HumanEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
2022-12-07 19:52:24 +01:00
index 749f8c6eb39e9cedeec472fc176b6a2a17900201..cdc9474d37028324d39037a456be07fd4f576a6e 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
2022-12-07 19:52:24 +01:00
@@ -117,15 +117,15 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState<
}
}
- public static void openSign(Sign sign, Player player) {
+ public static void openSign(Sign sign, org.bukkit.entity.HumanEntity player) { // Paper - change move open sign to HumanEntity
Preconditions.checkArgument(sign != null, "sign == null");
- Preconditions.checkArgument(sign.isPlaced(), "Sign must be placed");
+ // Preconditions.checkArgument(sign.isPlaced(), "Sign must be placed"); // Paper - don't require placed
Preconditions.checkArgument(sign.getWorld() == player.getWorld(), "Sign must be in same world as Player");
2022-12-07 19:52:24 +01:00
SignBlockEntity handle = ((CraftSign<?>) sign).getTileEntity();
handle.isEditable = true;
- ((CraftPlayer) player).getHandle().openTextEdit(handle);
+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) player).getHandle().openTextEdit(handle); // Paper - change move open sign to HumanEntity
}
// Paper start
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 139c4310a31b6cc149de140751cb8bf3d8226010..787ccb37a39bb506cf9fd8d54cf772b346981f85 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -627,6 +627,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
}
+ // Paper start - move open sign method to HumanEntity
+ @Override
+ public void openSign(org.bukkit.block.Sign sign) {
+ org.bukkit.craftbukkit.block.CraftSign.openSign(sign, this);
+ }
+ // Paper end
@Override
public boolean dropItem(boolean dropAll) {
if (!(this.getHandle() instanceof ServerPlayer)) return false;