geforkt von Mirrors/Paper
BlockInteract fixed for pressure plates
Dieser Commit ist enthalten in:
Ursprung
2ae5b98d10
Commit
f28f3a6a9c
@ -68,24 +68,6 @@ public class BlockPressurePlate extends Block {
|
|||||||
public void a(World world, int i, int j, int k, Entity entity) {
|
public void a(World world, int i, int j, int k, Entity entity) {
|
||||||
if (!world.isStatic) {
|
if (!world.isStatic) {
|
||||||
if (world.getData(i, j, k) != 1) {
|
if (world.getData(i, j, k) != 1) {
|
||||||
|
|
||||||
// CraftBukkit start - Interact Pressure Plate
|
|
||||||
if (entity instanceof EntityLiving) {
|
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
|
||||||
Type eventType = Type.BLOCK_INTERACT;
|
|
||||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
|
||||||
org.bukkit.entity.LivingEntity who = (entity == null) ? null : (LivingEntity) entity.getBukkitEntity();
|
|
||||||
|
|
||||||
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
this.g(world, i, j, k);
|
this.g(world, i, j, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,13 +95,32 @@ public class BlockPressurePlate extends Block {
|
|||||||
flag1 = true;
|
flag1 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start - Interact Pressure Plate
|
||||||
|
CraftServer server = ((WorldServer) world).getServer();
|
||||||
|
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||||
|
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||||
|
|
||||||
if (flag != flag1) {
|
if (flag != flag1) {
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
if (flag1) {
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
for (Object object: list) {
|
||||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
if (object != null && object instanceof EntityLiving) {
|
||||||
|
EntityLiving entity = (EntityLiving) object;
|
||||||
|
Type eventType = Type.BLOCK_INTERACT;
|
||||||
|
org.bukkit.entity.LivingEntity who = (LivingEntity) entity.getBukkitEntity();
|
||||||
|
|
||||||
|
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
||||||
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
|
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
|
||||||
server.getPluginManager().callEvent(eventRedstone);
|
server.getPluginManager().callEvent(eventRedstone);
|
||||||
|
|
||||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren