Made Scoreboard Dummy Proof & Started Adding Shield Tasks Timers and Objects
This commit is contained in:
parent
5145ae1714
commit
0a1346f1c2
@ -4,6 +4,7 @@ import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
|
|||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.iface.RelationParticipator;
|
import com.massivecraft.factions.iface.RelationParticipator;
|
||||||
import com.massivecraft.factions.missions.Mission;
|
import com.massivecraft.factions.missions.Mission;
|
||||||
|
import com.massivecraft.factions.shield.TimeFrame;
|
||||||
import com.massivecraft.factions.struct.BanInfo;
|
import com.massivecraft.factions.struct.BanInfo;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
@ -441,4 +442,12 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
void paypalSet(String paypal);
|
void paypalSet(String paypal);
|
||||||
|
|
||||||
|
// -------------------------------
|
||||||
|
// Shields
|
||||||
|
// -------------------------------
|
||||||
|
|
||||||
|
void setTimeFrame(TimeFrame timeFrame);
|
||||||
|
|
||||||
|
TimeFrame getTimeFrame();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -123,21 +123,15 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void playSoundForAll(String sound) {
|
public void playSoundForAll(String sound) {
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
for (Player pl : Bukkit.getOnlinePlayers()) playSound(pl, sound);
|
||||||
playSound(pl, sound);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSoundForAll(List<String> sounds) {
|
public void playSoundForAll(List<String> sounds) {
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
for (Player pl : Bukkit.getOnlinePlayers()) playSound(pl, sounds);
|
||||||
playSound(pl, sounds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSound(Player p, List<String> sounds) {
|
public void playSound(Player p, List<String> sounds) {
|
||||||
for (String sound : sounds) {
|
for (String sound : sounds) playSound(p, sound);
|
||||||
playSound(p, sound);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSound(Player p, String sound) {
|
public void playSound(Player p, String sound) {
|
||||||
@ -175,9 +169,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
migrateFPlayerLeaders();
|
migrateFPlayerLeaders();
|
||||||
log("==== End Setup ====");
|
log("==== End Setup ====");
|
||||||
|
|
||||||
if (!preEnable()) {
|
if (!preEnable()) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.loadSuccessful = false;
|
this.loadSuccessful = false;
|
||||||
|
|
||||||
if (!new File(this.getDataFolder() + "/config.yml").exists()) {
|
if (!new File(this.getDataFolder() + "/config.yml").exists()) {
|
||||||
@ -200,7 +192,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Update their config if needed
|
//Update their config if needed
|
||||||
// Updater.updateIfNeeded(getConfig());
|
// Updater.updateIfNeeded(getConfig());
|
||||||
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
|
||||||
FactionsPlugin.econ = rsp.getProvider();
|
FactionsPlugin.econ = rsp.getProvider();
|
||||||
com.massivecraft.factions.integration.Essentials.setup();
|
com.massivecraft.factions.integration.Essentials.setup();
|
||||||
@ -215,16 +207,11 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
fPlayer.resetFactionData(false);
|
fPlayer.resetFactionData(false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fPlayer.isAlt()) {
|
if (fPlayer.isAlt()) faction.addAltPlayer(fPlayer);
|
||||||
faction.addAltPlayer(fPlayer);
|
else faction.addFPlayer(fPlayer);
|
||||||
} else {
|
|
||||||
faction.addFPlayer(fPlayer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (getConfig().getBoolean("enable-faction-flight", true)) UtilFly.run();
|
||||||
|
|
||||||
if (getConfig().getBoolean("enable-faction-flight", true)) {
|
|
||||||
UtilFly.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
Board.getInstance().load();
|
Board.getInstance().load();
|
||||||
Board.getInstance().clean();
|
Board.getInstance().clean();
|
||||||
@ -249,9 +236,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConfig().getBoolean("enable-faction-flight")) {
|
if (getConfig().getBoolean("enable-faction-flight")) factionsFlight = true;
|
||||||
factionsFlight = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
||||||
log("Skript was found! Registering FactionsPlugin Addon...");
|
log("Skript was found! Registering FactionsPlugin Addon...");
|
||||||
@ -375,7 +360,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
try {
|
try {
|
||||||
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
|
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
|
||||||
System.out.println("Migrating old players.json file.");
|
System.out.println("Migrating old players.json file.");
|
||||||
|
|
||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
if (line.contains("\"role\": \"ADMIN\"")) {
|
if (line.contains("\"role\": \"ADMIN\"")) {
|
||||||
@ -407,9 +391,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
private boolean setupPermissions() {
|
private boolean setupPermissions() {
|
||||||
try {
|
try {
|
||||||
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
|
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
|
||||||
if (rsp != null) {
|
if (rsp != null) perms = rsp.getProvider();
|
||||||
perms = rsp.getProvider();
|
|
||||||
}
|
|
||||||
} catch (NoClassDefFoundError ex) {
|
} catch (NoClassDefFoundError ex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -447,9 +429,8 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// only save data if plugin actually completely loaded successfully
|
// only save data if plugin actually completely loaded successfully
|
||||||
if (this.loadSuccessful) {
|
if (this.loadSuccessful) Conf.saveSync();
|
||||||
Conf.saveSync();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AutoLeaveTask != null) {
|
if (AutoLeaveTask != null) {
|
||||||
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
||||||
@ -466,9 +447,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
public void startAutoLeaveTask(boolean restartIfRunning) {
|
public void startAutoLeaveTask(boolean restartIfRunning) {
|
||||||
if (AutoLeaveTask != null) {
|
if (AutoLeaveTask != null) {
|
||||||
if (!restartIfRunning) {
|
if (!restartIfRunning) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,9 +499,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] split) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] split) {
|
||||||
if (split.length == 0) {
|
if (split.length == 0) return handleCommand(sender, "/f help", false);
|
||||||
return handleCommand(sender, "/f help", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise, needs to be handled; presumably another plugin directly ran the command
|
// otherwise, needs to be handled; presumably another plugin directly ran the command
|
||||||
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
||||||
@ -535,8 +512,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// Must be a LinkedList to prevent UnsupportedOperationException.
|
// Must be a LinkedList to prevent UnsupportedOperationException.
|
||||||
List<String> argsList = new LinkedList<>(Arrays.asList(args));
|
List<String> argsList = new LinkedList<>(Arrays.asList(args));
|
||||||
CommandContext context = new CommandContext(sender, argsList, alias);
|
CommandContext context = new CommandContext(sender, argsList, alias);
|
||||||
String cmd = Conf.baseCommandAliases.isEmpty() ? "/f" : "/" + Conf.baseCommandAliases.get(0);
|
|
||||||
// String cmdValid = (cmd + " " + TextUtil.implode(context.args, " ")).trim();
|
|
||||||
List<FCommand> commandsList = cmdBase.subCommands;
|
List<FCommand> commandsList = cmdBase.subCommands;
|
||||||
FCommand commandsEx = cmdBase;
|
FCommand commandsEx = cmdBase;
|
||||||
List<String> completions = new ArrayList<>();
|
List<String> completions = new ArrayList<>();
|
||||||
@ -565,16 +540,12 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String lastArg = args[args.length - 1].toLowerCase();
|
String lastArg = args[args.length - 1].toLowerCase();
|
||||||
|
|
||||||
completions = completions.stream()
|
completions = completions.stream()
|
||||||
.filter(m -> m.toLowerCase().startsWith(lastArg))
|
.filter(m -> m.toLowerCase().startsWith(lastArg))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return completions;
|
return completions;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String lastArg = args[args.length - 1].toLowerCase();
|
String lastArg = args[args.length - 1].toLowerCase();
|
||||||
|
|
||||||
for (Role value : Role.values()) completions.add(value.nicename);
|
for (Role value : Role.values()) completions.add(value.nicename);
|
||||||
for (Relation value : Relation.values()) completions.add(value.nicename);
|
for (Relation value : Relation.values()) completions.add(value.nicename);
|
||||||
// The stream and foreach from the old implementation looped 2 times, by looping all players -> filtered -> looped filter and added -> filtered AGAIN at the end.
|
// The stream and foreach from the old implementation looped 2 times, by looping all players -> filtered -> looped filter and added -> filtered AGAIN at the end.
|
||||||
@ -613,11 +584,8 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels,
|
// Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels,
|
||||||
// local chat, or anything else which targets individual recipients, so Faction Chat can be done
|
// local chat, or anything else which targets individual recipients, so Faction Chat can be done
|
||||||
public boolean isPlayerFactionChatting(Player player) {
|
public boolean isPlayerFactionChatting(Player player) {
|
||||||
if (player == null) {
|
if (player == null) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
||||||
|
|
||||||
return me != null && me.getChatMode().isAtLeast(ChatMode.ALLIANCE);
|
return me != null && me.getChatMode().isAtLeast(ChatMode.ALLIANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,15 +606,11 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
public String getPlayerFactionTagRelation(Player speaker, Player listener) {
|
public String getPlayerFactionTagRelation(Player speaker, Player listener) {
|
||||||
String tag = "~";
|
String tag = "~";
|
||||||
|
|
||||||
if (speaker == null) {
|
if (speaker == null) return tag;
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(speaker);
|
FPlayer me = FPlayers.getInstance().getByPlayer(speaker);
|
||||||
if (me == null) {
|
if (me == null) return tag;
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if listener isn't set, or config option is disabled, give back uncolored tag
|
// if listener isn't set, or config option is disabled, give back uncolored tag
|
||||||
if (listener == null || !Conf.chatTagRelationColored) {
|
if (listener == null || !Conf.chatTagRelationColored) {
|
||||||
tag = me.getChatTag().trim();
|
tag = me.getChatTag().trim();
|
||||||
@ -654,15 +618,11 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
FPlayer you = FPlayers.getInstance().getByPlayer(listener);
|
FPlayer you = FPlayers.getInstance().getByPlayer(listener);
|
||||||
if (you == null) {
|
if (you == null) {
|
||||||
tag = me.getChatTag().trim();
|
tag = me.getChatTag().trim();
|
||||||
} else // everything checks out, give the colored tag
|
} else { // everything checks out, give the colored tag
|
||||||
{
|
|
||||||
tag = me.getChatTag(you).trim();
|
tag = me.getChatTag(you).trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tag.isEmpty()) {
|
if (tag.isEmpty()) tag = "~";
|
||||||
tag = "~";
|
|
||||||
}
|
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,15 +637,9 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
// Get a player's title within their faction, mainly for usage by chat plugins for local/channel chat
|
// Get a player's title within their faction, mainly for usage by chat plugins for local/channel chat
|
||||||
public String getPlayerTitle(Player player) {
|
public String getPlayerTitle(Player player) {
|
||||||
if (player == null) {
|
if (player == null) return "";
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
||||||
if (me == null) {
|
if (me == null) return "";
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return me.getTitle().trim();
|
return me.getTitle().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,9 +650,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
//colors a string list
|
//colors a string list
|
||||||
public List<String> colorList(List<String> lore) {
|
public List<String> colorList(List<String> lore) {
|
||||||
for (int i = 0; i <= lore.size() - 1; i++) {
|
for (int i = 0; i <= lore.size() - 1; i++) lore.set(i, color(lore.get(i)));
|
||||||
lore.set(i, color(lore.get(i)));
|
|
||||||
}
|
|
||||||
return lore;
|
return lore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,9 +668,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
Set<String> players = new HashSet<>();
|
Set<String> players = new HashSet<>();
|
||||||
Faction faction = Factions.getInstance().getByTag(factionTag);
|
Faction faction = Factions.getInstance().getByTag(factionTag);
|
||||||
if (faction != null) {
|
if (faction != null) {
|
||||||
for (FPlayer fplayer : faction.getFPlayers()) {
|
for (FPlayer fplayer : faction.getFPlayers()) players.add(fplayer.getName());
|
||||||
players.add(fplayer.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
@ -728,9 +678,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
Set<String> players = new HashSet<>();
|
Set<String> players = new HashSet<>();
|
||||||
Faction faction = Factions.getInstance().getByTag(factionTag);
|
Faction faction = Factions.getInstance().getByTag(factionTag);
|
||||||
if (faction != null) {
|
if (faction != null) {
|
||||||
for (FPlayer fplayer : faction.getFPlayersWhereOnline(true)) {
|
for (FPlayer fplayer : faction.getFPlayersWhereOnline(true)) players.add(fplayer.getName());
|
||||||
players.add(fplayer.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
@ -750,9 +698,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void debug(Level level, String s) {
|
public void debug(Level level, String s) {
|
||||||
if (getConfig().getBoolean("debug", false)) {
|
if (getConfig().getBoolean("debug", false)) getLogger().log(level, s);
|
||||||
getLogger().log(level, s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FactionsPlayerListener getFactionsPlayerListener() {
|
public FactionsPlayerListener getFactionsPlayerListener() {
|
||||||
|
@ -0,0 +1,96 @@
|
|||||||
|
package com.massivecraft.factions.shield;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Saser
|
||||||
|
*/
|
||||||
|
public class TimeFrame {
|
||||||
|
|
||||||
|
//each of these objs will be in 1 fac
|
||||||
|
|
||||||
|
private Faction faction;
|
||||||
|
private Enum startingTime;
|
||||||
|
private Enum endingTime;
|
||||||
|
|
||||||
|
private int currentMinutes; // this will be the variable for either the currentTime starting, or ending, or current in effect.
|
||||||
|
|
||||||
|
private boolean inEffect; // if the shield is in effect
|
||||||
|
private boolean starting; // pending starting countdown
|
||||||
|
private boolean ending; // pending ending countdown
|
||||||
|
|
||||||
|
private enum times {
|
||||||
|
twelveAM, oneAM, twoAM, threeAM, fourAM, fiveAM, sixAM, sevenAM, eightAM, nineAM, tenAM, elevenAM, twelvePM,
|
||||||
|
onePM, twoPM, threePM, fourPM, fivePM, sixPM, sevenPM, eightPM, ninePM, tenPM, elevenPM;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TimeFrame(Faction faction, Enum startingTime, Enum endingTime, boolean starting, boolean ending, boolean inEffect, int currentMinutes){
|
||||||
|
this.faction = faction;
|
||||||
|
this.startingTime = startingTime;
|
||||||
|
this.endingTime = endingTime;
|
||||||
|
this.starting = starting;
|
||||||
|
this.ending = ending;
|
||||||
|
this.inEffect = inEffect;
|
||||||
|
this.currentMinutes = currentMinutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isEnding() {
|
||||||
|
return ending;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInEffect() {
|
||||||
|
return inEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum getEndingTime() {
|
||||||
|
return endingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum getStartingTime() {
|
||||||
|
return startingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStarting() {
|
||||||
|
return starting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Faction getFaction() {
|
||||||
|
return faction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentMinutes(int currentMinutes) {
|
||||||
|
this.currentMinutes = currentMinutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentMinutes() {
|
||||||
|
return currentMinutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnding(boolean ending) {
|
||||||
|
this.ending = ending;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndingTime(Enum endingTime) {
|
||||||
|
this.endingTime = endingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartingTime(Enum startingTime) {
|
||||||
|
this.startingTime = startingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFaction(Faction faction) {
|
||||||
|
this.faction = faction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInEffect(boolean inEffect) {
|
||||||
|
this.inEffect = inEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStarting(boolean starting) {
|
||||||
|
this.starting = starting;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.massivecraft.factions.shield;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Saser
|
||||||
|
*/
|
||||||
|
public class TimeFrameTask implements Runnable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//remove time from the timeFrame
|
||||||
|
|
||||||
|
|
||||||
|
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||||
|
if (faction.getTimeFrame() != null) {
|
||||||
|
TimeFrame timeFrame = faction.getTimeFrame();
|
||||||
|
if (timeFrame.isStarting() || timeFrame.isEnding() || timeFrame.isInEffect()) {
|
||||||
|
//either starting, ending, or in effect, so we have to remove 1 minute interval from the currentTime
|
||||||
|
int newTime = Math.subtractExact(timeFrame.getCurrentMinutes(), 1);
|
||||||
|
if (newTime == 0) {
|
||||||
|
//time is done, do functions...
|
||||||
|
if (timeFrame.isStarting() || timeFrame.isInEffect()) {
|
||||||
|
if (timeFrame.isStarting()) {
|
||||||
|
//it was starting, now set to inEffect
|
||||||
|
timeFrame.setStarting(false);
|
||||||
|
timeFrame.setInEffect(true);
|
||||||
|
}
|
||||||
|
//we don't need to check for inEffect because if it is, it'll just set the time back anyways...
|
||||||
|
timeFrame.setCurrentMinutes(720);
|
||||||
|
continue; // continue to the next faction
|
||||||
|
} else if (timeFrame.isEnding()) {
|
||||||
|
//it was ending, now set inEffect to false, basically remove from the faction obj
|
||||||
|
timeFrame.setEnding(false);
|
||||||
|
timeFrame.setInEffect(false);
|
||||||
|
//remove from faction object
|
||||||
|
faction.setTimeFrame(null);
|
||||||
|
continue; // continue to the next faction
|
||||||
|
}
|
||||||
|
}
|
||||||
|
timeFrame.setCurrentMinutes(newTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ import com.massivecraft.factions.iface.RelationParticipator;
|
|||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
import com.massivecraft.factions.missions.Mission;
|
import com.massivecraft.factions.missions.Mission;
|
||||||
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
||||||
|
import com.massivecraft.factions.shield.TimeFrame;
|
||||||
import com.massivecraft.factions.struct.BanInfo;
|
import com.massivecraft.factions.struct.BanInfo;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
@ -95,6 +96,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
private String weeWooFormat;
|
private String weeWooFormat;
|
||||||
private String guildId;
|
private String guildId;
|
||||||
private String memberRoleId;
|
private String memberRoleId;
|
||||||
|
private TimeFrame timeFrame;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -130,6 +132,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
this.notifyFormat = "@everyone, check %type%";
|
this.notifyFormat = "@everyone, check %type%";
|
||||||
this.weeWooFormat = "@everyone, we're being raided! Get online!";
|
this.weeWooFormat = "@everyone, we're being raided! Get online!";
|
||||||
this.memberRoleId = null;
|
this.memberRoleId = null;
|
||||||
|
this.timeFrame = null;
|
||||||
resetPerms(); // Reset on new Faction so it has default values.
|
resetPerms(); // Reset on new Faction so it has default values.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +165,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
this.checks = new ConcurrentHashMap<>();
|
this.checks = new ConcurrentHashMap<>();
|
||||||
this.playerWallCheckCount = new ConcurrentHashMap<>();
|
this.playerWallCheckCount = new ConcurrentHashMap<>();
|
||||||
this.playerBufferCheckCount = new ConcurrentHashMap<>();
|
this.playerBufferCheckCount = new ConcurrentHashMap<>();
|
||||||
|
this.timeFrame = null;
|
||||||
resetPerms(); // Reset on new Faction so it has default values.
|
resetPerms(); // Reset on new Faction so it has default values.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1429,4 +1433,8 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
public Set<FLocation> getAllClaims() {
|
public Set<FLocation> getAllClaims() {
|
||||||
return Board.getInstance().getAllClaims(this);
|
return Board.getInstance().getAllClaims(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TimeFrame getTimeFrame(){ return this.timeFrame; }
|
||||||
|
|
||||||
|
public void setTimeFrame(TimeFrame timeFrame){ this.timeFrame = timeFrame; }
|
||||||
}
|
}
|
||||||
|
@ -147,16 +147,16 @@ scoreboard:
|
|||||||
# {maxPower} - player's max power.
|
# {maxPower} - player's max power.
|
||||||
# {powerBoost} - player's powerboost.
|
# {powerBoost} - player's powerboost.
|
||||||
|
|
||||||
default-enabled: false # Default to false to keep original functionality.
|
######################################################
|
||||||
|
##################### SCOREBOARD #####################
|
||||||
|
######################################################
|
||||||
|
default-enabled: false # This is to enable or disable the scoreboard: false = Disabled
|
||||||
default-title: "&cSaberFactions" # Can use any of the values from above but this won't update once it's set (so don't set {balance}).
|
default-title: "&cSaberFactions" # Can use any of the values from above but this won't update once it's set (so don't set {balance}).
|
||||||
default-update-interval: 2 # in seconds.
|
default-update-interval: 2 # in seconds.
|
||||||
|
|
||||||
# This will show faction prefixes colored based on relation on nametags and in the tab.
|
# This will show faction prefixes colored based on relation on nametags and in the tab.
|
||||||
# The scoreboard needs to be enabled for this to work.
|
# The scoreboard needs to be enabled for this to work.
|
||||||
default-prefixes: true
|
default-prefixes: true
|
||||||
|
|
||||||
# SUPPORTS PLACEHOLDERS
|
# SUPPORTS PLACEHOLDERS
|
||||||
|
|
||||||
default:
|
default:
|
||||||
- "&7&m--------------------------"
|
- "&7&m--------------------------"
|
||||||
- "&4&lFaction Info &8»"
|
- "&4&lFaction Info &8»"
|
||||||
@ -185,6 +185,7 @@ scoreboard:
|
|||||||
- "&7&m---------------------------"
|
- "&7&m---------------------------"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Configration section for warmups.
|
# Configration section for warmups.
|
||||||
# Warmup times are in seconds - if a value of 0 is set, there is no warmup.
|
# Warmup times are in seconds - if a value of 0 is set, there is no warmup.
|
||||||
warmups:
|
warmups:
|
||||||
|
Loading…
Reference in New Issue
Block a user