mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Re-Implement BlockDamage
By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
parent
9757c74cb3
commit
d5ca2267db
1 changed files with 16 additions and 0 deletions
|
@ -18,6 +18,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||
|
@ -144,4 +145,19 @@ public class CraftEventFactory {
|
|||
|
||||
return event;
|
||||
}
|
||||
|
||||
public static BlockDamageEvent callBlockDamageEvent(EntityHuman who, int x, int y, int z, ItemStack itemstack, boolean instaBreak) {
|
||||
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
|
||||
CraftItemStack itemInHand = new CraftItemStack(itemstack);
|
||||
|
||||
CraftWorld craftWorld = (CraftWorld) player.getWorld();
|
||||
CraftServer craftServer = (CraftServer) player.getServer();
|
||||
|
||||
Block blockClicked = craftWorld.getBlockAt(x, y, z);
|
||||
|
||||
BlockDamageEvent event = new BlockDamageEvent(player, blockClicked, itemInHand, instaBreak);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue