Merge remote-tracking branch 'origin/1.6.x' into 1.6.x

This commit is contained in:
droppinganvil
2020-04-08 12:59:51 -05:00
9 changed files with 32 additions and 7 deletions

View File

@@ -140,7 +140,6 @@ public class Econ {
public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify) {
if (!shouldBeUsed()) {
invoker.msg(TL.ECON_OFF);
return false;
}

View File

@@ -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")),

View File

@@ -1,5 +1,12 @@
package com.massivecraft.factions.util.timer;
import com.massivecraft.factions.util.Config;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/**
* Factions - Developed by Driftay.
* All rights reserved 2020.
@@ -8,6 +15,7 @@ package com.massivecraft.factions.util.timer;
public abstract class GlobalTimer extends Timer {
private TimerRunnable runnable;
public GlobalTimer(String name, long defaultCooldown) {
super(name, defaultCooldown);
}

View File

@@ -1,8 +1,6 @@
package com.massivecraft.factions.util.timer;
import com.massivecraft.factions.FactionsPlugin;
import com.massivecraft.factions.util.Config;
import com.massivecraft.factions.util.timer.type.GraceTimer;
/**
* Factions - Developed by Driftay.

View File

@@ -1,7 +1,6 @@
package com.massivecraft.factions.util.timer;
import com.massivecraft.factions.FactionsPlugin;
import com.massivecraft.factions.util.Config;
import java.util.UUID;

View File

@@ -3,6 +3,7 @@ package com.massivecraft.factions.util.timer.type;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.util.Config;
import com.massivecraft.factions.util.timer.GlobalTimer;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
@@ -40,4 +41,17 @@ public class GraceTimer extends GlobalTimer implements Listener {
}
}
}
@Override
public void load(Config config) {
setPaused(config.getBoolean(this.name + ".paused"));
setRemaining(config.getLong(this.name + ".time"), false);
}
@Override
public void save(Config config) {
config.set(this.name + ".paused", isPaused());
config.set(this.name + ".time", getRemaining());
}
}

View File

@@ -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:

View File

@@ -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