Paper/nms-patches/BlockCommand.patch

39 lines
1.7 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockCommand.java
+++ b/net/minecraft/server/BlockCommand.java
2016-05-10 13:47:39 +02:00
@@ -3,6 +3,8 @@
import java.util.Random;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
2016-02-29 22:32:46 +01:00
public class BlockCommand extends BlockTileEntity {
2016-02-29 22:32:46 +01:00
public static final BlockStateDirection a = BlockDirectional.FACING;
2016-05-10 13:47:39 +02:00
@@ -30,7 +32,16 @@
2016-06-09 03:43:49 +02:00
boolean flag1 = tileentitycommand.g();
boolean flag2 = tileentitycommand.h();
2015-02-26 23:41:06 +01:00
2016-02-29 22:32:46 +01:00
- if (flag && !flag1) {
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int old = flag1 ? 15 : 0;
+ int current = flag ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ // CraftBukkit end
2015-02-26 23:41:06 +01:00
+
+ if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
2016-02-29 22:32:46 +01:00
tileentitycommand.a(true);
2016-06-09 03:43:49 +02:00
if (tileentitycommand.k() != TileEntityCommand.Type.SEQUENCE && !flag2) {
boolean flag3 = !tileentitycommand.l() || this.e(world, blockposition, iblockdata);
2016-05-10 13:47:39 +02:00
@@ -41,7 +52,7 @@
2016-02-29 22:32:46 +01:00
this.c(world, blockposition);
}
}
- } else if (!flag && flag1) {
+ } else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
2016-02-29 22:32:46 +01:00
tileentitycommand.a(false);
}