mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 21:19:00 +01:00
Made stepping on Redstone Ore fire PlayerInteract events for players, EntityInteract events for other entities. Fixes BUKKIT-1163 and fixes BUKKIT-1182
Note: the client seems to predict redstone ore interacting, so you may see ore lighting up when it shouldn't be. However, cancelled events should function as expected.
This commit is contained in:
parent
16c6cbe5eb
commit
5a6878b9b1
@ -25,9 +25,23 @@ public class BlockRedstoneOre extends Block {
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Entity entity) {
|
||||
// CraftBukkit start
|
||||
if (entity instanceof EntityHuman) {
|
||||
org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
||||
if (!event.isCancelled()) {
|
||||
this.g(world, i, j, k);
|
||||
super.b(world, i, j, k, entity);
|
||||
}
|
||||
} else {
|
||||
org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
this.g(world, i, j, k);
|
||||
super.b(world, i, j, k, entity);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.g(world, i, j, k);
|
||||
|
Loading…
Reference in New Issue
Block a user