diff --git a/pom.xml b/pom.xml index fb74d047..df6560dd 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.massivecraft Factions - 1.6.9.5-U0.2.1-2.0.8-BETA + 1.6.9.5-U0.2.1-2.0.9-BETA jar SaberFactions @@ -387,11 +387,6 @@ 1.0.0 compile - - org.codemc.worldguardwrapper - worldguardwrapper - 1.1.6-SNAPSHOT - com.jagrosh jda-utilities-commons diff --git a/src/main/java/com/massivecraft/factions/Faction.java b/src/main/java/com/massivecraft/factions/Faction.java index f6197c67..4ed644b5 100644 --- a/src/main/java/com/massivecraft/factions/Faction.java +++ b/src/main/java/com/massivecraft/factions/Faction.java @@ -4,7 +4,6 @@ import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.iface.RelationParticipator; import com.massivecraft.factions.missions.Mission; -import com.massivecraft.factions.shield.TimeFrame; import com.massivecraft.factions.struct.BanInfo; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; @@ -442,8 +441,4 @@ public interface Faction extends EconomyParticipator { void paypalSet(String paypal); - // shield - - void setTimeFrame(TimeFrame timeFrame); - TimeFrame getTimeFrame(); } diff --git a/src/main/java/com/massivecraft/factions/FactionsPlugin.java b/src/main/java/com/massivecraft/factions/FactionsPlugin.java index dabee2f5..55788a0f 100755 --- a/src/main/java/com/massivecraft/factions/FactionsPlugin.java +++ b/src/main/java/com/massivecraft/factions/FactionsPlugin.java @@ -18,7 +18,6 @@ import com.massivecraft.factions.integration.Worldguard; import com.massivecraft.factions.integration.dynmap.EngineDynmap; import com.massivecraft.factions.listeners.*; import com.massivecraft.factions.missions.MissionHandler; -import com.massivecraft.factions.shield.TimeFrameTask; import com.massivecraft.factions.shop.ShopConfig; import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.Relation; @@ -267,7 +266,6 @@ public class FactionsPlugin extends MPlugin { this.getServer().getScheduler().runTaskTimerAsynchronously(this, new CheckTask(this, 30), 0L, (long) (minute * 30)); this.getServer().getScheduler().runTaskTimer(this, CheckTask::cleanupTask, 0L, 1200L); this.getServer().getScheduler().runTaskTimerAsynchronously(this, new WeeWooTask(this), 600L, 600L); - this.getServer().getScheduler().runTaskTimerAsynchronously(this, new TimeFrameTask(), 1200, 1200); // every 1 minute... } if(Conf.useDiscordSystem && !Conf.discordBotToken.equals("")) { new FactionChatHandler(this); @@ -739,4 +737,8 @@ public class FactionsPlugin extends MPlugin { public void debug(String s) { debug(Level.INFO, s); } + + public Worldguard getWg() { + return wg; + } } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index 2c8b885b..17ef6cc5 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -80,7 +80,6 @@ public class FactionsBlockListener implements Listener { boolean pain = !justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW; return CheckActionState(myFaction, loc, me, PermissableAction.fromString(action), pain); } - // Something failed prevent build return false; } @@ -137,7 +136,6 @@ public class FactionsBlockListener implements Listener { event.setCancelled(true); return; } - if (isSpawner) { if (Conf.spawnerLock) { event.setCancelled(true); diff --git a/src/main/java/com/massivecraft/factions/shield/TimeFrame.java b/src/main/java/com/massivecraft/factions/shield/TimeFrame.java deleted file mode 100644 index 35d75e32..00000000 --- a/src/main/java/com/massivecraft/factions/shield/TimeFrame.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.massivecraft.factions.shield; - - -import com.massivecraft.factions.Faction; - -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 forcefield 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; - } -} diff --git a/src/main/java/com/massivecraft/factions/shield/TimeFrameTask.java b/src/main/java/com/massivecraft/factions/shield/TimeFrameTask.java deleted file mode 100644 index 8a8d2fd9..00000000 --- a/src/main/java/com/massivecraft/factions/shield/TimeFrameTask.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.massivecraft.factions.shield; - -import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; - -public class TimeFrameTask implements Runnable { - - @Override - public void run() { - //remove tiem 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); - } - } - } - } -} - diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java index 2f9f2bbb..dc0f422d 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -9,7 +9,6 @@ import com.massivecraft.factions.iface.RelationParticipator; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.missions.Mission; import com.massivecraft.factions.scoreboards.FTeamWrapper; -import com.massivecraft.factions.shield.TimeFrame; import com.massivecraft.factions.struct.BanInfo; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; @@ -94,7 +93,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { private String weeWooFormat; private String guildId; private String memberRoleId; - private TimeFrame timeFrame; // -------------------------------------------- // @@ -130,7 +128,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { this.notifyFormat = "@everyone, check %type%"; this.weeWooFormat = "@everyone, we're being raided! Get online!"; this.memberRoleId = null; - this.timeFrame = null; resetPerms(); // Reset on new Faction so it has default values. } @@ -163,7 +160,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { this.checks = new ConcurrentHashMap<>(); this.playerWallCheckCount = new ConcurrentHashMap<>(); this.playerBufferCheckCount = new ConcurrentHashMap<>(); - this.timeFrame = null; resetPerms(); // Reset on new Faction so it has default values. } @@ -586,14 +582,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { return this.wallNotifyChannelId; } - public TimeFrame getTimeFrame(){ - return this.timeFrame; - } - - public void setTimeFrame(TimeFrame timeFrame){ - this.timeFrame = timeFrame; - } - @Override public void setWallNotifyChannelId(final String wallNotifyChannelId) { this.wallNotifyChannelId = wallNotifyChannelId; @@ -877,16 +865,13 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { * @return */ public Access getAccess(FPlayer player, PermissableAction permissableAction) { - if (player == null || permissableAction == null) { - return Access.UNDEFINED; - } + if (player == null || permissableAction == null) return Access.UNDEFINED; - Permissable perm = player.getFaction() == null ? player.getRole() : player.getFaction().getRelationTo(this); + + Permissable perm = player.getFaction() == this ? player.getRole() : player.getFaction().getRelationTo(this); Map accessMap = permissions.get(perm); - if (accessMap != null && accessMap.containsKey(permissableAction)) { - return accessMap.get(permissableAction); - } + if (accessMap != null && accessMap.containsKey(permissableAction)) return accessMap.get(permissableAction); return Access.UNDEFINED; } @@ -901,7 +886,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { public void resetPerms() { FactionsPlugin.getInstance().log(Level.WARNING, "Resetting permissions for Faction: " + tag); - permissions.clear(); // First populate a map with undefined as the permission for each action. diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 25722b76..36752be8 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -1004,6 +1004,7 @@ public enum TL { GENERIC_YOU("you"), GENERIC_YOURFACTION("your faction"), GENERIC_NOPERMISSION("You don't have permission to %1$s."), + GENERIC_ACTION_NOPERMISSION("You don't have permission to use %1$s"), GENERIC_FPERM_NOPERMISSION("&7The faction leader does not allow you to &c%1$s."), GENERIC_DOTHAT("do that"), //Ugh nuke this from high orbit GENERIC_NOPLAYERMATCH("No player match found for \"%1$s\"."), diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e7606a6e..d5a0ede7 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -535,7 +535,7 @@ fperm-gui: - '' - '&4&l* &cStatus: &f{action-access-color}{action-access}' - '' - - '&2&l* &aLeft click to &alAllow&a.' + - '&2&l* &aLeft click to &a&lAllow&a.' - '&4&l* &cRight click to &c&lDeny&c.' - '&8&l* &7Middle click to &7&lUndefine&7.' # Back item will be take you to the previous GUI