From 5047439756318b6242f735f84e772596d52bc0d6 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 25 Apr 2013 13:25:15 +0200 Subject: [PATCH] More universe disabled checks. --- .../factions/chat/ChatFormatter.java | 12 +-- .../factions/chat/ChatModifier.java | 5 +- .../massivecraft/factions/chat/ChatTag.java | 4 +- .../chat/modifier/ChatModifierLc.java | 5 +- .../chat/modifier/ChatModifierLp.java | 5 +- .../chat/modifier/ChatModifierParse.java | 5 +- .../chat/modifier/ChatModifierRp.java | 5 +- .../chat/modifier/ChatModifierUc.java | 5 +- .../chat/modifier/ChatModifierUcf.java | 5 +- .../factions/chat/tag/ChatTagName.java | 13 +++- .../factions/chat/tag/ChatTagNameforce.java | 13 +++- .../factions/chat/tag/ChatTagRelcolor.java | 15 +++- .../factions/chat/tag/ChatTagRole.java | 12 ++- .../factions/chat/tag/ChatTagRoleprefix.java | 12 ++- .../factions/chat/tag/ChatTagTitle.java | 14 +++- .../factions/cmd/CmdFactionsAccess.java | 4 +- .../factions/cmd/CmdFactionsAdmin.java | 17 +++-- .../factions/cmd/CmdFactionsAutoClaim.java | 8 ++ .../factions/cmd/CmdFactionsClaim.java | 4 +- .../factions/cmd/CmdFactionsCreate.java | 4 +- .../factions/cmd/CmdFactionsDemote.java | 4 +- .../factions/cmd/CmdFactionsDescription.java | 4 +- .../factions/cmd/CmdFactionsDisband.java | 6 +- .../factions/cmd/CmdFactionsFlag.java | 4 +- .../factions/cmd/CmdFactionsHome.java | 2 + .../factions/cmd/CmdFactionsInvite.java | 2 + .../factions/cmd/CmdFactionsJoin.java | 2 + .../factions/cmd/CmdFactionsKick.java | 2 + .../factions/cmd/CmdFactionsLeader.java | 2 + .../factions/cmd/CmdFactionsLeave.java | 2 + .../factions/cmd/CmdFactionsList.java | 3 +- .../factions/cmd/CmdFactionsMap.java | 2 + .../factions/cmd/CmdFactionsMoneyDeposit.java | 3 +- .../cmd/CmdFactionsMoneyTransferFf.java | 2 + .../cmd/CmdFactionsMoneyTransferFp.java | 2 + .../cmd/CmdFactionsMoneyTransferPf.java | 2 + .../cmd/CmdFactionsMoneyWithdraw.java | 2 + .../factions/cmd/CmdFactionsName.java | 3 +- .../factions/cmd/CmdFactionsOfficer.java | 3 +- .../factions/cmd/CmdFactionsOpen.java | 2 + .../factions/cmd/CmdFactionsPerm.java | 2 + .../factions/cmd/CmdFactionsPowerBoost.java | 2 + .../factions/cmd/CmdFactionsPromote.java | 3 +- .../cmd/CmdFactionsRelationAbstract.java | 2 + .../factions/cmd/CmdFactionsSeeChunk.java | 1 + .../factions/cmd/CmdFactionsShow.java | 2 + .../factions/cmd/CmdFactionsTitle.java | 2 + .../factions/cmd/CmdFactionsUnclaim.java | 2 + .../factions/cmd/CmdFactionsUnclaimall.java | 2 + .../massivecraft/factions/cmd/FCommand.java | 8 ++ .../factions/cmd/req/ReqFactionsEnabled.java | 36 +++++++++ .../massivecraft/factions/entity/UConf.java | 32 ++++++++ .../integration/herochat/HerochatEngine.java | 3 +- .../listeners/FactionsListenerChat.java | 3 +- .../listeners/FactionsListenerMain.java | 74 +++++++++++++++---- .../factions/task/TaskEconLandReward.java | 4 + .../factions/task/TaskPlayerDataRemove.java | 4 + .../factions/task/TaskPlayerPowerUpdate.java | 4 + 58 files changed, 325 insertions(+), 82 deletions(-) create mode 100644 src/com/massivecraft/factions/cmd/req/ReqFactionsEnabled.java diff --git a/src/com/massivecraft/factions/chat/ChatFormatter.java b/src/com/massivecraft/factions/chat/ChatFormatter.java index 2fd77baa..6e6789bb 100644 --- a/src/com/massivecraft/factions/chat/ChatFormatter.java +++ b/src/com/massivecraft/factions/chat/ChatFormatter.java @@ -8,7 +8,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import com.massivecraft.factions.entity.UPlayer; +import org.bukkit.command.CommandSender; /** * The ChatFormater is a system offered by factions for tag parsing. @@ -102,7 +102,7 @@ public class ChatFormatter // FORMAT // -------------------------------------------- // - public static String format(String msg, UPlayer fsender, UPlayer frecipient) + public static String format(String msg, CommandSender sender, CommandSender recipient) { // We build the return value in this string buffer StringBuffer ret = new StringBuffer(); @@ -137,7 +137,7 @@ public class ChatFormatter } else { - replacement = compute(tag, modifierIds, fsender, frecipient); + replacement = compute(tag, modifierIds, sender, recipient); if (replacement == null) { // If a tag or modifier returns null it's the same as opting out. @@ -159,9 +159,9 @@ public class ChatFormatter // TAG COMPUTE // -------------------------------------------- // - public static String compute(ChatTag tag, List modifierIds, UPlayer fsender, UPlayer frecipient) + public static String compute(ChatTag tag, List modifierIds, CommandSender sender, CommandSender recipient) { - String ret = tag.getReplacement(fsender, frecipient); + String ret = tag.getReplacement(sender, recipient); if (ret == null) return null; for (String modifierId : modifierIds) @@ -172,7 +172,7 @@ public class ChatFormatter // Modify and ignore change if null. // Modifier can't get or return null. - String modified = modifier.getModified(ret, fsender, frecipient); + String modified = modifier.getModified(ret, sender, recipient); if (modified == null) continue; ret = modified; diff --git a/src/com/massivecraft/factions/chat/ChatModifier.java b/src/com/massivecraft/factions/chat/ChatModifier.java index 73ed76e2..8340a5d6 100644 --- a/src/com/massivecraft/factions/chat/ChatModifier.java +++ b/src/com/massivecraft/factions/chat/ChatModifier.java @@ -1,12 +1,11 @@ package com.massivecraft.factions.chat; -import com.massivecraft.factions.entity.UPlayer; - +import org.bukkit.command.CommandSender; public interface ChatModifier { public String getId(); - public String getModified(String subject, UPlayer fsender, UPlayer frecipient); + public String getModified(String subject, CommandSender sender, CommandSender recipient); public boolean register(); public boolean unregister(); } diff --git a/src/com/massivecraft/factions/chat/ChatTag.java b/src/com/massivecraft/factions/chat/ChatTag.java index 233a5179..fa5732a0 100644 --- a/src/com/massivecraft/factions/chat/ChatTag.java +++ b/src/com/massivecraft/factions/chat/ChatTag.java @@ -1,11 +1,11 @@ package com.massivecraft.factions.chat; -import com.massivecraft.factions.entity.UPlayer; +import org.bukkit.command.CommandSender; public interface ChatTag { public String getId(); - public String getReplacement(UPlayer fsender, UPlayer frecipient); + public String getReplacement(CommandSender sender, CommandSender recipient); public boolean register(); public boolean unregister(); } diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierLc.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierLc.java index 5c6a9377..f84df1df 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierLc.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierLc.java @@ -1,7 +1,8 @@ package com.massivecraft.factions.chat.modifier; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatModifierAbstract; -import com.massivecraft.factions.entity.UPlayer; public class ChatModifierLc extends ChatModifierAbstract { @@ -18,7 +19,7 @@ public class ChatModifierLc extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, UPlayer fsender, UPlayer frecipient) + public String getModified(String subject, CommandSender sender, CommandSender recipient) { return subject.toLowerCase(); } diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierLp.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierLp.java index 06418c2f..d6bbd4dd 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierLp.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierLp.java @@ -1,7 +1,8 @@ package com.massivecraft.factions.chat.modifier; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatModifierAbstract; -import com.massivecraft.factions.entity.UPlayer; public class ChatModifierLp extends ChatModifierAbstract @@ -19,7 +20,7 @@ public class ChatModifierLp extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, UPlayer fsender, UPlayer frecipient) + public String getModified(String subject, CommandSender sender, CommandSender recipient) { if (subject.equals("")) return subject; return " "+subject; diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierParse.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierParse.java index e74d08d5..5055b414 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierParse.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierParse.java @@ -1,7 +1,8 @@ package com.massivecraft.factions.chat.modifier; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatModifierAbstract; -import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.mcore.util.Txt; public class ChatModifierParse extends ChatModifierAbstract @@ -19,7 +20,7 @@ public class ChatModifierParse extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, UPlayer fsender, UPlayer frecipient) + public String getModified(String subject, CommandSender sender, CommandSender recipient) { return Txt.parse(subject); } diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierRp.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierRp.java index a53e1cc7..e9afddf1 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierRp.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierRp.java @@ -1,7 +1,8 @@ package com.massivecraft.factions.chat.modifier; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatModifierAbstract; -import com.massivecraft.factions.entity.UPlayer; public class ChatModifierRp extends ChatModifierAbstract { @@ -18,7 +19,7 @@ public class ChatModifierRp extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, UPlayer fsender, UPlayer frecipient) + public String getModified(String subject, CommandSender sender, CommandSender recipient) { if (subject.equals("")) return subject; return subject+" "; diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierUc.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierUc.java index 8b03fae1..43f0de03 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierUc.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierUc.java @@ -1,7 +1,8 @@ package com.massivecraft.factions.chat.modifier; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatModifierAbstract; -import com.massivecraft.factions.entity.UPlayer; public class ChatModifierUc extends ChatModifierAbstract { @@ -18,7 +19,7 @@ public class ChatModifierUc extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, UPlayer fsender, UPlayer frecipient) + public String getModified(String subject, CommandSender sender, CommandSender recipient) { return subject.toUpperCase(); } diff --git a/src/com/massivecraft/factions/chat/modifier/ChatModifierUcf.java b/src/com/massivecraft/factions/chat/modifier/ChatModifierUcf.java index 702001a5..3f3dcac4 100644 --- a/src/com/massivecraft/factions/chat/modifier/ChatModifierUcf.java +++ b/src/com/massivecraft/factions/chat/modifier/ChatModifierUcf.java @@ -1,7 +1,8 @@ package com.massivecraft.factions.chat.modifier; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatModifierAbstract; -import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.mcore.util.Txt; public class ChatModifierUcf extends ChatModifierAbstract @@ -19,7 +20,7 @@ public class ChatModifierUcf extends ChatModifierAbstract // -------------------------------------------- // @Override - public String getModified(String subject, UPlayer fsender, UPlayer frecipient) + public String getModified(String subject, CommandSender sender, CommandSender recipient) { return Txt.upperCaseFirst(subject); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagName.java b/src/com/massivecraft/factions/chat/tag/ChatTagName.java index bea21e44..27784fbf 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagName.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagName.java @@ -1,5 +1,7 @@ package com.massivecraft.factions.chat.tag; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.UConf; @@ -20,10 +22,15 @@ public class ChatTagName extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(UPlayer fsender, UPlayer frecipient) + public String getReplacement(CommandSender sender, CommandSender recipient) { - if (!UConf.get(fsender).enabled) return ""; - Faction faction = fsender.getFaction(); + // Check disabled + if (UConf.isDisabled(sender)) return ""; + + // Get entities + UPlayer usender = UPlayer.get(sender); + + Faction faction = usender.getFaction(); if (faction.isNone()) return ""; return faction.getName(); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagNameforce.java b/src/com/massivecraft/factions/chat/tag/ChatTagNameforce.java index 3d98f5a2..7c5b6864 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagNameforce.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagNameforce.java @@ -1,5 +1,7 @@ package com.massivecraft.factions.chat.tag; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.UConf; @@ -20,10 +22,15 @@ public class ChatTagNameforce extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(UPlayer fsender, UPlayer frecipient) + public String getReplacement(CommandSender sender, CommandSender recipient) { - if (!UConf.get(fsender).enabled) return ""; - Faction faction = fsender.getFaction(); + // Check disabled + if (UConf.isDisabled(sender)) return ""; + + // Get entities + UPlayer usender = UPlayer.get(sender); + + Faction faction = usender.getFaction(); return faction.getName(); } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java b/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java index 60773283..273fba58 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java @@ -1,5 +1,7 @@ package com.massivecraft.factions.chat.tag; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; @@ -19,13 +21,18 @@ public class ChatTagRelcolor extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(UPlayer fsender, UPlayer frecipient) + public String getReplacement(CommandSender sender, CommandSender recipient) { - if (!UConf.get(fsender).enabled) return ""; + if (recipient == null) return ""; - if (frecipient == null) return ""; + // Check disabled + if (UConf.isDisabled(sender)) return ""; + + // Get entities + UPlayer usender = UPlayer.get(sender); + UPlayer urecipient = UPlayer.get(recipient); - return frecipient.getRelationTo(fsender).getColor().toString(); + return urecipient.getRelationTo(usender).getColor().toString(); } } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagRole.java b/src/com/massivecraft/factions/chat/tag/ChatTagRole.java index 76e7cb5a..aa28729f 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagRole.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRole.java @@ -1,5 +1,7 @@ package com.massivecraft.factions.chat.tag; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; @@ -20,11 +22,15 @@ public class ChatTagRole extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(UPlayer fsender, UPlayer frecipient) + public String getReplacement(CommandSender sender, CommandSender recipient) { - if (!UConf.get(fsender).enabled) return ""; + // Check disabled + if (UConf.isDisabled(sender)) return ""; - return Txt.upperCaseFirst(fsender.getRole().toString().toLowerCase()); + // Get entities + UPlayer usender = UPlayer.get(sender); + + return Txt.upperCaseFirst(usender.getRole().toString().toLowerCase()); } } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java b/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java index f3e631fe..fbec3aad 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagRoleprefix.java @@ -1,5 +1,7 @@ package com.massivecraft.factions.chat.tag; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; @@ -19,11 +21,15 @@ public class ChatTagRoleprefix extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(UPlayer fsender, UPlayer frecipient) + public String getReplacement(CommandSender sender, CommandSender recipient) { - if (!UConf.get(fsender).enabled) return ""; + // Check disabled + if (UConf.isDisabled(sender)) return ""; - return fsender.getRole().getPrefix(); + // Get entities + UPlayer usender = UPlayer.get(sender); + + return usender.getRole().getPrefix(); } } diff --git a/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java b/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java index 8e5c605b..fe96a894 100644 --- a/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java +++ b/src/com/massivecraft/factions/chat/tag/ChatTagTitle.java @@ -1,5 +1,7 @@ package com.massivecraft.factions.chat.tag; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.chat.ChatTagAbstract; import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; @@ -19,12 +21,16 @@ public class ChatTagTitle extends ChatTagAbstract // -------------------------------------------- // @Override - public String getReplacement(UPlayer fsender, UPlayer frecipient) + public String getReplacement(CommandSender sender, CommandSender recipient) { - if (!UConf.get(fsender).enabled) return ""; + // Check disabled + if (UConf.isDisabled(sender)) return ""; - if (!fsender.hasTitle()) return ""; - return fsender.getTitle(); + // Get entities + UPlayer usender = UPlayer.get(sender); + + if (!usender.hasTitle()) return ""; + return usender.getTitle(); } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java b/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java index c5611f2a..7104e6c8 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.Perm; import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; @@ -25,12 +26,13 @@ public class CmdFactionsAccess extends FCommand this.setDesc("view or grant access for the claimed territory you are in"); // TODO: Missing permission node here!? + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqIsPlayer.get()); } @Override public void perform() - { + { String type = this.arg(0); type = (type == null) ? "" : type.toLowerCase(); PS chunk = PS.valueOf(me).getChunk(true); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsAdmin.java b/src/com/massivecraft/factions/cmd/CmdFactionsAdmin.java index ccb5925f..1ecfcef9 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsAdmin.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsAdmin.java @@ -13,26 +13,27 @@ public class CmdFactionsAdmin extends FCommand this.addOptionalArg("on/off", "flip"); + //this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.ADMIN.node)); } @Override public void perform() - { - Boolean target = this.arg(0, ARBoolean.get(), !usender.isUsingAdminMode()); + { + Boolean target = this.arg(0, ARBoolean.get(), !msender.isUsingAdminMode()); if (target == null) return; - usender.setUsingAdminMode(target); + msender.setUsingAdminMode(target); - if ( usender.isUsingAdminMode()) + if (msender.isUsingAdminMode()) { - usender.msg("You have enabled admin bypass mode."); - Factions.get().log(usender.getName() + " has ENABLED admin bypass mode."); + msender.msg("You have enabled admin bypass mode."); + Factions.get().log(msender.getId() + " has ENABLED admin bypass mode."); } else { - usender.msg("You have disabled admin bypass mode."); - Factions.get().log(usender.getName() + " DISABLED admin bypass mode."); + msender.msg("You have disabled admin bypass mode."); + Factions.get().log(msender.getId() + " DISABLED admin bypass mode."); } } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java b/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java index dad9fc98..56859bb1 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java @@ -3,7 +3,9 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPerm; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.Faction; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.mcore.cmd.req.ReqHasPerm; import com.massivecraft.mcore.cmd.req.ReqIsPlayer; import com.massivecraft.mcore.ps.PS; @@ -16,6 +18,7 @@ public class CmdFactionsAutoClaim extends FCommand this.addOptionalArg("faction", "you"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.AUTOCLAIM.node)); this.addRequirements(ReqIsPlayer.get()); } @@ -23,7 +26,12 @@ public class CmdFactionsAutoClaim extends FCommand @Override public void perform() { + // Check disabled + if (UConf.isDisabled(sender, sender)) return; + + // Args Faction forFaction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction); + if (forFaction == null || forFaction == usender.getAutoClaimFaction()) { usender.setAutoClaimFaction(null); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java b/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java index 3c393c9c..3f9ed60e 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPerm; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.task.SpiralTask; @@ -22,13 +23,14 @@ public class CmdFactionsClaim extends FCommand this.addOptionalArg("radius", "1"); this.addOptionalArg("faction", "you"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node)); this.addRequirements(ReqIsPlayer.get()); } @Override public void perform() - { + { // Args Integer radius = this.arg(0, ARInteger.get(), 1); if (radius == null) return; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java b/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java index 68365288..a2359d76 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayerColls; import com.massivecraft.factions.entity.Faction; @@ -24,12 +25,13 @@ public class CmdFactionsCreate extends FCommand this.addRequiredArg("name"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.CREATE.node)); } @Override public void perform() - { + { // Args String newName = this.arg(0); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java b/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java index 2a31b9d2..462e7e59 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARUPlayer; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.mcore.cmd.req.ReqHasPerm; @@ -15,6 +16,7 @@ public class CmdFactionsDemote extends FCommand this.addRequiredArg("player"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.DEMOTE.node)); //To demote someone from member -> recruit you must be an officer. @@ -24,7 +26,7 @@ public class CmdFactionsDemote extends FCommand @Override public void perform() - { + { UPlayer you = this.arg(0, ARUPlayer.getStartAny(usender)); if (you == null) return; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java b/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java index 93216820..b802614d 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.event.FactionsEventDescriptionChange; import com.massivecraft.mcore.cmd.req.ReqHasPerm; @@ -16,13 +17,14 @@ public class CmdFactionsDescription extends FCommand this.addRequiredArg("desc"); this.setErrorOnToManyArgs(false); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.DESCRIPTION.node)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); } @Override public void perform() - { + { // Args String newDescription = this.argConcatFrom(0); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java b/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java index 4fa2dced..fcd2a914 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayerColls; import com.massivecraft.factions.entity.Faction; @@ -22,13 +23,14 @@ public class CmdFactionsDisband extends FCommand this.addAliases("disband"); this.addOptionalArg("faction", "you"); - + + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.DISBAND.node)); } @Override public void perform() - { + { // Args Faction faction = this.arg(0, ARFaction.get(usender), usenderFaction); if (faction == null) return; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java b/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java index adacb7fc..3bd0e277 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.FFlag; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARFFlag; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.Faction; import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.mcore.cmd.req.ReqHasPerm; @@ -20,12 +21,13 @@ public class CmdFactionsFlag extends FCommand this.addOptionalArg("flag", "all"); this.addOptionalArg("yes/no", "read"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.FLAG.node)); } @Override public void perform() - { + { Faction faction = this.arg(0, ARFaction.get(sender), usenderFaction); if (faction == null) return; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java index 4243918e..a4551c67 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java @@ -8,6 +8,7 @@ import com.massivecraft.factions.FFlag; import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.UConf; @@ -28,6 +29,7 @@ public class CmdFactionsHome extends FCommand this.addAliases("home"); this.addRequirements(ReqHasPerm.get(Perm.HOME.node)); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqIsPlayer.get()); this.addRequirements(ReqRoleIsAtLeast.get(Rel.RECRUIT)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java b/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java index 3955516a..22b02ded 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.FPerm; import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARUPlayer; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.event.FactionsEventInvitedChange; import com.massivecraft.mcore.cmd.arg.ARBoolean; @@ -19,6 +20,7 @@ public class CmdFactionsInvite extends FCommand this.addRequiredArg("player"); this.addOptionalArg("yes/no", "toggle"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.INVITE.node)); this.addRequirements(ReqIsPlayer.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java b/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java index 794647eb..3d2e1bc0 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; @@ -21,6 +22,7 @@ public class CmdFactionsJoin extends FCommand this.addRequiredArg("faction"); this.addOptionalArg("player", "you"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.JOIN.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsKick.java b/src/com/massivecraft/factions/cmd/CmdFactionsKick.java index 57a73980..0a656138 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsKick.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsKick.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARUPlayer; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.FactionColls; @@ -23,6 +24,7 @@ public class CmdFactionsKick extends FCommand this.addRequiredArg("player"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.KICK.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java index 5b9a84e9..ec5662b8 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.UPlayerColls; import com.massivecraft.factions.entity.Faction; @@ -22,6 +23,7 @@ public class CmdFactionsLeader extends FCommand this.addRequiredArg("player"); this.addOptionalArg("faction", "you"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.LEADER.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsLeave.java b/src/com/massivecraft/factions/cmd/CmdFactionsLeave.java index 9c553229..7606a0af 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsLeave.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsLeave.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.mcore.cmd.req.ReqHasPerm; @@ -11,6 +12,7 @@ public class CmdFactionsLeave extends FCommand { { this.addAliases("leave"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.LEAVE.node)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.RECRUIT)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsList.java b/src/com/massivecraft/factions/cmd/CmdFactionsList.java index c116398a..59acbe52 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsList.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsList.java @@ -5,6 +5,7 @@ import java.util.List; import com.massivecraft.factions.FactionListComparator; import com.massivecraft.factions.Perm; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.mcore.cmd.arg.ARInteger; @@ -14,13 +15,13 @@ import com.massivecraft.mcore.util.Txt; public class CmdFactionsList extends FCommand { - public CmdFactionsList() { this.addAliases("ls", "list"); this.addOptionalArg("page", "1"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.LIST.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMap.java b/src/com/massivecraft/factions/cmd/CmdFactionsMap.java index 7862455e..94141c0c 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMap.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMap.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.mcore.cmd.req.ReqHasPerm; @@ -15,6 +16,7 @@ public class CmdFactionsMap extends FCommand this.addOptionalArg("on/off", "once"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.MAP.node)); this.addRequirements(ReqIsPlayer.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java index f7137856..786ac1f9 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.integration.Econ; @@ -17,7 +18,6 @@ import org.bukkit.ChatColor; public class CmdFactionsMoneyDeposit extends FCommand { - public CmdFactionsMoneyDeposit() { this.addAliases("d", "deposit"); @@ -25,6 +25,7 @@ public class CmdFactionsMoneyDeposit extends FCommand this.addRequiredArg("amount"); this.addOptionalArg("faction", "you"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.MONEY_DEPOSIT.node)); this.addRequirements(ReqBankCommandsEnabled.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java index 42814f4a..05ef202c 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.Factions; @@ -25,6 +26,7 @@ public class CmdFactionsMoneyTransferFf extends FCommand this.addRequiredArg("faction"); this.addRequiredArg("faction"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2F.node)); this.addRequirements(ReqBankCommandsEnabled.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java index 50e3fc29..83d6a696 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; @@ -27,6 +28,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand this.addRequiredArg("faction"); this.addRequiredArg("player"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2P.node)); this.addRequirements(ReqBankCommandsEnabled.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java index 13bcaea3..a20eeb08 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; @@ -27,6 +28,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand this.addRequiredArg("player"); this.addRequiredArg("faction"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.MONEY_P2F.node)); this.addRequirements(ReqBankCommandsEnabled.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java index 5fd248ef..6d21f50e 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; @@ -25,6 +26,7 @@ public class CmdFactionsMoneyWithdraw extends FCommand this.addRequiredArg("amount"); this.addOptionalArg("faction", "you"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.MONEY_WITHDRAW.node)); this.addRequirements(ReqBankCommandsEnabled.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsName.java b/src/com/massivecraft/factions/cmd/CmdFactionsName.java index 4d73438d..7a56bd0e 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsName.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsName.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.FactionColl; @@ -14,13 +15,13 @@ import com.massivecraft.mcore.cmd.req.ReqHasPerm; public class CmdFactionsName extends FCommand { - public CmdFactionsName() { this.addAliases("name"); this.addRequiredArg("new name"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.NAME.node)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java b/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java index 82ea9e5a..17c13859 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java @@ -3,19 +3,20 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARUPlayer; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.mcore.cmd.req.ReqHasPerm; public class CmdFactionsOfficer extends FCommand { - public CmdFactionsOfficer() { this.addAliases("officer"); this.addRequiredArg("player"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.OFFICER.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java b/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java index d4be4d36..d0e8c576 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.event.FactionsEventOpenChange; import com.massivecraft.mcore.cmd.arg.ARBoolean; @@ -15,6 +16,7 @@ public class CmdFactionsOpen extends FCommand this.addOptionalArg("yes/no", "toggle"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.OPEN.node)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java b/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java index bd50c917..a6179ffe 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARFPerm; import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARRel; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.Faction; import com.massivecraft.mcore.cmd.arg.ARBoolean; import com.massivecraft.mcore.cmd.req.ReqHasPerm; @@ -23,6 +24,7 @@ public class CmdFactionsPerm extends FCommand this.addOptionalArg("yes/no", "read"); this.setErrorOnToManyArgs(false); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.PERM.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java b/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java index 756ec521..4478285d 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.cmd.arg.ARUPlayer; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.mcore.cmd.arg.ARDouble; @@ -19,6 +20,7 @@ public class CmdFactionsPowerBoost extends FCommand this.addRequiredArg("name"); this.addRequiredArg("#"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.POWERBOOST.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java b/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java index f3b99d6f..449314fc 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java @@ -3,18 +3,19 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARUPlayer; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.mcore.cmd.req.ReqHasPerm; public class CmdFactionsPromote extends FCommand { - public CmdFactionsPromote() { this.addAliases("promote"); this.addRequiredArg("player"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.PROMOTE.node)); //To promote someone from recruit -> member you must be an officer. diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java b/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java index 00eb41b9..f3db3068 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.FFlag; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.event.FactionsEventRelationChange; @@ -16,6 +17,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand public CmdFactionsRelationAbstract() { + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.RELATION.node)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunk.java b/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunk.java index 79ffb8b0..f83ca9d7 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunk.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunk.java @@ -16,6 +16,7 @@ public class CmdFactionsSeeChunk extends FCommand { this.addAliases("sc", "seechunk"); + //this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.SEE_CHUNK.node)); this.addRequirements(ReqIsPlayer.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java index 7c2a298b..2f5713c0 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import com.massivecraft.factions.cmd.arg.ARFaction; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; @@ -30,6 +31,7 @@ public class CmdFactionsShow extends FCommand this.addOptionalArg("faction", "you"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.SHOW.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java b/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java index 3dee7ce1..c5b5cb46 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.arg.ARUPlayer; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.event.FactionsEventTitleChange; @@ -18,6 +19,7 @@ public class CmdFactionsTitle extends FCommand this.addRequiredArg("player"); this.addOptionalArg("title", ""); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.TITLE.node)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java index 70e6ea29..f0b94dec 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java @@ -1,5 +1,6 @@ package com.massivecraft.factions.cmd; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.FPerm; @@ -14,6 +15,7 @@ public class CmdFactionsUnclaim extends FCommand { this.addAliases("unclaim", "declaim"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM.node)); this.addRequirements(ReqIsPlayer.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaimall.java b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaimall.java index 9490f168..a6ba068f 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaimall.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.FPerm; import com.massivecraft.factions.Factions; import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; +import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColls; @@ -22,6 +23,7 @@ public class CmdFactionsUnclaimall extends FCommand { this.addAliases("unclaimall", "declaimall"); + this.addRequirements(ReqFactionsEnabled.get()); this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM_ALL.node)); this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER)); } diff --git a/src/com/massivecraft/factions/cmd/FCommand.java b/src/com/massivecraft/factions/cmd/FCommand.java index e9d95d99..eafb0959 100644 --- a/src/com/massivecraft/factions/cmd/FCommand.java +++ b/src/com/massivecraft/factions/cmd/FCommand.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Rel; import com.massivecraft.factions.entity.MPlayer; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.mcore.cmd.MCommand; @@ -17,6 +18,13 @@ public abstract class FCommand extends MCommand public void fixSenderVars() { this.msender = MPlayer.get(sender); + + this.usender = null; + this.usenderFaction = null; + + // Check disabled + if (UConf.isDisabled(sender)) return; + this.usender = UPlayer.get(this.sender); this.usenderFaction = this.usender.getFaction(); } diff --git a/src/com/massivecraft/factions/cmd/req/ReqFactionsEnabled.java b/src/com/massivecraft/factions/cmd/req/ReqFactionsEnabled.java new file mode 100644 index 00000000..e94127fa --- /dev/null +++ b/src/com/massivecraft/factions/cmd/req/ReqFactionsEnabled.java @@ -0,0 +1,36 @@ +package com.massivecraft.factions.cmd.req; + +import org.bukkit.command.CommandSender; + +import com.massivecraft.factions.entity.UConf; +import com.massivecraft.mcore.cmd.MCommand; +import com.massivecraft.mcore.cmd.req.ReqAbstract; + +public class ReqFactionsEnabled extends ReqAbstract +{ + private static final long serialVersionUID = 1L; + + // -------------------------------------------- // + // INSTANCE & CONSTRUCT + // -------------------------------------------- // + + private static ReqFactionsEnabled i = new ReqFactionsEnabled(); + public static ReqFactionsEnabled get() { return i; } + + // -------------------------------------------- // + // OVERRIDE + // -------------------------------------------- // + + @Override + public boolean apply(CommandSender sender, MCommand command) + { + return !UConf.isDisabled(sender); + } + + @Override + public String createErrorMessage(CommandSender sender, MCommand command) + { + return UConf.getDisabledMessage(sender); + } + +} diff --git a/src/com/massivecraft/factions/entity/UConf.java b/src/com/massivecraft/factions/entity/UConf.java index 41e6ad94..0f7c12d7 100644 --- a/src/com/massivecraft/factions/entity/UConf.java +++ b/src/com/massivecraft/factions/entity/UConf.java @@ -6,12 +6,16 @@ import java.util.Map; import java.util.Set; import java.util.UUID; +import org.bukkit.command.CommandSender; + import com.massivecraft.factions.FFlag; import com.massivecraft.factions.FPerm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.event.FactionsEventChunkChangeType; import com.massivecraft.mcore.store.Entity; +import com.massivecraft.mcore.store.SenderEntity; import com.massivecraft.mcore.util.MUtil; +import com.massivecraft.mcore.util.Txt; public class UConf extends Entity { @@ -30,6 +34,34 @@ public class UConf extends Entity public boolean enabled = true; + public static boolean isDisabled(Object universe) + { + return isDisabled(universe, null); + } + + public static String getDisabledMessage(Object universe) + { + UConf uconf = UConf.get(universe); + return Txt.parse("Factions are disabled in the %s universe.", uconf.getUniverse()); + } + + public static boolean isDisabled(Object universe, Object inform) + { + UConf uconf = UConf.get(universe); + if (uconf.enabled) return false; + + if (inform instanceof CommandSender) + { + ((CommandSender)inform).sendMessage(getDisabledMessage(universe)); + } + else if (inform instanceof SenderEntity) + { + ((SenderEntity)inform).sendMessage(getDisabledMessage(universe)); + } + + return true; + } + // -------------------------------------------- // // SPECIAL FACTION IDS // -------------------------------------------- // diff --git a/src/com/massivecraft/factions/integration/herochat/HerochatEngine.java b/src/com/massivecraft/factions/integration/herochat/HerochatEngine.java index 54f4678e..a8fedc59 100644 --- a/src/com/massivecraft/factions/integration/herochat/HerochatEngine.java +++ b/src/com/massivecraft/factions/integration/herochat/HerochatEngine.java @@ -10,7 +10,6 @@ import com.dthielke.herochat.ChannelChatEvent; import com.dthielke.herochat.Herochat; import com.massivecraft.factions.Factions; import com.massivecraft.factions.chat.ChatFormatter; -import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.MConf; @@ -54,7 +53,7 @@ public class HerochatEngine implements Listener String format = event.getFormat(); format = format.replaceAll("&r", "§r"); - format = ChatFormatter.format(format, UPlayer.get(event.getSender().getPlayer()), null); + format = ChatFormatter.format(format, event.getSender().getPlayer(), null); event.setFormat(format); } diff --git a/src/com/massivecraft/factions/listeners/FactionsListenerChat.java b/src/com/massivecraft/factions/listeners/FactionsListenerChat.java index e4c52100..7b3a84b6 100644 --- a/src/com/massivecraft/factions/listeners/FactionsListenerChat.java +++ b/src/com/massivecraft/factions/listeners/FactionsListenerChat.java @@ -10,7 +10,6 @@ import org.bukkit.plugin.EventExecutor; import com.massivecraft.factions.Factions; import com.massivecraft.factions.chat.ChatFormatter; -import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.MConf; public class FactionsListenerChat implements Listener @@ -91,7 +90,7 @@ public class FactionsListenerChat implements Listener public static void parseTags(AsyncPlayerChatEvent event) { String format = event.getFormat(); - format = ChatFormatter.format(format, UPlayer.get(event.getPlayer()), null); + format = ChatFormatter.format(format, event.getPlayer(), null); event.setFormat(format); } diff --git a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java index dbd787cd..39571c36 100644 --- a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java +++ b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java @@ -60,6 +60,7 @@ import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.UConf; +import com.massivecraft.factions.entity.UPlayerColl; import com.massivecraft.factions.entity.UPlayerColls; import com.massivecraft.factions.event.FactionsEventPowerChange; import com.massivecraft.factions.event.FactionsEventPowerChange.PowerChangeReason; @@ -96,9 +97,12 @@ public class FactionsListenerMain implements Listener { // If the player is moving from one chunk to another ... if (MUtil.isSameChunk(event)) return; + Player player = event.getPlayer(); + + // Check Disabled + if (UConf.isDisabled(player)) return; // ... gather info on the player and the move ... - Player player = event.getPlayer(); UPlayer uplayer = UPlayerColls.get().get(event.getTo()).get(player); PS chunkFrom = PS.valueOf(event.getFrom()).getChunk(true); @@ -171,6 +175,10 @@ public class FactionsListenerMain implements Listener { // If a player dies ... Player player = event.getEntity(); + + // Check Disabled + if (UConf.isDisabled(player)) return; + UPlayer uplayer = UPlayer.get(player); // ... and powerloss can happen here ... @@ -247,13 +255,16 @@ public class FactionsListenerMain implements Listener } public boolean canCombatDamageHappen(EntityDamageByEntityEvent event, boolean notify) - { + { // If the defender is a player ... Entity edefender = event.getEntity(); if (!(edefender instanceof Player)) return true; Player defender = (Player)edefender; UPlayer fdefender = UPlayer.get(edefender); + // Check Disabled + if (UConf.isDisabled(defender)) return true; + // ... and the attacker is someone else ... Entity eattacker = event.getDamager(); if (eattacker instanceof Projectile) @@ -376,7 +387,6 @@ public class FactionsListenerMain implements Listener { // If a player was kicked from the server ... Player player = event.getPlayer(); - UPlayer uplayer = UPlayer.get(player); // ... and if the if player was banned (not just kicked) ... if (!event.getReason().equals("Banned by admin.")) return; @@ -385,12 +395,18 @@ public class FactionsListenerMain implements Listener if (!MConf.get().removePlayerDataWhenBanned) return; // ... get rid of their stored info. - if (uplayer.getRole() == Rel.LEADER) + for (UPlayerColl coll : UPlayerColls.get().getColls()) { - uplayer.getFaction().promoteNewLeader(); + UPlayer uplayer = coll.get(player, false); + if (uplayer == null) continue; + + if (uplayer.getRole() == Rel.LEADER) + { + uplayer.getFaction().promoteNewLeader(); + } + uplayer.leave(); + uplayer.detach(); } - uplayer.leave(); - uplayer.detach(); } // -------------------------------------------- // @@ -414,6 +430,10 @@ public class FactionsListenerMain implements Listener { // If a player is trying to run a command ... Player player = event.getPlayer(); + + // Check Disabled + if (UConf.isDisabled(player)) return; + UPlayer uplayer = UPlayer.get(player); // ... and the player does not have adminmode ... @@ -474,6 +494,9 @@ public class FactionsListenerMain implements Listener // If a monster is spawning ... if ( ! Const.ENTITY_TYPES_MONSTERS.contains(event.getEntityType())) return; + // Check Disabled + if (UConf.isDisabled(event.getLocation())) return; + // ... at a place where monsters are forbidden ... PS ps = PS.valueOf(event.getLocation()); Faction faction = BoardColls.get().getFactionAt(ps); @@ -493,6 +516,9 @@ public class FactionsListenerMain implements Listener Entity target = event.getTarget(); if (target == null) return; + // Check Disabled + if (UConf.isDisabled(target)) return; + // ... at a place where monsters are forbidden ... PS ps = PS.valueOf(target); Faction faction = BoardColls.get().getFactionAt(ps); @@ -518,9 +544,13 @@ public class FactionsListenerMain implements Listener { // If a hanging entity was broken by an explosion ... if (event.getCause() != RemoveCause.EXPLOSION) return; + Entity entity = event.getEntity(); + + // Check Disabled + if (UConf.isDisabled(entity)) return; // ... and the faction there has explosions disabled ... - Faction faction = BoardColls.get().getFactionAt(PS.valueOf(event.getEntity())); + Faction faction = BoardColls.get().getFactionAt(PS.valueOf(entity)); if (faction.getFlag(FFlag.EXPLOSIONS)) return; // ... then cancel. @@ -530,6 +560,19 @@ public class FactionsListenerMain implements Listener @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void blockExplosion(EntityExplodeEvent event) { + // If an entity is exploding ... + Entity entity = event.getEntity(); + + // Check Disabled + if (UConf.isDisabled(entity)) return; + + // Check the entity. Are explosions disabled there? + if (BoardColls.get().getFactionAt(PS.valueOf(event.getEntity())).getFlag(FFlag.EXPLOSIONS) == false) + { + event.setCancelled(true); + return; + } + // Individually check the flag state for each block Iterator iter = event.blockList().iterator(); while (iter.hasNext()) @@ -538,12 +581,6 @@ public class FactionsListenerMain implements Listener Faction faction = BoardColls.get().getFactionAt(PS.valueOf(block)); if (faction.getFlag(FFlag.EXPLOSIONS) == false) iter.remove(); } - - // Check the entity. Are explosions disabled there? - if (BoardColls.get().getFactionAt(PS.valueOf(event.getEntity())).getFlag(FFlag.EXPLOSIONS) == false) - { - event.setCancelled(true); - } } @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @@ -552,6 +589,9 @@ public class FactionsListenerMain implements Listener // If a wither is changing a block ... Entity entity = event.getEntity(); if (!(entity instanceof Wither)) return; + + // Check Disabled + if (UConf.isDisabled(entity)) return; // ... and the faction there has explosions disabled ... PS ps = PS.valueOf(event.getBlock()); @@ -573,6 +613,9 @@ public class FactionsListenerMain implements Listener Entity entity = event.getEntity(); if (!(entity instanceof Enderman)) return; + // Check Disabled + if (UConf.isDisabled(entity)) return; + // ... and the faction there has endergrief disabled ... PS ps = PS.valueOf(event.getBlock()); Faction faction = BoardColls.get().getFactionAt(ps); @@ -588,6 +631,9 @@ public class FactionsListenerMain implements Listener public void blockFireSpread(Block block, Cancellable cancellable) { + // Check Disabled + if (UConf.isDisabled(block)) return; + // If the faction at the block has firespread disabled ... PS ps = PS.valueOf(block); Faction faction = BoardColls.get().getFactionAt(ps); diff --git a/src/com/massivecraft/factions/task/TaskEconLandReward.java b/src/com/massivecraft/factions/task/TaskEconLandReward.java index a08f6121..82301dc0 100644 --- a/src/com/massivecraft/factions/task/TaskEconLandReward.java +++ b/src/com/massivecraft/factions/task/TaskEconLandReward.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.task; import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.MConf; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.mcore.ModuloRepeatTask; import com.massivecraft.mcore.util.TimeUnit; @@ -36,6 +37,9 @@ public class TaskEconLandReward extends ModuloRepeatTask { for (FactionColl coll : FactionColls.get().getColls()) { + // Check disabled + if (UConf.isDisabled(coll)) continue; + coll.econLandRewardRoutine(); } } diff --git a/src/com/massivecraft/factions/task/TaskPlayerDataRemove.java b/src/com/massivecraft/factions/task/TaskPlayerDataRemove.java index 2eb00d2b..ae44854c 100644 --- a/src/com/massivecraft/factions/task/TaskPlayerDataRemove.java +++ b/src/com/massivecraft/factions/task/TaskPlayerDataRemove.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.task; import com.massivecraft.factions.entity.MConf; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayerColl; import com.massivecraft.factions.entity.UPlayerColls; import com.massivecraft.mcore.ModuloRepeatTask; @@ -36,6 +37,9 @@ public class TaskPlayerDataRemove extends ModuloRepeatTask { for (UPlayerColl coll : UPlayerColls.get().getColls()) { + // Check disabled + if (UConf.isDisabled(coll)) continue; + coll.removePlayerDataAfterInactiveDaysRoutine(); } } diff --git a/src/com/massivecraft/factions/task/TaskPlayerPowerUpdate.java b/src/com/massivecraft/factions/task/TaskPlayerPowerUpdate.java index ab96d4e0..afa70b67 100644 --- a/src/com/massivecraft/factions/task/TaskPlayerPowerUpdate.java +++ b/src/com/massivecraft/factions/task/TaskPlayerPowerUpdate.java @@ -4,6 +4,7 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import com.massivecraft.factions.entity.MConf; +import com.massivecraft.factions.entity.UConf; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.factions.event.FactionsEventPowerChange; import com.massivecraft.factions.event.FactionsEventPowerChange.PowerChangeReason; @@ -42,6 +43,9 @@ public class TaskPlayerPowerUpdate extends ModuloRepeatTask for (Player player : Bukkit.getOnlinePlayers()) { + // Check disabled + if (UConf.isDisabled(player)) continue; + if (player.isDead()) continue; UPlayer uplayer = UPlayer.get(player);