public static void healWithPotion(int amount, String name, Event event, Player p) {
if (!(event instanceof PlayerInteractEvent))
return;
PlayerInteractEvent e = (PlayerInteractEvent) event;
if (!(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK))
return;
if (lastHealItem.containsKey(p.getName()) && System.currentTimeMillis() - lastHealItem.get(p.getName()) < 500) {
return;
}
lastHealItem.put(p.getName(), System.currentTimeMillis());
p.getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
PlayerDataRPG pd = plugin.getPD(p);
pd.heal(amount, HealType.POTION);
for (int k = 0; k < p.getInventory().getContents().length; k++) {
if (ItemManager.isItem(p.getInventory().getItem(k), name)) {
p.getEquipment().setItemInMainHand(p.getInventory().getItem(k));
p.getInventory().setItem(k, new ItemStack(Material.AIR));
break;
}
}
RSound.playSound(p, Sound.ENTITY_GENERIC_DRINK);
}
EtcItem.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:ZentrelaRPG
作者:
评论列表
文章目录