@SuppressWarnings("deprecation")
@EventHandler
public void grenadeEvent(PlayerInteractEvent e){
final Player p = e.getPlayer();
if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
if(p.getItemInHand().hasItemMeta()){
if(p.getItemInHand().getItemMeta().getLore() == null) return;
if(p.getItemInHand().getItemMeta().getLore().contains(ChatColor.GRAY + "Grenade I")){
p.getItemInHand().setDurability((short) (p.getItemInHand().getDurability() - 4));
final Item grenade = p.getWorld().dropItem(p.getEyeLocation(), new ItemStack(Material.CLAY_BALL));
grenade.setVelocity(p.getEyeLocation().getDirection().normalize().multiply(0.8D));
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
public void run(){
p.getWorld().createExplosion(grenade.getLocation().getX(), grenade.getLocation().getY(),
grenade.getLocation().getZ(), 3, false, false);
grenade.remove();
}
},30L);
}
}
}
}
Core.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:chaoticWeapons
作者:
评论列表
文章目录