PaperMC/nms-patches/BlockCommand.patch

28 lines
1.3 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
2017-05-14 04:00:00 +02:00
@@ -4,6 +4,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
2016-02-29 22:32:46 +01:00
public class BlockCommand extends BlockTileEntity {
2017-05-14 04:00:00 +02:00
private static final Logger c = LogManager.getLogger();
2019-04-23 04:00:00 +02:00
@@ -32,6 +34,15 @@
2017-05-14 04:00:00 +02:00
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
2019-04-23 04:00:00 +02:00
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
boolean flag2 = tileentitycommand.d();
2017-05-14 04:00:00 +02:00
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
2019-04-23 04:00:00 +02:00
+ int old = flag2 ? 15 : 0;
+ int current = flag1 ? 15 : 0;
2015-02-26 23:41:06 +01:00
+
2017-05-14 04:00:00 +02:00
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
2019-04-23 04:00:00 +02:00
+ flag1 = eventRedstone.getNewCurrent() > 0;
2017-05-14 04:00:00 +02:00
+ // CraftBukkit end
2016-02-29 22:32:46 +01:00
2019-04-23 04:00:00 +02:00
tileentitycommand.a(flag1);
if (!flag2 && !tileentitycommand.f() && tileentitycommand.t() != TileEntityCommand.Type.SEQUENCE) {