3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
Paper/nms-patches/BlockCommand.patch
2019-05-28 06:30:00 +10:00

28 Zeilen
1.3 KiB
Diff

--- a/net/minecraft/server/BlockCommand.java
+++ b/net/minecraft/server/BlockCommand.java
@@ -4,6 +4,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockCommand extends BlockTileEntity {
private static final Logger LOGGER = LogManager.getLogger();
@@ -32,6 +34,15 @@
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
boolean flag2 = tileentitycommand.f();
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int old = flag2 ? 15 : 0;
+ int current = flag1 ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end
tileentitycommand.a(flag1);
if (!flag2 && !tileentitycommand.g() && tileentitycommand.u() != TileEntityCommand.Type.SEQUENCE) {