PaperMC/paper-server/nms-patches/net/minecraft/world/level/block/BlockCommand.patch
CraftBukkit/Spigot 536256d6ff SPIGOT-6508: Rename conflicted getServer
By: md_5 <git@md-5.net>
2021-06-11 21:33:49 +10:00

27 lines
1.4 KiB
Diff

--- a/net/minecraft/world/level/block/BlockCommand.java
+++ b/net/minecraft/world/level/block/BlockCommand.java
@@ -26,6 +26,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 implements GameMasterBlock {
private static final Logger LOGGER = LogManager.getLogger();
@@ -56,6 +58,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.getCraftServer().getPluginManager().callEvent(eventRedstone);
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end
tileentitycommand.a(flag1);
if (!flag2 && !tileentitycommand.g() && tileentitycommand.t() != TileEntityCommand.Type.SEQUENCE) {