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, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
||||||
private Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
private Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
||||||
|
|
||||||
private int chimaeraWing;
|
|
||||||
private Location chimaeraWingCommence;
|
|
||||||
|
|
||||||
private int recentlyHurt;
|
private int recentlyHurt;
|
||||||
private int respawnATS;
|
private int respawnATS;
|
||||||
|
private int teleportLastUse;
|
||||||
|
private Location teleportCommence;
|
||||||
|
|
||||||
private boolean isUsingUnarmed;
|
private boolean isUsingUnarmed;
|
||||||
|
|
||||||
@ -305,31 +304,31 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Chimaera Wing
|
* Teleportation cooldown & warmup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int getLastChimaeraTeleport() {
|
public int getLastTeleport() {
|
||||||
return chimaeraWing;
|
return teleportLastUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastChimaeraTeleport(int value) {
|
public void setLastTeleport(int value) {
|
||||||
chimaeraWing = value;
|
teleportLastUse = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actualizeLastChimaeraTeleport() {
|
public void actualizeLastTeleport() {
|
||||||
chimaeraWing = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
teleportLastUse = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getChimaeraCommenceLocation() {
|
public Location getTeleportCommenceLocation() {
|
||||||
return chimaeraWingCommence;
|
return teleportCommence;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChimaeraCommenceLocation(Location location) {
|
public void setTeleportCommenceLocation(Location location) {
|
||||||
chimaeraWingCommence = location;
|
teleportCommence = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actualizeChimaeraCommenceLocation(Player player) {
|
public void actualizeTeleportCommenceLocation(Player player) {
|
||||||
setChimaeraCommenceLocation(player.getLocation());
|
setTeleportCommenceLocation(player.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -28,12 +28,12 @@ public class ChimaeraWingWarmup extends BukkitRunnable {
|
|||||||
|
|
||||||
private void checkChimaeraWingTeleport() {
|
private void checkChimaeraWingTeleport() {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
Location previousLocation = mcMMOPlayer.getChimaeraCommenceLocation();
|
Location previousLocation = mcMMOPlayer.getTeleportCommenceLocation();
|
||||||
Location newLocation = mcMMOPlayer.getPlayer().getLocation();
|
Location newLocation = mcMMOPlayer.getPlayer().getLocation();
|
||||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||||
ItemStack inHand = player.getItemInHand();
|
ItemStack inHand = player.getItemInHand();
|
||||||
|
|
||||||
mcMMOPlayer.setChimaeraCommenceLocation(null);
|
mcMMOPlayer.setTeleportCommenceLocation(null);
|
||||||
|
|
||||||
if (newLocation.distanceSquared(previousLocation) > 1.0 || !player.getInventory().containsAtLeast(ChimaeraWing.getChimaeraWing(0), 1)) {
|
if (newLocation.distanceSquared(previousLocation) > 1.0 || !player.getInventory().containsAtLeast(ChimaeraWing.getChimaeraWing(0), 1)) {
|
||||||
player.sendMessage(ChatColor.DARK_RED + "Teleportation canceled!"); //TODO Locale!
|
player.sendMessage(ChatColor.DARK_RED + "Teleportation canceled!"); //TODO Locale!
|
||||||
|
@ -46,10 +46,10 @@ public final class ChimaeraWing {
|
|||||||
location = player.getLocation();
|
location = player.getLocation();
|
||||||
int amount = inHand.getAmount();
|
int amount = inHand.getAmount();
|
||||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||||
long lastChimaeraWing = mcMMOPlayer.getLastChimaeraTeleport();
|
long lastChimaeraWing = mcMMOPlayer.getLastTeleport();
|
||||||
|
|
||||||
if (Permissions.chimaeraWing(player) && ItemUtils.isChimaeraWing(inHand)) {
|
if (Permissions.chimaeraWing(player) && ItemUtils.isChimaeraWing(inHand)) {
|
||||||
if (mcMMOPlayer.getChimaeraCommenceLocation() != null) {
|
if (mcMMOPlayer.getTeleportCommenceLocation() != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,12 +74,12 @@ public final class ChimaeraWing {
|
|||||||
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
|
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
|
||||||
player.setVelocity(new Vector(0, 0.5D, 0));
|
player.setVelocity(new Vector(0, 0.5D, 0));
|
||||||
CombatUtils.dealDamage(player, Misc.getRandom().nextInt(player.getHealth() - 10));
|
CombatUtils.dealDamage(player, Misc.getRandom().nextInt(player.getHealth() - 10));
|
||||||
mcMMOPlayer.actualizeLastChimaeraTeleport();
|
mcMMOPlayer.actualizeLastTeleport();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer.actualizeChimaeraCommenceLocation(player);
|
mcMMOPlayer.actualizeTeleportCommenceLocation(player);
|
||||||
|
|
||||||
long warmup = Config.getInstance().getChimaeraWarmup();
|
long warmup = Config.getInstance().getChimaeraWarmup();
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
player.setItemInHand(new ItemStack(getChimaeraWing(player.getItemInHand().getAmount() - Config.getInstance().getChimaeraUseCost())));
|
player.setItemInHand(new ItemStack(getChimaeraWing(player.getItemInHand().getAmount() - Config.getInstance().getChimaeraUseCost())));
|
||||||
UserManager.getPlayer(player).actualizeLastChimaeraTeleport();
|
UserManager.getPlayer(player).actualizeLastTeleport();
|
||||||
if (Config.getInstance().getStatsTrackingEnabled()) {
|
if (Config.getInstance().getStatsTrackingEnabled()) {
|
||||||
MetricsManager.chimeraWingUsed();
|
MetricsManager.chimeraWingUsed();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user