3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-22 14:28:09 +01:00
Paper/nms-patches/BlockCommand.patch

40 Zeilen
1.7 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockCommand.java
+++ b/net/minecraft/server/BlockCommand.java
@@ -2,6 +2,8 @@
import java.util.Random;
+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;
@@ -29,7 +31,17 @@
boolean flag1 = tileentitycommand.d();
boolean flag2 = tileentitycommand.e();
2015-02-26 23:41:06 +01:00
2016-02-29 22:32:46 +01:00
- if (flag && !flag1) {
+ // CraftBukkit start
2016-02-29 22:32:46 +01:00
+ // PAIL: This section - renames, ordering
+ 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);
if (tileentitycommand.i() != TileEntityCommand.Type.SEQUENCE && !flag2) {
boolean flag3 = !tileentitycommand.j() || this.e(world, blockposition, iblockdata);
@@ -40,7 +52,7 @@
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);
}