Finished Grace Timer :)
This commit is contained in:
parent
d86d8fc73a
commit
4496d4251b
@ -2,6 +2,7 @@ package com.massivecraft.factions.tag;
|
||||
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.util.timer.TimerManager;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@ -12,7 +13,7 @@ public enum GeneralTag implements Tag {
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
|
||||
GRACE_TIMER("{grace-time}", () -> String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true))),
|
||||
MAX_WARPS("{max-warps}", () -> String.valueOf(FactionsPlugin.getInstance().getConfig().getInt("max-warps", 5))),
|
||||
MAX_ALLIES("{max-allies}", () -> getRelation("ally")),
|
||||
MAX_ENEMIES("{max-enemies}", () -> getRelation("enemy")),
|
||||
|
@ -44,14 +44,14 @@ public class GraceTimer extends GlobalTimer implements Listener {
|
||||
|
||||
@Override
|
||||
public void load(Config config) {
|
||||
config.get(this.name, isPaused());
|
||||
config.get(this.name, getRemaining());
|
||||
setPaused(config.getBoolean(this.name + ".paused"));
|
||||
setRemaining(config.getLong(this.name + ".time"), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Config config) {
|
||||
config.set(this.name, isPaused());
|
||||
config.set(this.name, getRemaining());
|
||||
config.set(this.name + ".paused", isPaused());
|
||||
config.set(this.name + ".time", getRemaining());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.zcore.util;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.util.timer.TimerManager;
|
||||
import org.apache.commons.lang.time.DurationFormatUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -82,6 +83,7 @@ public enum TagReplacer {
|
||||
/**
|
||||
* General variables, require no faction or player
|
||||
*/
|
||||
GRACE_TIMER(TagType.GENERAL, "{grace-time}"),
|
||||
MAX_WARPS(TagType.GENERAL, "{max-warps}"),
|
||||
MAX_ALLIES(TagType.GENERAL, "{max-allies}"),
|
||||
MAX_ALTS(TagType.GENERAL, "{max-alts}"),
|
||||
@ -125,6 +127,8 @@ public enum TagReplacer {
|
||||
*/
|
||||
protected String getValue() {
|
||||
switch (this) {
|
||||
case GRACE_TIMER:
|
||||
return String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true));
|
||||
case TOTAL_ONLINE:
|
||||
return String.valueOf(Bukkit.getOnlinePlayers().size());
|
||||
case FACTIONLESS:
|
||||
|
@ -1560,6 +1560,7 @@ Wild:
|
||||
# - {action-access-color} : Access color
|
||||
|
||||
# General variables. Can be used anywhere.
|
||||
# - {grace-time} : Time of Grace Period
|
||||
# - {total-online} : Total # of players on the server
|
||||
# - {max-warps} : Max # of warps a faction can set
|
||||
# - {max-allies} : Max # of allies a faction can have
|
||||
|
Loading…
Reference in New Issue
Block a user