Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onPlayerDeathEvent(PlayerDeathEvent event){
- if(event.getEntity() != null && event.getEntity().getLastDamageCause() != null && event.getEntity().getLastDamageCause().getCause() != null && event.getEntity().getLastDamageCause().getCause().equals(EntityDamageEvent.DamageCause.ENTITY_ATTACK)){
- if(r.nextInt(10)==0){
- ItemStack it = new ItemStack(Material.SKULL_ITEM);
- it.setDurability((short)3);
- SkullMeta im = (SkullMeta) it.getItemMeta();
- im.setOwner(event.getEntity().getName());
- im.setDisplayName(Colorizer.Color("&a"+event.getEntity().getName()));
- it.setItemMeta(im);
- event.getEntity().getWorld().dropItemNaturally(event.getEntity().getLocation(),it);
- }
- }
- }
- @EventHandler
- public void onPlaceSkull(BlockPlaceEvent event){
- if(event.isCancelled()){
- return;
- }
- if(getWorldGuard()!=null){
- if(!getWorldGuard().canBuild(event.getPlayer(),event.getBlockPlaced().getLocation())){
- event.setCancelled(true);
- return;
- }}
- if(event.getBlock().getType() == Material.SKULL)
- {
- event.getBlockPlaced().getState().update(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement