Add getMovePreviewWithoutCooldownTimer (#1074)

## Additions
* Adds `GeneralMethods::getMovePreviewWithoutCooldownTimer(Player)`
This commit is contained in:
Christopher Martin 2020-07-21 23:25:19 -07:00 committed by GitHub
parent 10ac727eda
commit f0dc7ce32b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -828,10 +828,20 @@ public abstract class CoreAbility implements Ability {
public String getMovePreview(final Player player) { public String getMovePreview(final Player player) {
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
String displayedMessage = ""; String displayedMessage = getMovePreviewWithoutCooldownTimer(player);
if (bPlayer.isOnCooldown(this)) { if (bPlayer.isOnCooldown(this)) {
final long cooldown = bPlayer.getCooldown(this.getName()) - System.currentTimeMillis(); final long cooldown = bPlayer.getCooldown(this.getName()) - System.currentTimeMillis();
displayedMessage = this.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + this.getName() + "" + this.getElement().getColor() + " - " + TimeUtil.formatTime(cooldown); displayedMessage += this.getElement().getColor() + " - " + TimeUtil.formatTime(cooldown);
}
return displayedMessage;
}
public String getMovePreviewWithoutCooldownTimer(final Player player) {
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
String displayedMessage = "";
if (bPlayer.isOnCooldown(this)) {
displayedMessage = this.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + this.getName();
} else { } else {
if (bPlayer.getStance() != null && bPlayer.getStance().getName().equals(this.getName())) { if (bPlayer.getStance() != null && bPlayer.getStance().getName().equals(this.getName())) {
displayedMessage = this.getElement().getColor() + "" + ChatColor.UNDERLINE + this.getName(); displayedMessage = this.getElement().getColor() + "" + ChatColor.UNDERLINE + this.getName();