From 71249334c32642e9c7ab858c1547c27560d06401 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 10 Apr 2013 16:05:10 +0200 Subject: [PATCH] Change the ChimaeraWing timestamp into a general teleportation timestamp --- .../nossr50/datatypes/player/McMMOPlayer.java | 31 +++++++++---------- .../runnables/items/ChimaeraWingWarmup.java | 4 +-- .../com/gmail/nossr50/util/ChimaeraWing.java | 10 +++--- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 6b5a6bdde..c82f25a2e 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -79,11 +79,10 @@ public class McMMOPlayer { private Map toolMode = new HashMap(); private Map toolATS = new HashMap(); - private int chimaeraWing; - private Location chimaeraWingCommence; - private int recentlyHurt; private int respawnATS; + private int teleportLastUse; + private Location teleportCommence; private boolean isUsingUnarmed; @@ -305,31 +304,31 @@ public class McMMOPlayer { } /* - * Chimaera Wing + * Teleportation cooldown & warmup */ - public int getLastChimaeraTeleport() { - return chimaeraWing; + public int getLastTeleport() { + return teleportLastUse; } - public void setLastChimaeraTeleport(int value) { - chimaeraWing = value; + public void setLastTeleport(int value) { + teleportLastUse = value; } - public void actualizeLastChimaeraTeleport() { - chimaeraWing = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR); + public void actualizeLastTeleport() { + teleportLastUse = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR); } - public Location getChimaeraCommenceLocation() { - return chimaeraWingCommence; + public Location getTeleportCommenceLocation() { + return teleportCommence; } - public void setChimaeraCommenceLocation(Location location) { - chimaeraWingCommence = location; + public void setTeleportCommenceLocation(Location location) { + teleportCommence = location; } - public void actualizeChimaeraCommenceLocation(Player player) { - setChimaeraCommenceLocation(player.getLocation()); + public void actualizeTeleportCommenceLocation(Player player) { + setTeleportCommenceLocation(player.getLocation()); } /* 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 31aa722f0..74adb516e 100644 --- a/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java +++ b/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java @@ -28,12 +28,12 @@ public class ChimaeraWingWarmup extends BukkitRunnable { private void checkChimaeraWingTeleport() { Player player = mcMMOPlayer.getPlayer(); - Location previousLocation = mcMMOPlayer.getChimaeraCommenceLocation(); + Location previousLocation = mcMMOPlayer.getTeleportCommenceLocation(); Location newLocation = mcMMOPlayer.getPlayer().getLocation(); long recentlyHurt = mcMMOPlayer.getRecentlyHurt(); ItemStack inHand = player.getItemInHand(); - mcMMOPlayer.setChimaeraCommenceLocation(null); + mcMMOPlayer.setTeleportCommenceLocation(null); if (newLocation.distanceSquared(previousLocation) > 1.0 || !player.getInventory().containsAtLeast(ChimaeraWing.getChimaeraWing(0), 1)) { player.sendMessage(ChatColor.DARK_RED + "Teleportation canceled!"); //TODO Locale! diff --git a/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java b/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java index 88ef547fa..7906dcefc 100644 --- a/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java +++ b/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java @@ -46,10 +46,10 @@ public final class ChimaeraWing { location = player.getLocation(); int amount = inHand.getAmount(); long recentlyHurt = mcMMOPlayer.getRecentlyHurt(); - long lastChimaeraWing = mcMMOPlayer.getLastChimaeraTeleport(); + long lastChimaeraWing = mcMMOPlayer.getLastTeleport(); if (Permissions.chimaeraWing(player) && ItemUtils.isChimaeraWing(inHand)) { - if (mcMMOPlayer.getChimaeraCommenceLocation() != null) { + if (mcMMOPlayer.getTeleportCommenceLocation() != null) { return; } @@ -74,12 +74,12 @@ public final class ChimaeraWing { player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail")); player.setVelocity(new Vector(0, 0.5D, 0)); CombatUtils.dealDamage(player, Misc.getRandom().nextInt(player.getHealth() - 10)); - mcMMOPlayer.actualizeLastChimaeraTeleport(); + mcMMOPlayer.actualizeLastTeleport(); return; } } - mcMMOPlayer.actualizeChimaeraCommenceLocation(player); + mcMMOPlayer.actualizeTeleportCommenceLocation(player); long warmup = Config.getInstance().getChimaeraWarmup(); @@ -110,7 +110,7 @@ public final class ChimaeraWing { } player.setItemInHand(new ItemStack(getChimaeraWing(player.getItemInHand().getAmount() - Config.getInstance().getChimaeraUseCost()))); - UserManager.getPlayer(player).actualizeLastChimaeraTeleport(); + UserManager.getPlayer(player).actualizeLastTeleport(); if (Config.getInstance().getStatsTrackingEnabled()) { MetricsManager.chimeraWingUsed(); }