mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 13:06:02 +01:00
90ac03522a
This reverts commit d6e3dff7d8
.
33 lines
1.6 KiB
Diff
33 lines
1.6 KiB
Diff
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockLever.java 2014-11-28 17:43:42.917707439 +0000
|
|
+++ src/main/java/net/minecraft/server/BlockLever.java 2014-11-28 17:38:24.000000000 +0000
|
|
@@ -2,6 +2,8 @@
|
|
|
|
import java.util.Iterator;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockLever extends Block {
|
|
|
|
public static final BlockStateEnum FACING = BlockStateEnum.of("facing", EnumLeverPosition.class);
|
|
@@ -144,6 +146,20 @@
|
|
if (world.isStatic) {
|
|
return true;
|
|
} else {
|
|
+ // CraftBukkit start - Interact Lever
|
|
+ boolean powered = (Boolean)iblockdata.get(POWERED);
|
|
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
+ int old = (powered) ? 15 : 0;
|
|
+ int current = (!powered) ? 15 : 0;
|
|
+
|
|
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
|
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
|
+
|
|
+ if ((eventRedstone.getNewCurrent() > 0) != (!powered)) {
|
|
+ return true;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
iblockdata = iblockdata.a(BlockLever.POWERED);
|
|
world.setTypeAndData(blockposition, iblockdata, 3);
|
|
world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "random.click", 0.3F, ((Boolean) iblockdata.get(BlockLever.POWERED)).booleanValue() ? 0.6F : 0.5F);
|