Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-23 14:50:08 +01:00
53 Zeilen
2.3 KiB
Diff
53 Zeilen
2.3 KiB
Diff
--- /home/matt/mc-dev-private//net/minecraft/server/BlockTripwire.java 2015-02-26 22:40:22.279608143 +0000
|
|
+++ src/main/java/net/minecraft/server/BlockTripwire.java 2015-02-26 22:40:22.283608143 +0000
|
|
@@ -4,6 +4,8 @@
|
|
import java.util.List;
|
|
import java.util.Random;
|
|
|
|
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
|
|
+
|
|
public class BlockTripwire extends Block {
|
|
|
|
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
|
|
@@ -155,6 +157,40 @@
|
|
}
|
|
}
|
|
|
|
+ // CraftBukkit start - Call interact even when triggering connected tripwire
|
|
+ if (flag != flag1 && flag1 && (Boolean)iblockdata.get(ATTACHED)) {
|
|
+ org.bukkit.World bworld = world.getWorld();
|
|
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
|
+ org.bukkit.block.Block block = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
+ boolean allowed = false;
|
|
+
|
|
+ // If all of the events are cancelled block the tripwire trigger, else allow
|
|
+ for (Object object : list) {
|
|
+ if (object != null) {
|
|
+ org.bukkit.event.Cancellable cancellable;
|
|
+
|
|
+ if (object instanceof EntityHuman) {
|
|
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null);
|
|
+ } else if (object instanceof Entity) {
|
|
+ cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), block);
|
|
+ manager.callEvent((EntityInteractEvent) cancellable);
|
|
+ } else {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ if (!cancellable.isCancelled()) {
|
|
+ allowed = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (!allowed) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
if (flag1 != flag) {
|
|
iblockdata = iblockdata.set(BlockTripwire.POWERED, Boolean.valueOf(flag1));
|
|
world.setTypeAndData(blockposition, iblockdata, 3);
|