From 0ebc555136c437aba2d8f2e04ae9a018e65764d6 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Mon, 1 Apr 2013 11:32:28 +0200 Subject: [PATCH] Fixed bug with ChimaeraWings not taking Wings from a players inventory properly Fixes #914 --- Changelog.txt | 1 + .../runnables/items/ChimaeraWingWarmup.java | 20 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index bc95142199..e64c766f99 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -11,6 +11,7 @@ Version 1.4.05-dev + Added option to allow refreshing of chunks after block-breaking abilities. (Disabled by default) = Fixed bug where /addxp was setting instead of adding experience = Fixed bug which allowed players to share experience with nearby dead players + = Fixed bug with ChimaeraWings not taking Wings from a players inventory properly Version 1.4.04 + Added functions to ExperienceAPI for use with offline players diff --git a/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java b/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java index 8c99900ebe..c8819f3ccb 100644 --- a/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java +++ b/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java @@ -3,11 +3,14 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.ChimaeraWing; +import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.skills.SkillUtils; @@ -28,22 +31,25 @@ private void checkChimaeraWingTeleport() { Location previousLocation = mcMMOPlayer.getChimaeraCommenceLocation(); Location newLocation = mcMMOPlayer.getPlayer().getLocation(); long recentlyHurt = mcMMOPlayer.getRecentlyHurt(); + ItemStack inHand = player.getItemInHand(); - if (newLocation.distanceSquared(previousLocation) > 1.0) { - player.sendMessage(ChatColor.RED + "Teleportation canceled!"); //TODO Locale! + mcMMOPlayer.setChimaeraCommenceLocation(null); + + if (newLocation.distanceSquared(previousLocation) > 1.0 || !player.getInventory().containsAtLeast(ChimaeraWing.getChimaeraWing(0), 1)) { + player.sendMessage(ChatColor.DARK_RED + "Teleportation canceled!"); //TODO Locale! + return; + } - mcMMOPlayer.setChimaeraCommenceLocation(null); + if (!ItemUtils.isChimaeraWing(inHand) || inHand.getAmount() < Config.getInstance().getChimaeraUseCost()) { + player.sendMessage(ChatColor.DARK_RED + "Not holding enough " + ChatColor.GRAY + "ChimaeraWings"); //TODO Locale! return; } 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))); - - mcMMOPlayer.setChimaeraCommenceLocation(null); return; } - ChimaeraWing.chimaeraExecuteTeleport(); - mcMMOPlayer.setChimaeraCommenceLocation(null); + ChimaeraWing.chimaeraExecuteTeleport(); } }