Add BlockRedstoneEvent to Redstone Lamps, Addresses BUKKIT-1431
This commit is contained in:
@@ -2,6 +2,11 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockRedstoneLamp extends Block {
|
||||
|
||||
private final boolean a;
|
||||
@@ -20,6 +25,11 @@ public class BlockRedstoneLamp extends Block {
|
||||
if (this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
world.c(i, j, k, this.id, 4);
|
||||
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
|
||||
}
|
||||
}
|
||||
@@ -30,6 +40,11 @@ public class BlockRedstoneLamp extends Block {
|
||||
if (this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
world.c(i, j, k, this.id, 4);
|
||||
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
|
||||
}
|
||||
}
|
||||
@@ -37,6 +52,11 @@ public class BlockRedstoneLamp extends Block {
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic && this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() != 0) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_OFF.id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user