mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Change the ChimaeraWing timestamp into a general teleportation timestamp
This commit is contained in:
parent
fa41dbce16
commit
71249334c3
@ -79,11 +79,10 @@ public class McMMOPlayer {
|
||||
private Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
||||
private Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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!
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user