mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
Fixed combat placeholders
This commit is contained in:
parent
e1011d449f
commit
a3166b1049
@ -99,14 +99,13 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
return String.valueOf(playerData.getCombat().isInPvpMode());
|
||||
|
||||
else if (identifier.startsWith("since_enter_combat"))
|
||||
return playerData.isInCombat() ? MythicLib.plugin.getMMOConfig().decimal.format((System.currentTimeMillis() - playerData.getCombat().getFirstHit()) / 1000) : "-1";
|
||||
return playerData.isInCombat() ? MythicLib.plugin.getMMOConfig().decimal.format((System.currentTimeMillis() - playerData.getCombat().getLastEntry()) / 1000.) : "-1";
|
||||
|
||||
else if (identifier.startsWith("invulnerability_left"))
|
||||
return MythicLib.plugin.getMMOConfig().decimal.format(Math.max(0, (double) (playerData.getCombat().getInvulnerableTill() - System.currentTimeMillis()) / 1000));
|
||||
|
||||
return MythicLib.plugin.getMMOConfig().decimal.format(Math.max(0, (playerData.getCombat().getInvulnerableTill() - System.currentTimeMillis()) / 1000.));
|
||||
|
||||
else if (identifier.startsWith("since_last_hit"))
|
||||
return playerData.isInCombat() ? MythicLib.plugin.getMMOConfig().decimal.format((System.currentTimeMillis() - playerData.getCombat().getLastHit()) / 1000) : "-1";
|
||||
return playerData.isInCombat() ? MythicLib.plugin.getMMOConfig().decimal.format((System.currentTimeMillis() - playerData.getCombat().getLastHit()) / 1000.) : "-1";
|
||||
|
||||
else if (identifier.startsWith("bound_")) {
|
||||
int slot = Math.max(0, Integer.parseInt(identifier.substring(6)) - 1);
|
||||
|
@ -12,9 +12,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CombatHandler implements Closable {
|
||||
private final PlayerData player;
|
||||
private final long firstHit = System.currentTimeMillis();
|
||||
|
||||
private long lastHit = System.currentTimeMillis(), invulnerableTill;
|
||||
private long lastEntry = System.currentTimeMillis(), lastHit = System.currentTimeMillis(), invulnerableTill;
|
||||
|
||||
private boolean pvpMode;
|
||||
|
||||
@ -37,6 +35,7 @@ public class CombatHandler implements Closable {
|
||||
|
||||
// Entering combat
|
||||
} else {
|
||||
lastEntry = System.currentTimeMillis();
|
||||
MMOCore.plugin.configManager.getSimpleMessage("now-in-combat").send(player.getPlayer());
|
||||
Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, true));
|
||||
task = newTask();
|
||||
@ -59,8 +58,8 @@ public class CombatHandler implements Closable {
|
||||
return lastHit;
|
||||
}
|
||||
|
||||
public long getFirstHit() {
|
||||
return firstHit;
|
||||
public long getLastEntry() {
|
||||
return lastEntry;
|
||||
}
|
||||
|
||||
public long getInvulnerableTill() {
|
||||
|
Loading…
Reference in New Issue
Block a user