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