use of org.bukkit.event.hanging.HangingPlaceEvent in project Glowstone by GlowstoneMC.
the class ItemItemFrame method rightClickBlock.
@Override
public void rightClickBlock(GlowPlayer player, GlowBlock target, BlockFace face, ItemStack holding, Vector clickedLoc, EquipmentSlot hand) {
GlowItemFrame entity = new GlowItemFrame(player, target.getRelative(face).getLocation(), face);
if (EventFactory.getInstance().callEvent(new HangingPlaceEvent(entity, player, target, face)).isCancelled()) {
return;
}
List<Message> spawnMessage = entity.createSpawnMessage();
entity.getWorld().getRawPlayers().stream().filter(p -> p.canSeeEntity(entity)).forEach(p -> p.getSession().sendAll(spawnMessage.toArray(new Message[spawnMessage.size()])));
}
Aggregations