mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-15 03:05:39 +01:00
31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
--- a/net/minecraft/server/BlockLever.java
|
|
+++ b/net/minecraft/server/BlockLever.java
|
|
@@ -1,5 +1,7 @@
|
|
package net.minecraft.server;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockLever extends BlockAttachable {
|
|
|
|
public static final BlockStateBoolean POWERED = BlockProperties.w;
|
|
@@ -64,6 +66,20 @@
|
|
|
|
return true;
|
|
} else {
|
|
+ // CraftBukkit start - Interact Lever
|
|
+ boolean powered = !flag; // Old powered state
|
|
+ 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
|
|
+
|
|
world.setTypeAndData(blockposition, iblockdata, 3);
|
|
float f = flag ? 0.6F : 0.5F;
|
|
|