Skip to content

Commit

Permalink
Fixed bug with ChimaeraWings not taking Wings from a players inventor…
Browse files Browse the repository at this point in the history
…y properly

Fixes #914
  • Loading branch information
TfT-02 committed Apr 1, 2013
1 parent 4992c50 commit 0ebc555
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changelog.txt
Expand Up @@ -11,6 +11,7 @@ Version 1.4.05-dev
+ Added option to allow refreshing of chunks after block-breaking abilities. (Disabled by default) + 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 where /addxp was setting instead of adding experience
= Fixed bug which allowed players to share experience with nearby dead players = 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 Version 1.4.04
+ Added functions to ExperienceAPI for use with offline players + Added functions to ExperienceAPI for use with offline players
Expand Down
Expand Up @@ -3,11 +3,14 @@
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;


import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.ChimaeraWing; import com.gmail.nossr50.util.ChimaeraWing;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;


Expand All @@ -28,22 +31,25 @@ private void checkChimaeraWingTeleport() {
Location previousLocation = mcMMOPlayer.getChimaeraCommenceLocation(); Location previousLocation = mcMMOPlayer.getChimaeraCommenceLocation();
Location newLocation = mcMMOPlayer.getPlayer().getLocation(); Location newLocation = mcMMOPlayer.getPlayer().getLocation();
long recentlyHurt = mcMMOPlayer.getRecentlyHurt(); long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
ItemStack inHand = player.getItemInHand();


if (newLocation.distanceSquared(previousLocation) > 1.0) { mcMMOPlayer.setChimaeraCommenceLocation(null);
player.sendMessage(ChatColor.RED + "Teleportation canceled!"); //TODO Locale!
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; return;
} }


if (!SkillUtils.cooldownOver(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, 60, player)) { 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))); player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, 60, player)));

mcMMOPlayer.setChimaeraCommenceLocation(null);
return; return;
} }
ChimaeraWing.chimaeraExecuteTeleport();


mcMMOPlayer.setChimaeraCommenceLocation(null); ChimaeraWing.chimaeraExecuteTeleport();
} }
} }

0 comments on commit 0ebc555

Please sign in to comment.