mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
52 lines
2.1 KiB
Diff
52 lines
2.1 KiB
Diff
--- a/net/minecraft/server/BlockRedstoneTorch.java
|
|
+++ b/net/minecraft/server/BlockRedstoneTorch.java
|
|
@@ -6,6 +6,8 @@
|
|
import java.util.Random;
|
|
import java.util.WeakHashMap;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockRedstoneTorch extends BlockTorch {
|
|
|
|
public static final BlockStateBoolean LIT = BlockProperties.r;
|
|
@@ -62,8 +64,24 @@
|
|
list.remove(0);
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.plugin.PluginManager manager = worldserver.getServer().getPluginManager();
|
|
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
+ int oldCurrent = ((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)).booleanValue() ? 15 : 0;
|
|
+
|
|
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
|
+ // CraftBukkit end
|
|
if ((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)) {
|
|
if (flag) {
|
|
+ // CraftBukkit start
|
|
+ if (oldCurrent != 0) {
|
|
+ event.setNewCurrent(0);
|
|
+ manager.callEvent(event);
|
|
+ if (event.getNewCurrent() != 0) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, false), 3);
|
|
if (a(worldserver, blockposition, true)) {
|
|
worldserver.triggerEffect(1502, blockposition, 0);
|
|
@@ -71,6 +89,15 @@
|
|
}
|
|
}
|
|
} else if (!flag && !a(worldserver, blockposition, false)) {
|
|
+ // CraftBukkit start
|
|
+ if (oldCurrent != 15) {
|
|
+ event.setNewCurrent(15);
|
|
+ manager.callEvent(event);
|
|
+ if (event.getNewCurrent() != 15) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, true), 3);
|
|
}
|
|
|