Cleanup ChimaeraWing

This commit is contained in:
TfT_02 2013-03-14 22:24:38 +01:00
parent 0cd3e4ed84
commit 0292d3eefb

View File

@ -45,14 +45,23 @@ public final class ChimaeraWing {
return; return;
} }
if (SkillUtils.cooldownOver(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, 60, player) && amount >= Config.getInstance().getChimaeraUseCost()) { if (!SkillUtils.cooldownOver(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, 60, player)) {
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, 60, player)));
return;
}
if (amount <= Config.getInstance().getChimaeraUseCost()) {
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", "Chimaera Wings")); //TODO Locale!
return;
}
player.setItemInHand(new ItemStack(getChimaeraWing(amount - Config.getInstance().getChimaeraUseCost()))); player.setItemInHand(new ItemStack(getChimaeraWing(amount - Config.getInstance().getChimaeraUseCost())));
if (Config.getInstance().getChimaeraPreventUseUnderground()) { if (Config.getInstance().getChimaeraPreventUseUnderground()) {
if (location.getY() < player.getWorld().getHighestBlockYAt(location)) { if (location.getY() < player.getWorld().getHighestBlockYAt(location)) {
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail")); player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
player.setVelocity(new Vector(0, 1, 0)); player.setVelocity(new Vector(0, 0.5D, 0));
UserManager.getPlayer(player).actualizeLastChimaeraTeleport(); UserManager.getPlayer(player).actualizeLastChimaeraTeleport();
return; return;
} }
@ -75,13 +84,6 @@ public final class ChimaeraWing {
MetricsManager.chimeraWingUsed(); MetricsManager.chimeraWingUsed();
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass")); player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
} }
else if (!SkillUtils.cooldownOver(recentlyHurt, 60 * Misc.TIME_CONVERSION_FACTOR, player) && amount >= Config.getInstance().getChimaeraUseCost()) {
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", SkillUtils.calculateTimeLeft(recentlyHurt, 60, player)));
}
else if (amount <= Config.getInstance().getChimaeraUseCost()) {
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", "Chimaera Wings")); //TODO Locale!
}
}
} }
public static ItemStack getChimaeraWing(int amount) { public static ItemStack getChimaeraWing(int amount) {