2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockTripwire.java
|
|
|
|
+++ b/net/minecraft/server/BlockTripwire.java
|
2016-05-10 13:47:39 +02:00
|
|
|
@@ -5,6 +5,8 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
import java.util.Map;
|
2014-11-25 22:32:16 +01:00
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockTripwire extends Block {
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
public static final BlockStateBoolean POWERED = BlockProperties.w;
|
|
|
|
@@ -139,6 +141,40 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
}
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // 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) {
|
2016-03-04 05:24:51 +01:00
|
|
|
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ } 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
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
if (flag1 != flag) {
|
2018-12-06 00:00:00 +01:00
|
|
|
iblockdata = (IBlockData) iblockdata.set(BlockTripwire.POWERED, flag1);
|
2015-02-26 23:41:06 +01:00
|
|
|
world.setTypeAndData(blockposition, iblockdata, 3);
|