hostFactionId = element.getAsString();
element = obj.get(HOST_FACTION_ALLOWED);
- if (element != null) {
- hostFactionAllowed = element.getAsBoolean();
- }
+ if (element != null) {
+ hostFactionAllowed = element.getAsBoolean();
+ }
element = obj.get(GRANTED_IDS);
- if (element != null) {
- grantedIds = context.deserialize(element, SET_OF_STRING_TYPE);
- }
+ if (element != null) {
+ grantedIds = context.deserialize(element, SET_OF_STRING_TYPE);
+ }
element = obj.get(CHUNK_NAME);
- if (element != null) {
- chunkName = element.getAsString();
- }
+ if (element != null) {
+ chunkName = element.getAsString();
+ }
return TerritoryAccess.valueOf(hostFactionId, hostFactionAllowed, grantedIds, chunkName);
}
@Override
public JsonElement serialize(TerritoryAccess src, Type typeOfSrc, JsonSerializationContext context) {
- if (src == null) {
- return null;
- }
+ if (src == null) {
+ return null;
+ }
// isDefault <=> simple hostFactionId string
if (src.isDefault()) {
diff --git a/src/main/java/net/knarcraft/factions/chat/ChatFormatter.java b/src/main/java/net/knarcraft/factions/chat/ChatFormatter.java
index 5dc769f2..c2e77a29 100644
--- a/src/main/java/net/knarcraft/factions/chat/ChatFormatter.java
+++ b/src/main/java/net/knarcraft/factions/chat/ChatFormatter.java
@@ -9,10 +9,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
- * The ChatFormater is a system offered by factions for tag parsing.
+ * The ChatFormatter is a system offered by factions for tag parsing.
*
* Note that every tag and modifier id must be lowercase.
- * A tag with id "derp" is allowed but not with id "Derp". For that reason the tag {sender} will work but {Sender} wont.
+ * A tag with id "derp" is allowed but not with id "Derp". For that reason the tag {sender} will work but {Sender} won't.
*/
public class ChatFormatter {
// -------------------------------------------- //
@@ -33,23 +33,23 @@ public class ChatFormatter {
// FORMAT
// -------------------------------------------- //
- public static String format(String msg, CommandSender sender, CommandSender recipient) {
+ public static String format(String message, CommandSender sender, CommandSender recipient) {
// We build the return value in this string buffer
- StringBuffer ret = new StringBuffer();
+ StringBuilder returnValue = new StringBuilder();
// A matcher to match all the tags in the msg
- Matcher matcher = pattern.matcher(msg);
+ Matcher matcher = pattern.matcher(message);
// For each tag we find
while (matcher.find()) {
- // The fullmatch is something like "{sender|lp|rp}"
- String fullmatch = matcher.group(0);
+ // The fullMatch is something like "{sender|lp|rp}"
+ String fullMatch = matcher.group(0);
- // The submatch is something like "sender|lp|rp"
- String submatch = matcher.group(1);
+ // The subMatch is something like "sender|lp|rp"
+ String subMatch = matcher.group(1);
// The parts are something like ["sender", "lp", "rp"]
- String[] parts = submatch.split(ESC_SEPARATOR);
+ String[] parts = subMatch.split(ESC_SEPARATOR);
// The modifier ids are something like ["lp", "rp"] and tagId something like "sender"
List modifierIds = new ArrayList<>(Arrays.asList(parts));
@@ -61,23 +61,23 @@ public class ChatFormatter {
String replacement;
if (tag == null) {
// No change if tag wasn't found
- replacement = fullmatch;
+ replacement = fullMatch;
} else {
replacement = compute(tag, modifierIds, sender, recipient);
if (replacement == null) {
// If a tag or modifier returns null it's the same as opting out.
- replacement = fullmatch;
+ replacement = fullMatch;
}
}
- matcher.appendReplacement(ret, replacement);
+ matcher.appendReplacement(returnValue, replacement);
}
// Append the rest
- matcher.appendTail(ret);
+ matcher.appendTail(returnValue);
// And finally we return the string value of the buffer we built
- return ret.toString();
+ return returnValue.toString();
}
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierLc.java b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierLc.java
index 69c9e772..79a7653d 100644
--- a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierLc.java
+++ b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierLc.java
@@ -12,7 +12,7 @@ public class ChatModifierLc extends ChatModifier {
super("lc");
}
- private static ChatModifierLc i = new ChatModifierLc();
+ private static final ChatModifierLc i = new ChatModifierLc();
public static ChatModifierLc get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierLp.java b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierLp.java
index f06290af..e4206da0 100644
--- a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierLp.java
+++ b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierLp.java
@@ -13,7 +13,7 @@ public class ChatModifierLp extends ChatModifier {
super("lp");
}
- private static ChatModifierLp i = new ChatModifierLp();
+ private static final ChatModifierLp i = new ChatModifierLp();
public static ChatModifierLp get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierParse.java b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierParse.java
index 64559a10..2509d8f1 100644
--- a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierParse.java
+++ b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierParse.java
@@ -1,7 +1,7 @@
package net.knarcraft.factions.chat.modifier;
-import net.knarcraft.factions.chat.ChatModifier;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.chat.ChatModifier;
import org.bukkit.command.CommandSender;
public class ChatModifierParse extends ChatModifier {
@@ -13,7 +13,7 @@ public class ChatModifierParse extends ChatModifier {
super("parse");
}
- private static ChatModifierParse i = new ChatModifierParse();
+ private static final ChatModifierParse i = new ChatModifierParse();
public static ChatModifierParse get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierRp.java b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierRp.java
index ef78ae58..d73254d6 100644
--- a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierRp.java
+++ b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierRp.java
@@ -12,7 +12,7 @@ public class ChatModifierRp extends ChatModifier {
super("rp");
}
- private static ChatModifierRp i = new ChatModifierRp();
+ private static final ChatModifierRp i = new ChatModifierRp();
public static ChatModifierRp get() {
return i;
@@ -24,9 +24,9 @@ public class ChatModifierRp extends ChatModifier {
@Override
public String getModified(String subject, CommandSender sender, CommandSender recipient) {
- if (subject.equals("")) {
- return subject;
- }
+ if (subject.equals("")) {
+ return subject;
+ }
return subject + " ";
}
diff --git a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierUc.java b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierUc.java
index 9c927a19..e18f5efe 100644
--- a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierUc.java
+++ b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierUc.java
@@ -12,7 +12,7 @@ public class ChatModifierUc extends ChatModifier {
super("uc");
}
- private static ChatModifierUc i = new ChatModifierUc();
+ private static final ChatModifierUc i = new ChatModifierUc();
public static ChatModifierUc get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierUcf.java b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierUcf.java
index dfe2b140..2530721c 100644
--- a/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierUcf.java
+++ b/src/main/java/net/knarcraft/factions/chat/modifier/ChatModifierUcf.java
@@ -1,7 +1,7 @@
package net.knarcraft.factions.chat.modifier;
-import net.knarcraft.factions.chat.ChatModifier;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.chat.ChatModifier;
import org.bukkit.command.CommandSender;
public class ChatModifierUcf extends ChatModifier {
@@ -13,7 +13,7 @@ public class ChatModifierUcf extends ChatModifier {
super("ucf");
}
- private static ChatModifierUcf i = new ChatModifierUcf();
+ private static final ChatModifierUcf i = new ChatModifierUcf();
public static ChatModifierUcf get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagName.java b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagName.java
index 2c093c83..fcf53699 100644
--- a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagName.java
+++ b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagName.java
@@ -14,7 +14,7 @@ public class ChatTagName extends ChatTag {
super("factions_name");
}
- private static ChatTagName i = new ChatTagName();
+ private static final ChatTagName i = new ChatTagName();
public static ChatTagName get() {
return i;
@@ -27,13 +27,13 @@ public class ChatTagName extends ChatTag {
@Override
public String getReplacement(CommandSender sender, CommandSender recipient) {
// Get entities
- MPlayer usender = MPlayer.get(sender);
+ MPlayer uSender = MPlayer.get(sender);
// No "force"
- Faction faction = usender.getFaction();
- if (faction.isNone()) {
- return "";
- }
+ Faction faction = uSender.getFaction();
+ if (faction.isNone()) {
+ return "";
+ }
return faction.getName();
}
diff --git a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagNameforce.java b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagNameforce.java
index 8a0612a1..749c20e9 100644
--- a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagNameforce.java
+++ b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagNameforce.java
@@ -14,7 +14,7 @@ public class ChatTagNameforce extends ChatTag {
super("factions_nameforce");
}
- private static ChatTagNameforce i = new ChatTagNameforce();
+ private static final ChatTagNameforce i = new ChatTagNameforce();
public static ChatTagNameforce get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRelcolor.java b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRelcolor.java
index 00935d2b..148bdbb6 100644
--- a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRelcolor.java
+++ b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRelcolor.java
@@ -13,7 +13,7 @@ public class ChatTagRelcolor extends ChatTag {
super("factions_relcolor");
}
- private static ChatTagRelcolor i = new ChatTagRelcolor();
+ private static final ChatTagRelcolor i = new ChatTagRelcolor();
public static ChatTagRelcolor get() {
return i;
@@ -26,9 +26,9 @@ public class ChatTagRelcolor extends ChatTag {
@Override
public String getReplacement(CommandSender sender, CommandSender recipient) {
// Opt out if no recipient
- if (recipient == null) {
- return null;
- }
+ if (recipient == null) {
+ return null;
+ }
// Get entities
MPlayer usender = MPlayer.get(sender);
diff --git a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRole.java b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRole.java
index 9e721146..42d9ae77 100644
--- a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRole.java
+++ b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRole.java
@@ -1,8 +1,8 @@
package net.knarcraft.factions.chat.tag;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.chat.ChatTag;
import net.knarcraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.command.CommandSender;
public class ChatTagRole extends ChatTag {
@@ -14,7 +14,7 @@ public class ChatTagRole extends ChatTag {
super("factions_role");
}
- private static ChatTagRole i = new ChatTagRole();
+ private static final ChatTagRole i = new ChatTagRole();
public static ChatTagRole get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRoleprefix.java b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRoleprefix.java
index 4f7a8838..84d61a38 100644
--- a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRoleprefix.java
+++ b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRoleprefix.java
@@ -14,7 +14,7 @@ public class ChatTagRoleprefix extends ChatTag {
super("factions_roleprefix");
}
- private static ChatTagRoleprefix i = new ChatTagRoleprefix();
+ private static final ChatTagRoleprefix i = new ChatTagRoleprefix();
public static ChatTagRoleprefix get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRoleprefixforce.java b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRoleprefixforce.java
index d617d681..97cf06ae 100644
--- a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRoleprefixforce.java
+++ b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagRoleprefixforce.java
@@ -13,7 +13,7 @@ public class ChatTagRoleprefixforce extends ChatTag {
super("factions_roleprefixforce");
}
- private static ChatTagRoleprefixforce i = new ChatTagRoleprefixforce();
+ private static final ChatTagRoleprefixforce i = new ChatTagRoleprefixforce();
public static ChatTagRoleprefixforce get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagTitle.java b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagTitle.java
index 41f66c39..cc6b9f99 100644
--- a/src/main/java/net/knarcraft/factions/chat/tag/ChatTagTitle.java
+++ b/src/main/java/net/knarcraft/factions/chat/tag/ChatTagTitle.java
@@ -13,7 +13,7 @@ public class ChatTagTitle extends ChatTag {
super("factions_title");
}
- private static ChatTagTitle i = new ChatTagTitle();
+ private static final ChatTagTitle i = new ChatTagTitle();
public static ChatTagTitle get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactions.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactions.java
index ab3f5a99..a60c649f 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactions.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactions.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.entity.MConf;
import com.massivecraft.massivecore.command.MassiveCommandDeprecated;
import com.massivecraft.massivecore.command.MassiveCommandVersion;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.entity.MConf;
import java.util.List;
@@ -12,7 +12,7 @@ public class CmdFactions extends FactionsCommand {
// INSTANCE
// -------------------------------------------- //
- private static CmdFactions i = new CmdFactions();
+ private static final CmdFactions i = new CmdFactions();
public static CmdFactions get() {
return i;
@@ -28,21 +28,21 @@ public class CmdFactions extends FactionsCommand {
public CmdFactionsPlayer cmdFactionsPlayer = new CmdFactionsPlayer();
public CmdFactionsStatus cmdFactionsStatus = new CmdFactionsStatus();
public CmdFactionsJoin cmdFactionsJoin = new CmdFactionsJoin();
- public CmdFactionsLeave cmdFactionsLeave = new CmdFactionsLeave();
- public CmdFactionsWarp cmdFactionsWarp = new CmdFactionsWarp();
+ public final CmdFactionsLeave cmdFactionsLeave = new CmdFactionsLeave();
+ public final CmdFactionsWarp cmdFactionsWarp = new CmdFactionsWarp();
public CmdFactionsHome cmdFactionsHome = new CmdFactionsHome();
public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome();
public CmdFactionsUnsethome cmdFactionsUnsethome = new CmdFactionsUnsethome();
- public CmdFactionsVote cmdFactionsVote = new CmdFactionsVote();
+ public final CmdFactionsVote cmdFactionsVote = new CmdFactionsVote();
public CmdFactionsMap cmdFactionsMap = new CmdFactionsMap();
- public CmdFactionsCreate cmdFactionsCreate = new CmdFactionsCreate();
- public CmdFactionsName cmdFactionsName = new CmdFactionsName();
- public CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription();
+ public final CmdFactionsCreate cmdFactionsCreate = new CmdFactionsCreate();
+ public final CmdFactionsName cmdFactionsName = new CmdFactionsName();
+ public final CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription();
public CmdFactionsMotd cmdFactionsMotd = new CmdFactionsMotd();
- public CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite();
- public CmdFactionsKick cmdFactionsKick = new CmdFactionsKick();
- public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();
- public CmdFactionsRank cmdFactionsRank = new CmdFactionsRank();
+ public final CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite();
+ public final CmdFactionsKick cmdFactionsKick = new CmdFactionsKick();
+ public final CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();
+ public final CmdFactionsRank cmdFactionsRank = new CmdFactionsRank();
public CmdFactionsMoney cmdFactionsMoney = new CmdFactionsMoney();
public CmdFactionsTop cmdFactionsTop = new CmdFactionsTop();
public CmdFactionsSeeChunk cmdFactionsSeeChunk = new CmdFactionsSeeChunk();
@@ -52,17 +52,17 @@ public class CmdFactions extends FactionsCommand {
public CmdFactionsUnclaim cmdFactionsUnclaim = new CmdFactionsUnclaim();
public CmdFactionsAccess cmdFactionsAccess = new CmdFactionsAccess();
public CmdFactionsChunkname cmdFactionsChunkname = new CmdFactionsChunkname();
- public CmdFactionsRelation cmdFactionsRelation = new CmdFactionsRelation();
+ public final CmdFactionsRelation cmdFactionsRelation = new CmdFactionsRelation();
public CmdFactionsRelationOld cmdFactionsRelationOldAlly = new CmdFactionsRelationOld("ally");
public CmdFactionsRelationOld cmdFactionsRelationOldTruce = new CmdFactionsRelationOld("truce");
public CmdFactionsRelationOld cmdFactionsRelationOldNeutral = new CmdFactionsRelationOld("neutral");
public CmdFactionsRelationOld cmdFactionsRelationOldEnemy = new CmdFactionsRelationOld("enemy");
public CmdFactionsTax cmdFactionsTax = new CmdFactionsTax();
- public CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm();
- public CmdFactionsFlag cmdFactionsFlag = new CmdFactionsFlag();
+ public final CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm();
+ public final CmdFactionsFlag cmdFactionsFlag = new CmdFactionsFlag();
public CmdFactionsFly cmdFactionsFly = new CmdFactionsFly();
public CmdFactionsUnstuck cmdFactionsUnstuck = new CmdFactionsUnstuck();
- public CmdFactionsOverride cmdFactionsOverride = new CmdFactionsOverride();
+ public final CmdFactionsOverride cmdFactionsOverride = new CmdFactionsOverride();
public CmdFactionsDisband cmdFactionsDisband = new CmdFactionsDisband();
public CmdFactionsPowerboost cmdFactionsPowerBoost = new CmdFactionsPowerboost();
public CmdFactionsSetpower cmdFactionsSetpower = new CmdFactionsSetpower();
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessAbstract.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessAbstract.java
index ecd9e5c7..31bae7a3 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessAbstract.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessAbstract.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.TerritoryAccess;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.util.AsciiMap;
-import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.Txt;
import java.util.Collection;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessInspect.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessInspect.java
index 636aa443..2ed862a4 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessInspect.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessInspect.java
@@ -1,17 +1,17 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.cmd.type.TypeMPermable;
-import net.knarcraft.factions.entity.Board;
-import net.knarcraft.factions.entity.BoardColl;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MPerm;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.mixin.MixinWorld;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.cmd.type.TypeMPermable;
+import net.knarcraft.factions.entity.Board;
+import net.knarcraft.factions.entity.BoardColl;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MPerm;
import java.util.List;
import java.util.Map;
@@ -44,9 +44,9 @@ public class CmdFactionsAccessInspect extends FactionsCommand {
// Check if they have access perms, unless they are checking for their own access
if (mpermable != msender && mpermable != msenderFaction && mpermable != msender.getRank()) {
- if (!MPerm.getPermAccess().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermAccess().has(msender, faction, true)) {
+ return;
+ }
}
// Turn into id->chunks
@@ -59,9 +59,9 @@ public class CmdFactionsAccessInspect extends FactionsCommand {
.filter(e -> e.getValue().isGranted(mpermable))
.map(Entry::getKey)
.collect(Collectors.toSet());
- if (!chunks.isEmpty()) {
- world2Chunks.put(worldId, chunks);
- }
+ if (!chunks.isEmpty()) {
+ world2Chunks.put(worldId, chunks);
+ }
}
if (world2Chunks.isEmpty()) {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetCircle.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetCircle.java
index c126a6f1..2a867e82 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetCircle.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetCircle.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.ChunkUtil;
+import net.knarcraft.factions.Perm;
import java.util.Set;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetFill.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetFill.java
index 6a69874d..0c8e731e 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetFill.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetFill.java
@@ -1,14 +1,13 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
-import net.knarcraft.factions.entity.BoardColl;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MConf;
-import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.ChunkUtil;
+import net.knarcraft.factions.Perm;
+import net.knarcraft.factions.entity.BoardColl;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MConf;
import java.util.Set;
import java.util.function.Predicate;
@@ -36,7 +35,7 @@ public class CmdFactionsAccessSetFill extends CmdFactionsAccessSetXSimple {
// -------------------------------------------- //
@Override
- public Set getChunks() throws MassiveException {
+ public Set getChunks() {
// Common Startup
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetOne.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetOne.java
index de7025df..93a9c525 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetOne.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetOne.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
+import net.knarcraft.factions.Perm;
import java.util.Collections;
import java.util.Set;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetSquare.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetSquare.java
index 1cd51f4c..18fd2525 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetSquare.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetSquare.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.ChunkUtil;
+import net.knarcraft.factions.Perm;
import java.util.Set;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetX.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetX.java
index 87432100..1a99a780 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetX.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetX.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeMPermable;
-import net.knarcraft.factions.entity.Faction;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.ps.PS;
+import net.knarcraft.factions.cmd.type.TypeMPermable;
+import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPerm;
import java.util.Set;
@@ -52,9 +52,9 @@ public abstract class CmdFactionsAccessSetX extends CmdFactionsAccessAbstract {
final MPerm.MPermable mpermable = this.getMPermable(hostFaction);
final Set chunks = this.getChunks();
- if (chunks == null) {
- throw new NullPointerException("chunks");
- }
+ if (chunks == null) {
+ throw new NullPointerException("chunks");
+ }
// Apply / Inform
setAccess(chunks, mpermable, this.isGranting());
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetXRadius.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetXRadius.java
index db656c76..f44f8bee 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetXRadius.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsAccessSetXRadius.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeMPermable;
-import net.knarcraft.factions.entity.MConf;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
+import net.knarcraft.factions.cmd.type.TypeMPermable;
+import net.knarcraft.factions.entity.MConf;
public abstract class CmdFactionsAccessSetXRadius extends CmdFactionsAccessSetX {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsChunkname.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsChunkname.java
index ff52bffb..5d9465e1 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsChunkname.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsChunkname.java
@@ -1,9 +1,5 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.TerritoryAccess;
-import net.knarcraft.factions.entity.BoardColl;
-import net.knarcraft.factions.entity.MPerm;
-import net.knarcraft.factions.util.AsciiMap;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.command.type.TypeNullable;
@@ -11,6 +7,10 @@ import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.TerritoryAccess;
+import net.knarcraft.factions.entity.BoardColl;
+import net.knarcraft.factions.entity.MPerm;
+import net.knarcraft.factions.util.AsciiMap;
public class CmdFactionsChunkname extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsClean.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsClean.java
index 30da8493..7e41845a 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsClean.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsClean.java
@@ -1,5 +1,9 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.collections.MassiveSet;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.store.EntityInternalMap;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Rel;
import net.knarcraft.factions.TerritoryAccess;
import net.knarcraft.factions.entity.Board;
@@ -10,11 +14,6 @@ import net.knarcraft.factions.entity.Invitation;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.MPlayerColl;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.collections.MassiveSet;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.store.EntityInternalMap;
-import com.massivecraft.massivecore.util.Txt;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -26,7 +25,7 @@ public class CmdFactionsClean extends FactionsCommand {
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
Object message;
int count;
@@ -54,9 +53,9 @@ public class CmdFactionsClean extends FactionsCommand {
int ret = 0;
for (MPlayer mplayer : MPlayerColl.get().getAll()) {
- if (!mplayer.isFactionOrphan()) {
- continue;
- }
+ if (!mplayer.isFactionOrphan()) {
+ continue;
+ }
mplayer.resetFactionData();
ret += 1;
@@ -70,9 +69,9 @@ public class CmdFactionsClean extends FactionsCommand {
for (Faction faction : FactionColl.get().getAll()) {
EntityInternalMap invitations = faction.getInvitations();
- if (invitations.isEmpty()) {
- continue;
- }
+ if (invitations.isEmpty()) {
+ continue;
+ }
ret += invitations.size();
Set invitationIds = new MassiveSet<>(invitations.keySet());
@@ -93,9 +92,9 @@ public class CmdFactionsClean extends FactionsCommand {
for (Iterator> iterator = faction.getRelationWishes().entrySet().iterator(); iterator.hasNext(); ) {
Entry entry = iterator.next();
String factionId = entry.getKey();
- if (FactionColl.get().containsId(factionId)) {
- continue;
- }
+ if (FactionColl.get().containsId(factionId)) {
+ continue;
+ }
iterator.remove();
ret += 1;
@@ -115,9 +114,9 @@ public class CmdFactionsClean extends FactionsCommand {
TerritoryAccess territoryAccess = entry.getValue();
String factionId = territoryAccess.getHostFactionId();
- if (FactionColl.get().containsId(factionId)) {
- continue;
- }
+ if (FactionColl.get().containsId(factionId)) {
+ continue;
+ }
board.removeAt(ps);
ret += 1;
@@ -137,9 +136,9 @@ public class CmdFactionsClean extends FactionsCommand {
boolean changed = false;
for (String grantedIds : territoryAccess.getGrantedIds()) {
- if (MPerm.idToMPermableOptional(grantedIds).isPresent()) {
- continue;
- }
+ if (MPerm.idToMPermableOptional(grantedIds).isPresent()) {
+ continue;
+ }
territoryAccess = territoryAccess.withGrantedId(grantedIds, false);
ret += 1;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsConfig.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsConfig.java
index fb1bef81..020c0f76 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsConfig.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsConfig.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
-import net.knarcraft.factions.entity.MConf;
import com.massivecraft.massivecore.command.editor.CommandEditSingleton;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
+import net.knarcraft.factions.Perm;
+import net.knarcraft.factions.entity.MConf;
public class CmdFactionsConfig extends CommandEditSingleton {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsCreate.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsCreate.java
index f040083f..927aebab 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsCreate.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsCreate.java
@@ -1,5 +1,8 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.mson.Mson;
+import com.massivecraft.massivecore.store.MStore;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.req.ReqHasntFaction;
import net.knarcraft.factions.cmd.type.TypeFactionNameStrict;
@@ -8,9 +11,6 @@ import net.knarcraft.factions.entity.FactionColl;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.event.EventFactionsCreate;
import net.knarcraft.factions.event.EventFactionsMembershipChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.mson.Mson;
-import com.massivecraft.massivecore.store.MStore;
import org.bukkit.ChatColor;
public class CmdFactionsCreate extends FactionsCommand {
@@ -44,9 +44,9 @@ public class CmdFactionsCreate extends FactionsCommand {
// Event
EventFactionsCreate createEvent = new EventFactionsCreate(sender, factionId, newName);
createEvent.run();
- if (createEvent.isCancelled()) {
- return;
- }
+ if (createEvent.isCancelled()) {
+ return;
+ }
// Apply
Faction faction = FactionColl.get().create(factionId);
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDescription.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDescription.java
index eb3d1546..3469348c 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDescription.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDescription.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeString;
+import com.massivecraft.massivecore.mixin.MixinDisplayName;
import net.knarcraft.factions.cmd.req.ReqHasFaction;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsDescriptionChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeString;
-import com.massivecraft.massivecore.mixin.MixinDisplayName;
public class CmdFactionsDescription extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDisband.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDisband.java
index 0550dd73..579880f2 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDisband.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDisband.java
@@ -1,5 +1,10 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeStringConfirmation;
+import com.massivecraft.massivecore.util.ConfirmationUtil;
+import com.massivecraft.massivecore.util.IdUtil;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.entity.Faction;
@@ -10,11 +15,6 @@ import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsDisband;
import net.knarcraft.factions.event.EventFactionsMembershipChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeStringConfirmation;
-import com.massivecraft.massivecore.util.ConfirmationUtil;
-import com.massivecraft.massivecore.util.IdUtil;
-import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsDisband extends FactionsCommand {
// -------------------------------------------- //
@@ -37,14 +37,14 @@ public class CmdFactionsDisband extends FactionsCommand {
Faction faction = this.readArg();
String confirmationString = this.readArg(null);
- if (MConf.get().requireConfirmationForFactionDisbanding) {
- ConfirmationUtil.tryConfirm(this);
- }
+ if (MConf.get().requireConfirmationForFactionDisbanding) {
+ ConfirmationUtil.tryConfirm(this);
+ }
// MPerm
- if (!MPerm.getPermDisband().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermDisband().has(msender, faction, true)) {
+ return;
+ }
// Verify
if (faction.getFlag(MFlag.getFlagPermanent())) {
@@ -54,9 +54,9 @@ public class CmdFactionsDisband extends FactionsCommand {
// Event
EventFactionsDisband event = new EventFactionsDisband(me, faction);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
// Merged Apply and Inform
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationFlags.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationFlags.java
index 97229b30..bbe58a82 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationFlags.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationFlags.java
@@ -1,9 +1,8 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MFlagColl;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.util.Txt;
import java.util.List;
import java.util.stream.Collectors;
@@ -22,7 +21,7 @@ public class CmdFactionsDocumentationFlags extends FactionsCommandDocumentation
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
msgDoc("Flags are a way to give certain factions certain attributes " +
" such as disabling pvp or enabling friendly fire.");
msgDoc("To see all the flags type:");
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationPerms.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationPerms.java
index 84b6cb62..9aba66f1 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationPerms.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationPerms.java
@@ -1,7 +1,5 @@
package net.knarcraft.factions.cmd;
-import com.massivecraft.massivecore.MassiveException;
-
public class CmdFactionsDocumentationPerms extends FactionsCommandDocumentation {
// -------------------------------------------- //
// CONSTRUCT
@@ -16,7 +14,7 @@ public class CmdFactionsDocumentationPerms extends FactionsCommandDocumentation
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
msgDoc("Permissions decide who can do what in your faction. " +
"Permissions can be given to a rank, a player, a relation, " +
"everyone in another faction or everyone with a specific rank in another faction.");
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationPower.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationPower.java
index 84006e55..8ff1058e 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationPower.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationPower.java
@@ -1,7 +1,6 @@
package net.knarcraft.factions.cmd;
import net.knarcraft.factions.entity.MConf;
-import com.massivecraft.massivecore.MassiveException;
public class CmdFactionsDocumentationPower extends FactionsCommandDocumentation {
// -------------------------------------------- //
@@ -17,7 +16,7 @@ public class CmdFactionsDocumentationPower extends FactionsCommandDocumentation
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
msgDoc("All players have an amount of power ranging from %.2f to %.2f.", MConf.get().powerMin, MConf.get().powerMax);
msgDoc("The power of a faction is equal to the combined power of all it's members.");
msgDoc("Your power is %.2f", msender.getPower());
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationRanks.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationRanks.java
index cf3a297d..cc495517 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationRanks.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationRanks.java
@@ -1,9 +1,8 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.entity.Rank;
import org.bukkit.ChatColor;
import java.util.Comparator;
@@ -24,7 +23,7 @@ public class CmdFactionsDocumentationRanks extends FactionsCommandDocumentation
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
msgDoc("Ranks divide the faction into groups.");
List ranks = msenderFaction.getRanks().getAll(Comparator.comparingInt(Rank::getPriority).reversed());
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationTax.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationTax.java
index 4f8c2f80..8e01af1c 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationTax.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationTax.java
@@ -1,12 +1,11 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.req.ReqTaxEnabled;
-import net.knarcraft.factions.entity.MConf;
-import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.cmd.req.ReqTaxEnabled;
+import net.knarcraft.factions.entity.MConf;
import java.util.LinkedHashMap;
@@ -24,7 +23,7 @@ public class CmdFactionsDocumentationTax extends FactionsCommandDocumentation {
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
LinkedHashMap timeUnitcounts = TimeDiffUtil.limit(TimeDiffUtil.unitcounts(MConf.get().taxTaskPeriodMillis, TimeUnit.getAll()), 3);
String periodString = TimeDiffUtil.formatedVerboose(timeUnitcounts);
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationWarps.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationWarps.java
index fe960907..7d7b5740 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationWarps.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsDocumentationWarps.java
@@ -3,7 +3,6 @@ package net.knarcraft.factions.cmd;
import net.knarcraft.factions.cmd.req.ReqFactionWarpsEnabled;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPerm;
-import com.massivecraft.massivecore.MassiveException;
import java.util.Set;
@@ -21,7 +20,7 @@ public class CmdFactionsDocumentationWarps extends FactionsCommandDocumentation
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
msgDoc("A faction can have warps which allows it's members to easily go to important places within the faction.");
if (MConf.get().warpsMax < 0) {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFaction.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFaction.java
index 6b5ac26e..5195cd99 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFaction.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFaction.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.event.EventFactionsFactionShowAsync;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.PriorityLines;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.event.EventFactionsFactionShowAsync;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlag.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlag.java
index 9d5802ae..497218df 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlag.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlag.java
@@ -5,8 +5,8 @@ public class CmdFactionsFlag extends FactionsCommand {
// FIELDS
// -------------------------------------------- //
- public CmdFactionsFlagList cmdFactionsFlagList = new CmdFactionsFlagList();
+ public final CmdFactionsFlagList cmdFactionsFlagList = new CmdFactionsFlagList();
public CmdFactionsFlagShow cmdFactionsFlagShow = new CmdFactionsFlagShow();
- public CmdFactionsFlagSet cmdFactionsFlagSet = new CmdFactionsFlagSet();
+ public final CmdFactionsFlagSet cmdFactionsFlagSet = new CmdFactionsFlagSet();
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagList.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagList.java
index fb1437d0..fe55bed3 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagList.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagList.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.entity.MFlag;
-import net.knarcraft.factions.entity.MFlagColl;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.entity.MFlag;
+import net.knarcraft.factions.entity.MFlagColl;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.Bukkit;
import java.util.List;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagSet.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagSet.java
index cf6bf7ea..4428a4a8 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagSet.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagSet.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeMFlag;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.event.EventFactionsFlagChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
public class CmdFactionsFlagSet extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagShow.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagShow.java
index 22967b8c..4e3a5dd0 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagShow.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFlagShow.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MFlag;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MFlag;
import java.util.List;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFly.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFly.java
index c5bd7d67..0fe53df1 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFly.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsFly.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.engine.EngineFly;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.MassiveCommandToggle;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.engine.EngineMassiveCorePlayerUpdate;
import com.massivecraft.massivecore.ps.PS;
+import net.knarcraft.factions.engine.EngineFly;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.entity.Player;
public class CmdFactionsFly extends MassiveCommandToggle {
@@ -14,7 +14,7 @@ public class CmdFactionsFly extends MassiveCommandToggle {
// INSTANCE
// -------------------------------------------- //
- private static CmdFactionsFly i = new CmdFactionsFly();
+ private static final CmdFactionsFly i = new CmdFactionsFly();
public static CmdFactionsFly get() {
return i;
@@ -38,21 +38,21 @@ public class CmdFactionsFly extends MassiveCommandToggle {
}
@Override
- public boolean getValue() throws MassiveException {
+ public boolean getValue() {
return MPlayer.get(sender).isFlying();
}
public void setValue(boolean value) throws MassiveException {
MPlayer mplayer = MPlayer.get(sender);
Player player = me;
- if (player == null) {
- throw new MassiveException().addMsg("Could not find player.");
- }
+ if (player == null) {
+ throw new MassiveException().addMsg("Could not find player.");
+ }
PS ps = PS.valueOf(player);
- if (value) {
- EngineFly.canFlyInTerritoryOrThrow(mplayer, ps);
- }
+ if (value) {
+ EngineFly.canFlyInTerritoryOrThrow(mplayer, ps);
+ }
mplayer.setFlying(value);
EngineMassiveCorePlayerUpdate.update(player, false);
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsHome.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsHome.java
index 2daee424..2e2d51a6 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsHome.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsHome.java
@@ -1,11 +1,10 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.MConf;
-import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Visibility;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.MConf;
import java.util.List;
@@ -31,7 +30,7 @@ public class CmdFactionsHome extends FactionsCommandWarp {
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
List args = MUtil.list(MConf.get().warpsHomeName, this.argAt(0));
CmdFactions.get().cmdFactionsWarp.cmdFactionsWarpGo.execute(me, args);
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInvite.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInvite.java
index ad287ce5..b83b9e73 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInvite.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInvite.java
@@ -6,7 +6,7 @@ public class CmdFactionsInvite extends FactionsCommand {
// -------------------------------------------- //
public CmdFactionsInviteList cmdFactionsInviteList = new CmdFactionsInviteList();
- public CmdFactionsInviteAdd cmdFactionsInviteAdd = new CmdFactionsInviteAdd();
- public CmdFactionsInviteRemove cmdFactionsInviteRemove = new CmdFactionsInviteRemove();
+ public final CmdFactionsInviteAdd cmdFactionsInviteAdd = new CmdFactionsInviteAdd();
+ public final CmdFactionsInviteRemove cmdFactionsInviteRemove = new CmdFactionsInviteRemove();
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteAdd.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteAdd.java
index 0bebb44c..38416f00 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteAdd.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteAdd.java
@@ -1,15 +1,15 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeMPlayer;
-import net.knarcraft.factions.entity.Invitation;
-import net.knarcraft.factions.entity.MPerm;
-import net.knarcraft.factions.entity.MPlayer;
-import net.knarcraft.factions.event.EventFactionsInvitedChange;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.container.TypeSet;
import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.cmd.type.TypeMPlayer;
+import net.knarcraft.factions.entity.Invitation;
+import net.knarcraft.factions.entity.MPerm;
+import net.knarcraft.factions.entity.MPlayer;
+import net.knarcraft.factions.event.EventFactionsInvitedChange;
import org.bukkit.ChatColor;
import java.util.Collection;
@@ -37,9 +37,9 @@ public class CmdFactionsInviteAdd extends FactionsCommand {
long creationMillis = System.currentTimeMillis();
// MPerm
- if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
+ return;
+ }
for (MPlayer mplayer : mplayers) {
// Already member?
@@ -55,9 +55,9 @@ public class CmdFactionsInviteAdd extends FactionsCommand {
// Event
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, msenderFaction, isInvited);
event.run();
- if (event.isCancelled()) {
- continue;
- }
+ if (event.isCancelled()) {
+ continue;
+ }
isInvited = event.isNewInvited();
// Inform
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteList.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteList.java
index 594aea61..79230a30 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteList.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteList.java
@@ -1,10 +1,5 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.Invitation;
-import net.knarcraft.factions.entity.MPerm;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.command.Parameter;
@@ -15,6 +10,11 @@ import com.massivecraft.massivecore.pager.Stringifier;
import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Perm;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.Invitation;
+import net.knarcraft.factions.entity.MPerm;
import java.util.LinkedHashMap;
import java.util.List;
@@ -42,14 +42,14 @@ public class CmdFactionsInviteList extends FactionsCommand {
Faction faction = this.readArg(msenderFaction);
- if (faction != msenderFaction && !Perm.INVITE_LIST_OTHER.has(sender, true)) {
- return;
- }
+ if (faction != msenderFaction && !Perm.INVITE_LIST_OTHER.has(sender, true)) {
+ return;
+ }
// MPerm
- if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
+ return;
+ }
// Pager Create
final List> invitations = new MassiveList<>(faction.getInvitations().entrySet());
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteRemove.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteRemove.java
index 1eda9229..5f25cd00 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteRemove.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsInviteRemove.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeMPlayer;
-import net.knarcraft.factions.entity.MPerm;
-import net.knarcraft.factions.entity.MPlayer;
-import net.knarcraft.factions.event.EventFactionsInvitedChange;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.container.TypeSet;
import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.cmd.type.TypeMPlayer;
+import net.knarcraft.factions.entity.MPerm;
+import net.knarcraft.factions.entity.MPlayer;
+import net.knarcraft.factions.event.EventFactionsInvitedChange;
import org.bukkit.ChatColor;
import java.util.ArrayList;
@@ -50,9 +50,9 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
}
// MPerm
- if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
+ return;
+ }
for (MPlayer mplayer : mplayers) {
// Already member?
@@ -63,7 +63,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
Mson kick = Mson.mson(
mson("You might want to kick him. ").color(ChatColor.YELLOW),
- mson(ChatColor.RED.toString() + tooltip).tooltip(ChatColor.YELLOW.toString() + tooltip).suggest(command)
+ mson(ChatColor.RED + tooltip).tooltip(ChatColor.YELLOW + tooltip).suggest(command)
);
// Inform
@@ -79,9 +79,9 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
// Event
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, msenderFaction, isInvited);
event.run();
- if (event.isCancelled()) {
- continue;
- }
+ if (event.isCancelled()) {
+ continue;
+ }
isInvited = event.isNewInvited();
// Inform Player
@@ -96,9 +96,9 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
msenderFaction.uninvite(mplayer);
// If all, we do this at last. So we only do it once.
- if (!all) {
- msenderFaction.changed();
- }
+ if (!all) {
+ msenderFaction.changed();
+ }
} else {
// Mson
String command = CmdFactions.get().cmdFactionsInvite.cmdFactionsInviteAdd.getCommandLine(mplayer.getName());
@@ -106,7 +106,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
Mson invite = Mson.mson(
mson("You might want to invite him. ").color(ChatColor.YELLOW),
- mson(ChatColor.GREEN.toString() + tooltip).tooltip(ChatColor.YELLOW.toString() + tooltip).suggest(command)
+ mson(ChatColor.GREEN + tooltip).tooltip(ChatColor.YELLOW + tooltip).suggest(command)
);
// Inform
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsJoin.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsJoin.java
index 550ee076..c3909b41 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsJoin.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsJoin.java
@@ -1,5 +1,8 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.mson.Mson;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.Perm;
import net.knarcraft.factions.cmd.type.TypeFaction;
@@ -9,9 +12,6 @@ import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsMembershipChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.mson.Mson;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsJoin extends FactionsCommand {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsKick.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsKick.java
index 1539cce2..65234d40 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsKick.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsKick.java
@@ -1,5 +1,7 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.util.IdUtil;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.type.TypeMPlayer;
import net.knarcraft.factions.entity.Faction;
@@ -8,8 +10,6 @@ import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsMembershipChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.util.IdUtil;
import org.bukkit.ChatColor;
public class CmdFactionsKick extends FactionsCommand {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsList.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsList.java
index 60831648..ad4d1d5b 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsList.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsList.java
@@ -1,15 +1,15 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.comparator.ComparatorFactionList;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.FactionColl;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.comparator.ComparatorFactionList;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.FactionColl;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMap.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMap.java
index 2ffb4236..bb161da3 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMap.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMap.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.util.AsciiMap;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.util.AsciiMap;
public class CmdFactionsMap extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyBalance.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyBalance.java
index 7c08d9fe..50d142e0 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyBalance.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyBalance.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
import net.knarcraft.factions.Perm;
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.integration.Econ;
-import com.massivecraft.massivecore.MassiveException;
public class CmdFactionsMoneyBalance extends FactionsCommand {
// -------------------------------------------- //
@@ -28,9 +28,9 @@ public class CmdFactionsMoneyBalance extends FactionsCommand {
public void perform() throws MassiveException {
Faction faction = this.readArg(msenderFaction);
- if (faction != msenderFaction && !Perm.MONEY_BALANCE_ANY.has(sender, true)) {
- return;
- }
+ if (faction != msenderFaction && !Perm.MONEY_BALANCE_ANY.has(sender, true)) {
+ return;
+ }
Econ.sendBalanceInfo(msender, faction);
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyDeposit.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyDeposit.java
index 6c75014c..fb3fec65 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyDeposit.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyDeposit.java
@@ -1,15 +1,15 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
+import com.massivecraft.massivecore.money.Money;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.integration.Econ;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
-import com.massivecraft.massivecore.money.Money;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyDeposit extends FactionsCommand {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferF2f.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferF2f.java
index 69e3db47..a6c70b24 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferF2f.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferF2f.java
@@ -1,15 +1,15 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
+import com.massivecraft.massivecore.money.Money;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.integration.Econ;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
-import com.massivecraft.massivecore.money.Money;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferF2f extends FactionsCommand {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferF2p.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferF2p.java
index efd46c5e..25261293 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferF2p.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferF2p.java
@@ -1,5 +1,9 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
+import com.massivecraft.massivecore.money.Money;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
import net.knarcraft.factions.cmd.type.TypeFaction;
@@ -8,10 +12,6 @@ import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.integration.Econ;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
-import com.massivecraft.massivecore.money.Money;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferF2p extends FactionsCommand {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferP2f.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferP2f.java
index f7c21d4e..db7059b5 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferP2f.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyTransferP2f.java
@@ -1,5 +1,9 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
+import com.massivecraft.massivecore.money.Money;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
import net.knarcraft.factions.cmd.type.TypeFaction;
@@ -8,10 +12,6 @@ import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.integration.Econ;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
-import com.massivecraft.massivecore.money.Money;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferP2f extends FactionsCommand {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyWithdraw.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyWithdraw.java
index f116aad9..2e790583 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyWithdraw.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyWithdraw.java
@@ -1,5 +1,9 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
+import com.massivecraft.massivecore.money.Money;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.req.ReqBankCommandsEnabled;
import net.knarcraft.factions.cmd.type.TypeFaction;
@@ -7,10 +11,6 @@ import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.integration.Econ;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
-import com.massivecraft.massivecore.money.Money;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyWithdraw extends FactionsCommand {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyconvert.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyconvert.java
index a4e5a55e..a4c592a4 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyconvert.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMoneyconvert.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.FactionColl;
-import net.knarcraft.factions.entity.MConf;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Visibility;
import com.massivecraft.massivecore.command.type.primitive.TypeStringConfirmation;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.util.ConfirmationUtil;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.FactionColl;
+import net.knarcraft.factions.entity.MConf;
public class CmdFactionsMoneyconvert extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMotd.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMotd.java
index 4ba82840..192fa59c 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMotd.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsMotd.java
@@ -1,14 +1,14 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.entity.MPerm;
-import net.knarcraft.factions.entity.MPlayer;
-import net.knarcraft.factions.event.EventFactionsMotdChange;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.TypeNullable;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.mixin.MixinDisplayName;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.entity.MPerm;
+import net.knarcraft.factions.entity.MPlayer;
+import net.knarcraft.factions.event.EventFactionsMotdChange;
public class CmdFactionsMotd extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsName.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsName.java
index 65eb50c8..5fdaa8d6 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsName.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsName.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeFactionNameLenient;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.event.EventFactionsNameChange;
-import com.massivecraft.massivecore.MassiveException;
public class CmdFactionsName extends FactionsCommand {
// -------------------------------------------- //
@@ -29,16 +29,16 @@ public class CmdFactionsName extends FactionsCommand {
Faction faction = this.readArg(msenderFaction);
// MPerm
- if (!MPerm.getPermName().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermName().has(msender, faction, true)) {
+ return;
+ }
// Event
EventFactionsNameChange event = new EventFactionsNameChange(sender, faction, newName);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
newName = event.getNewName();
// Apply
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsOverride.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsOverride.java
index 8e645cb5..46a99e39 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsOverride.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsOverride.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Factions;
public class CmdFactionsOverride extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPerm.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPerm.java
index 0c56683d..93f98a72 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPerm.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPerm.java
@@ -5,10 +5,10 @@ public class CmdFactionsPerm extends FactionsCommand {
// FIELDS
// -------------------------------------------- //
- CmdFactionsPermList cmdFactionsPermList = new CmdFactionsPermList();
- CmdFactionsPermShow cmdFactionsPermShow = new CmdFactionsPermShow();
- CmdFactionsPermView cmdFactionsPermView = new CmdFactionsPermView();
- CmdFactionsPermViewall cmdFactionsPermViewall = new CmdFactionsPermViewall();
- CmdFactionsPermSet cmdFactionsPermSet = new CmdFactionsPermSet();
+ final CmdFactionsPermList cmdFactionsPermList = new CmdFactionsPermList();
+ final CmdFactionsPermShow cmdFactionsPermShow = new CmdFactionsPermShow();
+ final CmdFactionsPermView cmdFactionsPermView = new CmdFactionsPermView();
+ final CmdFactionsPermViewall cmdFactionsPermViewall = new CmdFactionsPermViewall();
+ final CmdFactionsPermSet cmdFactionsPermSet = new CmdFactionsPermSet();
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermList.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermList.java
index a1eb15c1..7bca15f5 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermList.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermList.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.entity.MPerm;
-import net.knarcraft.factions.entity.MPermColl;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.entity.MPerm;
+import net.knarcraft.factions.entity.MPermColl;
import org.bukkit.Bukkit;
import java.util.List;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermSet.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermSet.java
index 1e305391..d4568e7e 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermSet.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermSet.java
@@ -1,5 +1,8 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeMPerm;
import net.knarcraft.factions.cmd.type.TypeMPermable;
@@ -7,9 +10,6 @@ import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.event.EventFactionsPermChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
-import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsPermSet extends FactionsCommand {
// -------------------------------------------- //
@@ -38,9 +38,9 @@ public class CmdFactionsPermSet extends FactionsCommand {
MPerm.MPermable permable = TypeMPermable.get(faction).read(this.argAt(1), sender);
// Do the sender have the right to change perms for this faction?
- if (!MPerm.getPermPerms().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermPerms().has(msender, faction, true)) {
+ return;
+ }
// Is this perm editable?
if (!msender.isOverriding() && !perm.isEditable()) {
@@ -54,9 +54,9 @@ public class CmdFactionsPermSet extends FactionsCommand {
// Event
EventFactionsPermChange event = new EventFactionsPermChange(sender, faction, perm, permable, value);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
value = event.getNewValue();
// Apply
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermShow.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermShow.java
index 9c695aa3..ff363dc6 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermShow.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermShow.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.collections.MassiveList;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeMPerm;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.collections.MassiveList;
-import com.massivecraft.massivecore.util.Txt;
import java.util.Collection;
import java.util.List;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermView.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermView.java
index d4f88a49..42cc0e5b 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermView.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermView.java
@@ -1,16 +1,16 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.collections.MassiveList;
+import com.massivecraft.massivecore.mson.Mson;
+import com.massivecraft.massivecore.util.MUtil;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeMPermable;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.collections.MassiveList;
-import com.massivecraft.massivecore.mson.Mson;
-import com.massivecraft.massivecore.util.MUtil;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
import java.util.List;
@@ -45,9 +45,9 @@ public class CmdFactionsPermView extends FactionsCommand {
List perms = new MassiveList<>();
for (MPerm mperm : MPerm.getAll()) {
- if (faction.isPermitted(permable.getId(), mperm.getId())) {
- perms.add(mperm);
- }
+ if (faction.isPermitted(permable.getId(), mperm.getId())) {
+ perms.add(mperm);
+ }
}
if (perms.isEmpty()) {
@@ -60,31 +60,28 @@ public class CmdFactionsPermView extends FactionsCommand {
String permissionSingularPlural = permNames.size() == 1 ? "permission" : "permissions";
msg("In %s %s specifically has the %s: %s.", faction.describeTo(msender), permable.getDisplayName(sender), permissionSingularPlural, names);
}
- if (permable instanceof MPlayer) {
- MPlayer mplayer = (MPlayer) permable;
+ if (permable instanceof MPlayer mplayer) {
msg("They may have other permissions through their faction membership, rank or relation to %s.", faction.describeTo(msender));
List msons = new MassiveList<>();
- if (mplayer.getFaction() != faction) {
- msons.add(Mson.parse("[faction]").command(this, mplayer.getFaction().getName(), faction.getName()));
- }
+ if (mplayer.getFaction() != faction) {
+ msons.add(Mson.parse("[faction]").command(this, mplayer.getFaction().getName(), faction.getName()));
+ }
msons.add(Mson.parse("[rank]").command(this, mplayer.getFaction().getName() + "-" + mplayer.getRank().getName(), faction.getName()));
- if (mplayer.getFaction() != faction) {
- msons.add(Mson.parse("[relation]").command(this, faction.getRelationTo(mplayer).toString(), faction.getName()));
- }
+ if (mplayer.getFaction() != faction) {
+ msons.add(Mson.parse("[relation]").command(this, faction.getRelationTo(mplayer).toString(), faction.getName()));
+ }
Mson msons2 = Mson.implode(msons, Mson.SPACE);
message(mson(mson("Commands: ").color(ChatColor.YELLOW), msons2));
}
- if (permable instanceof Faction) {
- Faction faction1 = (Faction) permable;
+ if (permable instanceof Faction faction1) {
msg("They may have other permissions through their relation to %s.", faction.describeTo(msender));
Mson msonRelation = Mson.parse("[relation]").command(this, faction.getRelationTo(faction1).toString(), faction.getName());
Mson msons = Mson.implode(MUtil.list(msonRelation), Mson.SPACE);
message(mson(mson("Commands: ").color(ChatColor.YELLOW), msons));
}
- if (permable instanceof Rank && !faction.hasRank((Rank) permable)) {
- Rank rank = (Rank) permable;
+ if (permable instanceof Rank rank && !faction.hasRank((Rank) permable)) {
msg("They may have other permissions thorugh their faction membership or relation to %s.", faction.describeTo(msender));
Mson msonFaction = Mson.parse("[faction]").command(this, rank.getFaction().getName(), faction.getName());
Mson msonRelation = Mson.parse("[relation]").command(this, faction.getRelationTo(rank.getFaction()).toString(), faction.getName());
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermViewall.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermViewall.java
index aa912e16..a20fe631 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermViewall.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPermViewall.java
@@ -1,14 +1,14 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.collections.MassiveList;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeMPermable;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.collections.MassiveList;
-import com.massivecraft.massivecore.util.Txt;
import java.util.List;
import java.util.stream.Collectors;
@@ -44,18 +44,15 @@ public class CmdFactionsPermViewall extends FactionsCommand {
List permables = new MassiveList<>();
permables.add(permable);
- if (permable instanceof MPlayer) {
- MPlayer mplayer = (MPlayer) permable;
+ if (permable instanceof MPlayer mplayer) {
permables.add(mplayer.getFaction());
permables.add(mplayer.getRank());
permables.add(faction.getRelationTo(mplayer));
}
- if (permable instanceof Faction) {
- Faction faction1 = (Faction) permable;
+ if (permable instanceof Faction faction1) {
permables.add(faction.getRelationTo(faction1));
}
- if (permable instanceof Rank && !faction.hasRank((Rank) permable)) {
- Rank rank = (Rank) permable;
+ if (permable instanceof Rank rank && !faction.hasRank((Rank) permable)) {
Faction faction1 = rank.getFaction();
permables.add(faction1);
permables.add(faction.getRelationTo(faction1));
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPlayer.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPlayer.java
index 2ccc6066..39befec5 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPlayer.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPlayer.java
@@ -1,14 +1,14 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeMPlayer;
-import net.knarcraft.factions.entity.MConf;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Progressbar;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerCleanInactivityToleranceMillis;
import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.cmd.type.TypeMPlayer;
+import net.knarcraft.factions.entity.MConf;
+import net.knarcraft.factions.entity.MPlayer;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPowerboost.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPowerboost.java
index 9020cdfe..56176dec 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPowerboost.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPowerboost.java
@@ -5,8 +5,8 @@ public class CmdFactionsPowerboost extends FactionsCommand {
// FIELDS
// -------------------------------------------- //
- public CmdFactionsPowerboostPlayer cmdFactionsPowerBoostPlayer = new CmdFactionsPowerboostPlayer();
- public CmdFactionsPowerboostFaction cmdFactionsPowerBoostFaction = new CmdFactionsPowerboostFaction();
+ public final CmdFactionsPowerboostPlayer cmdFactionsPowerBoostPlayer = new CmdFactionsPowerboostPlayer();
+ public final CmdFactionsPowerboostFaction cmdFactionsPowerBoostFaction = new CmdFactionsPowerboostFaction();
// -------------------------------------------- //
// CONSTRUCT
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPowerboostAbstract.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPowerboostAbstract.java
index 1c556e5c..fab065ea 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPowerboostAbstract.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsPowerboostAbstract.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.FactionsParticipator;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.Type;
import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.FactionsParticipator;
public abstract class CmdFactionsPowerboostAbstract extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRank.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRank.java
index d40b6646..9c2c3aaa 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRank.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRank.java
@@ -5,7 +5,7 @@ public class CmdFactionsRank extends FactionsCommand {
// FIELDS
// -------------------------------------------- //
- public CmdFactionsRankSet cmdFactionsRankSet = new CmdFactionsRankSet();
+ public final CmdFactionsRankSet cmdFactionsRankSet = new CmdFactionsRankSet();
public CmdFactionsRankShow cmdFactionsRankShow = new CmdFactionsRankShow();
public CmdFactionsRankList cmdFactionsRankList = new CmdFactionsRankList();
public CmdFactionsRankEdit cmdFactionsRankEdit = new CmdFactionsRankEdit();
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEdit.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEdit.java
index 92bdd101..64c85cc5 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEdit.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEdit.java
@@ -1,8 +1,8 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.MassiveException;
public class CmdFactionsRankEdit extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditCreate.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditCreate.java
index 0b76b10e..5465e6ba 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditCreate.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditCreate.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.Rank;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.command.type.primitive.TypeStringParsed;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.Rank;
import java.util.Collection;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditDelete.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditDelete.java
index 1140186b..cef2cc1c 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditDelete.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditDelete.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeString;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeRank;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeString;
-import com.massivecraft.massivecore.util.Txt;
import java.util.Collection;
import java.util.List;
@@ -34,7 +34,7 @@ public class CmdFactionsRankEditDelete extends FactionsCommand {
Faction faction = this.readArgAt(1, msenderFaction);
// Rank if any passed.
- TypeRank typeRank = new TypeRank(faction);
+ TypeRank typeRank = TypeRank.get(faction, null);
Rank rank = typeRank.read(this.argAt(0), sender);
CmdFactionsRankEdit.ensureAllowed(msender, faction, "delete");
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditName.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditName.java
index f5aaa5c7..05b4e4cb 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditName.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditName.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeString;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeRank;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeString;
import java.util.Collection;
@@ -32,7 +32,7 @@ public class CmdFactionsRankEditName extends FactionsCommand {
Faction faction = this.readArgAt(2, msenderFaction);
// Rank if any passed.
- TypeRank typeRank = new TypeRank(faction);
+ TypeRank typeRank = TypeRank.get(faction, null);
Rank rank = typeRank.read(this.argAt(0), sender);
// Args
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditPrefix.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditPrefix.java
index 2b3c42b0..cadf6cf9 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditPrefix.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditPrefix.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeString;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeRank;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeString;
public class CmdFactionsRankEditPrefix extends FactionsCommand {
// -------------------------------------------- //
@@ -30,7 +30,7 @@ public class CmdFactionsRankEditPrefix extends FactionsCommand {
Faction faction = this.readArgAt(2, msenderFaction);
// Rank if any passed.
- TypeRank typeRank = new TypeRank(faction);
+ TypeRank typeRank = TypeRank.get(faction, null);
Rank rank = typeRank.read(this.argAt(0), sender);
// Args
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditPriority.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditPriority.java
index 4f169edb..4663de2f 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditPriority.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankEditPriority.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeRank;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
import java.util.Collection;
@@ -32,7 +32,7 @@ public class CmdFactionsRankEditPriority extends FactionsCommand {
Faction faction = this.readArgAt(2, msenderFaction);
// Rank if any passed.
- TypeRank typeRank = new TypeRank(faction);
+ TypeRank typeRank = TypeRank.get(faction, null);
Rank rank = typeRank.read(this.argAt(0), sender);
CmdFactionsRankEdit.ensureAllowed(msender, faction, "edit");
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankList.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankList.java
index 2cdbe718..dd974069 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankList.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankList.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.Rank;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.Rank;
import java.util.Comparator;
import java.util.List;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankOld.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankOld.java
index 3798eb63..33f8463d 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankOld.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankOld.java
@@ -1,8 +1,8 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeMPlayer;
import com.massivecraft.massivecore.command.Visibility;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.cmd.type.TypeMPlayer;
public class CmdFactionsRankOld extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankSet.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankSet.java
index ebb71f23..6314ffa6 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankSet.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankSet.java
@@ -1,5 +1,8 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.collections.MassiveSet;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeMPlayer;
@@ -13,9 +16,6 @@ import net.knarcraft.factions.entity.MPlayerColl;
import net.knarcraft.factions.entity.Rank;
import net.knarcraft.factions.event.EventFactionsMembershipChange;
import net.knarcraft.factions.event.EventFactionsRankChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.collections.MassiveSet;
-import com.massivecraft.massivecore.util.Txt;
import java.util.HashSet;
import java.util.Set;
@@ -75,9 +75,9 @@ public class CmdFactionsRankSet extends FactionsCommand {
// Event
EventFactionsRankChange event = new EventFactionsRankChange(sender, target, rank);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
rank = event.getNewRank();
// Change the rank.
@@ -135,9 +135,9 @@ public class CmdFactionsRankSet extends FactionsCommand {
private void ensureAllowed() throws MassiveException {
// People with permission don't follow the normal rules.
- if (msender.isOverriding()) {
- return;
- }
+ if (msender.isOverriding()) {
+ return;
+ }
// If somone gets the leadership of wilderness (Which has happened before).
// We can at least try to limit their powers.
@@ -204,9 +204,9 @@ public class CmdFactionsRankSet extends FactionsCommand {
// Event
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, msender, endFaction, EventFactionsMembershipChange.MembershipChangeReason.RANK);
membershipChangeEvent.run();
- if (membershipChangeEvent.isCancelled()) {
- throw new MassiveException();
- }
+ if (membershipChangeEvent.isCancelled()) {
+ throw new MassiveException();
+ }
// Apply
target.resetFactionData();
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankShow.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankShow.java
index ee703c70..5f855f63 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankShow.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRankShow.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.cmd.type.TypeMPlayer;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsRankShow extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelation.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelation.java
index 20922eb9..4f528065 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelation.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelation.java
@@ -5,7 +5,7 @@ public class CmdFactionsRelation extends FactionsCommand {
// FIELDS
// -------------------------------------------- //
- public CmdFactionsRelationSet cmdFactionsRelationSet = new CmdFactionsRelationSet();
+ public final CmdFactionsRelationSet cmdFactionsRelationSet = new CmdFactionsRelationSet();
public CmdFactionsRelationList cmdFactionsRelationList = new CmdFactionsRelationList();
public CmdFactionsRelationWishes cmdFactionsRelationWishes = new CmdFactionsRelationWishes();
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationList.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationList.java
index bd563151..673084f2 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationList.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationList.java
@@ -1,11 +1,5 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.Rel;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.cmd.type.TypeRelation;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.FactionColl;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveSet;
@@ -14,6 +8,12 @@ import com.massivecraft.massivecore.command.type.container.TypeSet;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.Rel;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.cmd.type.TypeRelation;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.FactionColl;
import org.bukkit.Bukkit;
import java.util.List;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationOld.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationOld.java
index f7e446d8..9d576a04 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationOld.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationOld.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.Faction;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Visibility;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.Faction;
public class CmdFactionsRelationOld extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationSet.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationSet.java
index 2af42866..0debc486 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationSet.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationSet.java
@@ -1,5 +1,8 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.MassiveCommand;
+import com.massivecraft.massivecore.mson.Mson;
import net.knarcraft.factions.Rel;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeRelation;
@@ -7,9 +10,6 @@ import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.event.EventFactionsRelationChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.MassiveCommand;
-import com.massivecraft.massivecore.mson.Mson;
import org.bukkit.ChatColor;
public class CmdFactionsRelationSet extends FactionsCommand {
@@ -34,9 +34,9 @@ public class CmdFactionsRelationSet extends FactionsCommand {
Rel newRelation = this.readArg();
// MPerm
- if (!MPerm.getPermRel().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermRel().has(msender, msenderFaction, true)) {
+ return;
+ }
// Verify
if (otherFaction == msenderFaction) {
@@ -49,9 +49,9 @@ public class CmdFactionsRelationSet extends FactionsCommand {
// Event
EventFactionsRelationChange event = new EventFactionsRelationChange(sender, msenderFaction, otherFaction, newRelation);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
newRelation = event.getNewRelation();
// try to set the new relation
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationWishes.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationWishes.java
index 40ca126e..0a765a09 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationWishes.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsRelationWishes.java
@@ -1,10 +1,5 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.Rel;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.FactionColl;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.command.Parameter;
@@ -12,6 +7,11 @@ import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.Rel;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.FactionColl;
import org.bukkit.Bukkit;
import java.util.Map;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSeeChunkOld.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSeeChunkOld.java
index b75b0de1..e10edccd 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSeeChunkOld.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSeeChunkOld.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.util.AsciiMap;
-import net.knarcraft.factions.util.VisualizeUtil;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
+import net.knarcraft.factions.util.AsciiMap;
+import net.knarcraft.factions.util.VisualizeUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@@ -56,7 +56,7 @@ public class CmdFactionsSeeChunkOld extends FactionsCommand {
showPillar(me, world, blockX, blockZ);
// Inform
- boolean showCoords = AsciiMap.showChunkCoords(chunk);
+ boolean showCoords = AsciiMap.showChunkCoordinates(chunk);
String chunkDesc = showCoords ? chunk.toString(PSFormatHumanSpace.get()) : "chunk";
msg("Visualized %s", chunkDesc);
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetAll.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetAll.java
index 0fa1429b..134f26f8 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetAll.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetAll.java
@@ -1,14 +1,14 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
-import net.knarcraft.factions.entity.Board;
-import net.knarcraft.factions.entity.BoardColl;
-import net.knarcraft.factions.entity.Faction;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.mixin.MixinWorld;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.Perm;
+import net.knarcraft.factions.entity.Board;
+import net.knarcraft.factions.entity.BoardColl;
+import net.knarcraft.factions.entity.Faction;
import java.util.Collections;
import java.util.List;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetAuto.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetAuto.java
index 1c1fdc2b..d556b91e 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetAuto.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetAuto.java
@@ -1,14 +1,14 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
+import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
+import com.massivecraft.massivecore.ps.PS;
import net.knarcraft.factions.Perm;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.FactionColl;
import net.knarcraft.factions.entity.MPerm;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
-import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
-import com.massivecraft.massivecore.ps.PS;
import java.util.Collections;
import java.util.Set;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetCircle.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetCircle.java
index 8bbb770b..d360ea1f 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetCircle.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetCircle.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.ChunkUtil;
+import net.knarcraft.factions.Perm;
import java.util.Set;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetFill.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetFill.java
index cef30c27..3a8051e4 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetFill.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetFill.java
@@ -1,14 +1,13 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
-import net.knarcraft.factions.entity.BoardColl;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MConf;
-import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.ChunkUtil;
+import net.knarcraft.factions.Perm;
+import net.knarcraft.factions.entity.BoardColl;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MConf;
import java.util.Set;
import java.util.function.Predicate;
@@ -41,7 +40,7 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple {
// -------------------------------------------- //
@Override
- public Set getChunks() throws MassiveException {
+ public Set getChunks() {
// Common Startup
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetOne.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetOne.java
index 7409965b..c40c4112 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetOne.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetOne.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
+import net.knarcraft.factions.Perm;
import java.util.Collections;
import java.util.Set;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetSquare.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetSquare.java
index 9019d69b..b1ae715f 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetSquare.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetSquare.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Perm;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.ChunkUtil;
+import net.knarcraft.factions.Perm;
import java.util.Set;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetX.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetX.java
index 85642a8d..8f8d0be6 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetX.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetX.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.FactionColl;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.ps.PS;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.FactionColl;
import java.util.Set;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetXAll.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetXAll.java
index d6196043..0aab8116 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetXAll.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetXAll.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.Faction;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.Faction;
public abstract class CmdFactionsSetXAll extends CmdFactionsSetX {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetXRadius.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetXRadius.java
index 5835229e..cbcc7ab5 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetXRadius.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetXRadius.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.MConf;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.primitive.TypeInteger;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.MConf;
public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSethome.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSethome.java
index b27fdafe..1110e6a5 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSethome.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSethome.java
@@ -1,11 +1,10 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.MConf;
-import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Visibility;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.MConf;
import java.util.List;
@@ -30,7 +29,7 @@ public class CmdFactionsSethome extends FactionsCommandWarp {
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
List args = MUtil.list(MConf.get().warpsHomeName, this.argAt(0));
CmdFactions.get().cmdFactionsWarp.cmdFactionWarpAdd.execute(me, args);
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetpower.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetpower.java
index 807883f9..6bbd2f4f 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetpower.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsSetpower.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
+import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
import net.knarcraft.factions.Perm;
import net.knarcraft.factions.cmd.type.TypeMPlayer;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsPowerChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
-import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
public class CmdFactionsSetpower extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsStatus.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsStatus.java
index 9d563b39..c696ffe9 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsStatus.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsStatus.java
@@ -1,10 +1,5 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.cmd.type.TypeSortMPlayer;
-import net.knarcraft.factions.comparator.ComparatorMPlayerInactivity;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
@@ -12,6 +7,11 @@ import com.massivecraft.massivecore.pager.Stringifier;
import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.cmd.type.TypeSortMPlayer;
+import net.knarcraft.factions.comparator.ComparatorMPlayerInactivity;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MPlayer;
import java.util.Comparator;
import java.util.LinkedHashMap;
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxFaction.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxFaction.java
index 3f28a304..566b2350 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxFaction.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxFaction.java
@@ -1,14 +1,14 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.mson.Mson;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.cmd.req.ReqTaxEnabled;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.mson.Mson;
-import com.massivecraft.massivecore.util.Txt;
import java.util.Map.Entry;
@@ -51,21 +51,21 @@ public class CmdFactionsTaxFaction extends FactionsCommand {
MPlayer mplayer = MPlayer.get(id);
String name;
- if (Faction.IDENTIFIER_TAX_BASE.equals(id)) {
- name = "Default";
- } else if (rank != null) {
- name = rank.getName();
- } else if (mplayer != null) {
- name = mplayer.getDisplayName(msender);
- } else {
- continue;
- }
+ if (Faction.IDENTIFIER_TAX_BASE.equals(id)) {
+ name = "Default";
+ } else if (rank != null) {
+ name = rank.getName();
+ } else if (mplayer != null) {
+ name = mplayer.getDisplayName(msender);
+ } else {
+ continue;
+ }
anyTax = true;
msg("%s: %.2f", name, tax);
}
- if (!anyTax) {
- msg("No players in this faction pays taxes.");
- }
+ if (!anyTax) {
+ msg("No players in this faction pays taxes.");
+ }
}
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxPlayer.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxPlayer.java
index 892c05db..fefce887 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxPlayer.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxPlayer.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.req.ReqTaxEnabled;
-import net.knarcraft.factions.cmd.type.TypeMPlayer;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.cmd.req.ReqTaxEnabled;
+import net.knarcraft.factions.cmd.type.TypeMPlayer;
+import net.knarcraft.factions.entity.MPlayer;
public class CmdFactionsTaxPlayer extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxRun.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxRun.java
index 6e8f8090..1b9b13d3 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxRun.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxRun.java
@@ -2,7 +2,6 @@ package net.knarcraft.factions.cmd;
import net.knarcraft.factions.cmd.req.ReqTaxEnabled;
import net.knarcraft.factions.task.TaskTax;
-import com.massivecraft.massivecore.MassiveException;
public class CmdFactionsTaxRun extends FactionsCommand {
// -------------------------------------------- //
@@ -18,7 +17,7 @@ public class CmdFactionsTaxRun extends FactionsCommand {
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
TaskTax.get().invoke(System.currentTimeMillis());
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxSet.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxSet.java
index b7546966..3205dc87 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxSet.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTaxSet.java
@@ -1,5 +1,9 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
+import com.massivecraft.massivecore.money.Money;
+import com.massivecraft.massivecore.util.MUtil;
import net.knarcraft.factions.cmd.req.ReqTaxEnabled;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeTaxable;
@@ -9,10 +13,6 @@ import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.MPlayerColl;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeDouble;
-import com.massivecraft.massivecore.money.Money;
-import com.massivecraft.massivecore.util.MUtil;
public class CmdFactionsTaxSet extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTerritorytitles.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTerritorytitles.java
index a62d02ec..0785513d 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTerritorytitles.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTerritorytitles.java
@@ -30,9 +30,9 @@ public class CmdFactionsTerritorytitles extends FactionsCommand {
@Override
public Visibility getVisibility() {
// We hide the command if titles aren't available.
- if (!MixinTitle.get().isAvailable()) {
- return Visibility.INVISIBLE;
- }
+ if (!MixinTitle.get().isAvailable()) {
+ return Visibility.INVISIBLE;
+ }
return super.getVisibility();
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTitle.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTitle.java
index c8c4196e..c570a5f5 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTitle.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTitle.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeString;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Perm;
import net.knarcraft.factions.cmd.type.TypeMPlayer;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsTitleChange;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeString;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsTitle extends FactionsCommand {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTop.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTop.java
index f2a01c14..ec4e4b3c 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTop.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsTop.java
@@ -1,10 +1,5 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.FactionColl;
-import net.knarcraft.factions.entity.MPlayer;
-import net.knarcraft.factions.integration.Econ;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.command.type.enumeration.TypeEnum;
@@ -14,6 +9,11 @@ import com.massivecraft.massivecore.pager.Stringifier;
import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.FactionColl;
+import net.knarcraft.factions.entity.MPlayer;
+import net.knarcraft.factions.integration.Econ;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@@ -80,20 +80,14 @@ public class CmdFactionsTop extends FactionsCommand {
private static String getValue(TopCategory category, Faction faction, MPlayer mplayer) {
String ret = Txt.parse("%s: ", faction.getName(mplayer));
switch (category) {
- case MONEY:
- ret += Money.format(Econ.getMoney(faction), true);
- break;
- case MEMBERS:
- ret += faction.getMPlayers().size() + " members";
- break;
- case TERRITORY:
- ret += faction.getLandCount() + " chunks";
- break;
- case AGE:
+ case MONEY -> ret += Money.format(Econ.getMoney(faction), true);
+ case MEMBERS -> ret += faction.getMPlayers().size() + " members";
+ case TERRITORY -> ret += faction.getLandCount() + " chunks";
+ case AGE -> {
long ageMillis = faction.getAge();
LinkedHashMap ageUnitcounts = TimeDiffUtil.limit(TimeDiffUtil.unitcounts(ageMillis, TimeUnit.getAllButMillis()), 3);
ret += TimeDiffUtil.formatedVerboose(ageUnitcounts);
- break;
+ }
}
return ret;
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsUnsethome.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsUnsethome.java
index 5d8da840..5ddbb128 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsUnsethome.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsUnsethome.java
@@ -1,11 +1,10 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.MConf;
-import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Visibility;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.MConf;
import java.util.List;
@@ -30,7 +29,7 @@ public class CmdFactionsUnsethome extends FactionsCommandWarp {
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
List args = MUtil.list(MConf.get().warpsHomeName, this.argAt(0));
CmdFactions.get().cmdFactionsWarp.cmdFactionWarpRemove.execute(me, args);
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsUnstuck.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsUnstuck.java
index dda92da5..da3aacbe 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsUnstuck.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsUnstuck.java
@@ -1,18 +1,17 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.entity.BoardColl;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.FactionColl;
-import net.knarcraft.factions.entity.MConf;
-import net.knarcraft.factions.entity.MPerm;
-import net.knarcraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.mixin.MixinTeleport;
import com.massivecraft.massivecore.mixin.TeleporterException;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.teleport.Destination;
import com.massivecraft.massivecore.teleport.DestinationSimple;
+import net.knarcraft.factions.entity.BoardColl;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.FactionColl;
+import net.knarcraft.factions.entity.MConf;
+import net.knarcraft.factions.entity.MPerm;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.Location;
import org.bukkit.World;
@@ -34,7 +33,7 @@ public class CmdFactionsUnstuck extends FactionsCommand {
// -------------------------------------------- //
@Override
- public void perform() throws MassiveException {
+ public void perform() {
// If the player is in a chunk ...
final PS center = PS.valueOf(me.getLocation().getChunk());
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVote.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVote.java
index dfcd7c14..86899ec1 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVote.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVote.java
@@ -7,7 +7,7 @@ public class CmdFactionsVote extends FactionsCommand {
public CmdFactionsVoteShow cmdFactionsVoteShow = new CmdFactionsVoteShow();
public CmdFactionsVoteList cmdFactionsVoteList = new CmdFactionsVoteList();
- public CmdFactionsVoteDo cmdFactionsVoteDo = new CmdFactionsVoteDo();
+ public final CmdFactionsVoteDo cmdFactionsVoteDo = new CmdFactionsVoteDo();
public CmdFactionsVoteCreate cmdFactionsVoteCreate = new CmdFactionsVoteCreate();
public CmdFactionsVoteRemove cmdFactionsVoteRemove = new CmdFactionsVoteRemove();
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteCreate.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteCreate.java
index b15a3dde..ac6841b7 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteCreate.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteCreate.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.entity.MPerm;
-import net.knarcraft.factions.entity.Vote;
-import net.knarcraft.factions.event.EventFactionsVoteAdd;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.command.type.container.TypeList;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.util.IdUtil;
+import net.knarcraft.factions.entity.MPerm;
+import net.knarcraft.factions.entity.Vote;
+import net.knarcraft.factions.event.EventFactionsVoteAdd;
import java.util.List;
@@ -33,9 +33,9 @@ public class CmdFactionsVoteCreate extends FactionsCommandWarp {
List options = this.readArg();
// MPerm
- if (!MPerm.getPermCreateVote().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermCreateVote().has(msender, msenderFaction, true)) {
+ return;
+ }
if (msenderFaction.getVoteByName(name).isPresent()) {
throw new MassiveException().addMsg("There is already a vote called %s.", name);
@@ -44,9 +44,9 @@ public class CmdFactionsVoteCreate extends FactionsCommandWarp {
// Make sure there are no duplicated
List options2 = new MassiveList<>();
for (String str : options) {
- if (options2.stream().anyMatch(str::equalsIgnoreCase)) {
- continue;
- }
+ if (options2.stream().anyMatch(str::equalsIgnoreCase)) {
+ continue;
+ }
options2.add(str);
}
@@ -56,9 +56,9 @@ public class CmdFactionsVoteCreate extends FactionsCommandWarp {
// Event
EventFactionsVoteAdd event = new EventFactionsVoteAdd(sender, msenderFaction, vote);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
vote = event.getVote();
// Apply
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteDo.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteDo.java
index cd229a9e..ccc83dd2 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteDo.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteDo.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.type.primitive.TypeString;
import net.knarcraft.factions.cmd.type.TypeVote;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.Vote;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.type.primitive.TypeString;
public class CmdFactionsVoteDo extends FactionsCommandWarp {
// -------------------------------------------- //
@@ -28,9 +28,9 @@ public class CmdFactionsVoteDo extends FactionsCommandWarp {
String option = this.readArg();
// Any and MPerm
- if (!MPerm.getPermVote().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermVote().has(msender, msenderFaction, true)) {
+ return;
+ }
if (vote.getOptions().stream().noneMatch(option::equalsIgnoreCase)) {
throw new MassiveException().addMsg("No option in %s matches %s.", vote.getName(), option);
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteList.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteList.java
index be31fbfc..435522e7 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteList.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteList.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.entity.Vote;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.entity.Vote;
public class CmdFactionsVoteList extends FactionsCommandWarp {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteRemove.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteRemove.java
index 21a2ba80..8ae7937b 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteRemove.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteRemove.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
import net.knarcraft.factions.cmd.type.TypeVote;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.Vote;
import net.knarcraft.factions.event.EventFactionsVoteRemove;
-import com.massivecraft.massivecore.MassiveException;
public class CmdFactionsVoteRemove extends FactionsCommandWarp {
// -------------------------------------------- //
@@ -26,16 +26,16 @@ public class CmdFactionsVoteRemove extends FactionsCommandWarp {
Vote vote = TypeVote.get(msenderFaction).read(this.arg(), sender);
// Any and MPerm
- if (!MPerm.getPermCreateVote().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermCreateVote().has(msender, msenderFaction, true)) {
+ return;
+ }
// Event
EventFactionsVoteRemove event = new EventFactionsVoteRemove(sender, msenderFaction, vote);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
vote = event.getVote();
// Apply
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteShow.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteShow.java
index a16eb88b..dcdab242 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteShow.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsVoteShow.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeVote;
-import net.knarcraft.factions.entity.Vote;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.cmd.type.TypeVote;
+import net.knarcraft.factions.entity.Vote;
public class CmdFactionsVoteShow extends FactionsCommandWarp {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarp.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarp.java
index 983cd4b1..be47d4f0 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarp.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarp.java
@@ -5,9 +5,9 @@ public class CmdFactionsWarp extends FactionsCommand {
// FIELDS
// -------------------------------------------- //
- public CmdFactionsWarpGo cmdFactionsWarpGo = new CmdFactionsWarpGo();
+ public final CmdFactionsWarpGo cmdFactionsWarpGo = new CmdFactionsWarpGo();
public CmdFactionsWarpList cmdFactionsWarpList = new CmdFactionsWarpList();
- public CmdFactionsWarpAdd cmdFactionWarpAdd = new CmdFactionsWarpAdd();
- public CmdFactionsWarpRemove cmdFactionWarpRemove = new CmdFactionsWarpRemove();
+ public final CmdFactionsWarpAdd cmdFactionWarpAdd = new CmdFactionsWarpAdd();
+ public final CmdFactionsWarpRemove cmdFactionWarpRemove = new CmdFactionsWarpRemove();
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpAdd.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpAdd.java
index 3a643e60..cdce2dda 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpAdd.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpAdd.java
@@ -1,15 +1,15 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
+import com.massivecraft.massivecore.command.type.primitive.TypeString;
+import com.massivecraft.massivecore.ps.PS;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.Warp;
import net.knarcraft.factions.event.EventFactionsWarpAdd;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
-import com.massivecraft.massivecore.command.type.primitive.TypeString;
-import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsWarpAdd extends FactionsCommandWarp {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpGo.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpGo.java
index 5f2bd11d..0e3593fd 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpGo.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpGo.java
@@ -1,5 +1,15 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
+import com.massivecraft.massivecore.mixin.MixinMessage;
+import com.massivecraft.massivecore.mixin.MixinTeleport;
+import com.massivecraft.massivecore.mixin.TeleporterException;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.teleport.Destination;
+import com.massivecraft.massivecore.teleport.DestinationSimple;
+import com.massivecraft.massivecore.util.MUtil;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Rel;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeWarp;
@@ -11,16 +21,6 @@ import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.Warp;
import net.knarcraft.factions.event.EventFactionsWarpTeleport;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
-import com.massivecraft.massivecore.mixin.MixinMessage;
-import com.massivecraft.massivecore.mixin.MixinTeleport;
-import com.massivecraft.massivecore.mixin.TeleporterException;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.teleport.Destination;
-import com.massivecraft.massivecore.teleport.DestinationSimple;
-import com.massivecraft.massivecore.util.MUtil;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
@@ -51,14 +51,14 @@ public class CmdFactionsWarpGo extends FactionsCommandWarp {
String warpDesc = Txt.parse("%s in %s", warp.getName(), faction.describeTo(msender, false));
// Must be valid
- if (!warp.verifyIsValid()) {
- return;
- }
+ if (!warp.verifyIsValid()) {
+ return;
+ }
// Any and MPerm
- if (!MPerm.getPermWarp().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermWarp().has(msender, faction, true)) {
+ return;
+ }
if (!MConf.get().warpsTeleportAllowedFromEnemyTerritory && msender.isInEnemyTerritory()) {
throw new MassiveException().addMsg("You cannot teleport to %s while in the territory of an enemy faction.", warp);
@@ -94,18 +94,18 @@ public class CmdFactionsWarpGo extends FactionsCommandWarp {
double z = locationHere.getZ();
for (Player p : w.getPlayers()) {
- if (MUtil.isntPlayer(p)) {
- continue;
- }
+ if (MUtil.isntPlayer(p)) {
+ continue;
+ }
- if (!p.isOnline() || p.isDead() || p == me || p.getWorld() != w) {
- continue;
- }
+ if (!p.isOnline() || p.isDead() || p == me || p.getWorld() != w) {
+ continue;
+ }
MPlayer fp = MPlayer.get(p);
- if (msender.getRelationTo(fp) != Rel.ENEMY) {
- continue;
- }
+ if (msender.getRelationTo(fp) != Rel.ENEMY) {
+ continue;
+ }
Location l = p.getLocation();
double dx = Math.abs(x - l.getX());
@@ -114,9 +114,9 @@ public class CmdFactionsWarpGo extends FactionsCommandWarp {
double max = MConf.get().warpsTeleportAllowedEnemyDistance;
// box-shaped distance check
- if (dx > max || dy > max || dz > max) {
- continue;
- }
+ if (dx > max || dy > max || dz > max) {
+ continue;
+ }
throw new MassiveException().addMsg("You cannot teleport to %s while an enemy is within %f blocks of you.", warpDesc, max);
}
@@ -125,9 +125,9 @@ public class CmdFactionsWarpGo extends FactionsCommandWarp {
// Event
EventFactionsWarpTeleport event = new EventFactionsWarpTeleport(sender, warp);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
// Apply
try {
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpList.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpList.java
index 148690f6..e39b1ee2 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpList.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpList.java
@@ -1,15 +1,15 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.type.TypeFaction;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MPerm;
-import net.knarcraft.factions.entity.Warp;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
import com.massivecraft.massivecore.ps.PSFormatDesc;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.cmd.type.TypeFaction;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MPerm;
+import net.knarcraft.factions.entity.Warp;
public class CmdFactionsWarpList extends FactionsCommandWarp {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpRemove.java b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpRemove.java
index 61f7c64e..3d265aa4 100644
--- a/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpRemove.java
+++ b/src/main/java/net/knarcraft/factions/cmd/CmdFactionsWarpRemove.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.MassiveException;
import net.knarcraft.factions.cmd.type.TypeFaction;
import net.knarcraft.factions.cmd.type.TypeWarp;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.Warp;
import net.knarcraft.factions.event.EventFactionsWarpRemove;
-import com.massivecraft.massivecore.MassiveException;
public class CmdFactionsWarpRemove extends FactionsCommandWarp {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/FactionsCommand.java b/src/main/java/net/knarcraft/factions/cmd/FactionsCommand.java
index fee3c555..7206fdab 100644
--- a/src/main/java/net/knarcraft/factions/cmd/FactionsCommand.java
+++ b/src/main/java/net/knarcraft/factions/cmd/FactionsCommand.java
@@ -1,8 +1,8 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.command.MassiveCommand;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.command.MassiveCommand;
public class FactionsCommand extends MassiveCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/FactionsCommandDocumentation.java b/src/main/java/net/knarcraft/factions/cmd/FactionsCommandDocumentation.java
index 216301c8..a5772dea 100644
--- a/src/main/java/net/knarcraft/factions/cmd/FactionsCommandDocumentation.java
+++ b/src/main/java/net/knarcraft/factions/cmd/FactionsCommandDocumentation.java
@@ -1,7 +1,7 @@
package net.knarcraft.factions.cmd;
-import net.knarcraft.factions.cmd.req.ReqFactionWarpsEnabled;
import com.massivecraft.massivecore.mson.Mson;
+import net.knarcraft.factions.cmd.req.ReqFactionWarpsEnabled;
public class FactionsCommandDocumentation extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/FactionsCommandWarp.java b/src/main/java/net/knarcraft/factions/cmd/FactionsCommandWarp.java
index a7a1c3cd..144adcae 100644
--- a/src/main/java/net/knarcraft/factions/cmd/FactionsCommandWarp.java
+++ b/src/main/java/net/knarcraft/factions/cmd/FactionsCommandWarp.java
@@ -1,8 +1,8 @@
package net.knarcraft.factions.cmd;
+import com.massivecraft.massivecore.command.Visibility;
import net.knarcraft.factions.cmd.req.ReqFactionWarpsEnabled;
import net.knarcraft.factions.entity.MConf;
-import com.massivecraft.massivecore.command.Visibility;
public class FactionsCommandWarp extends FactionsCommand {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/req/ReqBankCommandsEnabled.java b/src/main/java/net/knarcraft/factions/cmd/req/ReqBankCommandsEnabled.java
index 7d8806b5..de01a2ff 100644
--- a/src/main/java/net/knarcraft/factions/cmd/req/ReqBankCommandsEnabled.java
+++ b/src/main/java/net/knarcraft/factions/cmd/req/ReqBankCommandsEnabled.java
@@ -1,24 +1,27 @@
package net.knarcraft.factions.cmd.req;
-import net.knarcraft.factions.entity.MConf;
-import net.knarcraft.factions.integration.Econ;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.entity.MConf;
+import net.knarcraft.factions.integration.Econ;
import org.bukkit.command.CommandSender;
+import java.io.Serial;
+
public class ReqBankCommandsEnabled extends RequirementAbstract {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
+ @Serial
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static ReqBankCommandsEnabled i = new ReqBankCommandsEnabled();
+ private static final ReqBankCommandsEnabled i = new ReqBankCommandsEnabled();
public static ReqBankCommandsEnabled get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/req/ReqFactionWarpsEnabled.java b/src/main/java/net/knarcraft/factions/cmd/req/ReqFactionWarpsEnabled.java
index db6ee513..0a56b5fd 100644
--- a/src/main/java/net/knarcraft/factions/cmd/req/ReqFactionWarpsEnabled.java
+++ b/src/main/java/net/knarcraft/factions/cmd/req/ReqFactionWarpsEnabled.java
@@ -1,23 +1,26 @@
package net.knarcraft.factions.cmd.req;
-import net.knarcraft.factions.entity.MConf;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.entity.MConf;
import org.bukkit.command.CommandSender;
+import java.io.Serial;
+
public class ReqFactionWarpsEnabled extends RequirementAbstract {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
+ @Serial
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static ReqFactionWarpsEnabled i = new ReqFactionWarpsEnabled();
+ private static final ReqFactionWarpsEnabled i = new ReqFactionWarpsEnabled();
public static ReqFactionWarpsEnabled get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/req/ReqHasFaction.java b/src/main/java/net/knarcraft/factions/cmd/req/ReqHasFaction.java
index c3e89129..a2fe71d7 100644
--- a/src/main/java/net/knarcraft/factions/cmd/req/ReqHasFaction.java
+++ b/src/main/java/net/knarcraft/factions/cmd/req/ReqHasFaction.java
@@ -1,24 +1,27 @@
package net.knarcraft.factions.cmd.req;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.command.CommandSender;
+import java.io.Serial;
+
public class ReqHasFaction extends RequirementAbstract {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
+ @Serial
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static ReqHasFaction i = new ReqHasFaction();
+ private static final ReqHasFaction i = new ReqHasFaction();
public static ReqHasFaction get() {
return i;
@@ -30,9 +33,9 @@ public class ReqHasFaction extends RequirementAbstract {
@Override
public boolean apply(CommandSender sender, MassiveCommand command) {
- if (MUtil.isntSender(sender)) {
- return false;
- }
+ if (MUtil.isntSender(sender)) {
+ return false;
+ }
MPlayer mplayer = MPlayer.get(sender);
return mplayer.hasFaction();
diff --git a/src/main/java/net/knarcraft/factions/cmd/req/ReqHasntFaction.java b/src/main/java/net/knarcraft/factions/cmd/req/ReqHasntFaction.java
index 29ab08fa..e2996d89 100644
--- a/src/main/java/net/knarcraft/factions/cmd/req/ReqHasntFaction.java
+++ b/src/main/java/net/knarcraft/factions/cmd/req/ReqHasntFaction.java
@@ -1,24 +1,27 @@
package net.knarcraft.factions.cmd.req;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.command.CommandSender;
+import java.io.Serial;
+
public class ReqHasntFaction extends RequirementAbstract {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
+ @Serial
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static ReqHasntFaction i = new ReqHasntFaction();
+ private static final ReqHasntFaction i = new ReqHasntFaction();
public static ReqHasntFaction get() {
return i;
@@ -30,9 +33,9 @@ public class ReqHasntFaction extends RequirementAbstract {
@Override
public boolean apply(CommandSender sender, MassiveCommand command) {
- if (MUtil.isntSender(sender)) {
- return true;
- }
+ if (MUtil.isntSender(sender)) {
+ return true;
+ }
MPlayer mplayer = MPlayer.get(sender);
return !mplayer.hasFaction();
diff --git a/src/main/java/net/knarcraft/factions/cmd/req/ReqRankIsAtLeast.java b/src/main/java/net/knarcraft/factions/cmd/req/ReqRankIsAtLeast.java
index 671411da..674254e1 100644
--- a/src/main/java/net/knarcraft/factions/cmd/req/ReqRankIsAtLeast.java
+++ b/src/main/java/net/knarcraft/factions/cmd/req/ReqRankIsAtLeast.java
@@ -1,18 +1,21 @@
package net.knarcraft.factions.cmd.req;
-import net.knarcraft.factions.entity.MPlayer;
-import net.knarcraft.factions.entity.Rank;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.entity.MPlayer;
+import net.knarcraft.factions.entity.Rank;
import org.bukkit.command.CommandSender;
+import java.io.Serial;
+
public class ReqRankIsAtLeast extends RequirementAbstract {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
+ @Serial
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
@@ -43,9 +46,9 @@ public class ReqRankIsAtLeast extends RequirementAbstract {
@Override
public boolean apply(CommandSender sender, MassiveCommand command) {
- if (MUtil.isntSender(sender)) {
- return false;
- }
+ if (MUtil.isntSender(sender)) {
+ return false;
+ }
MPlayer mplayer = MPlayer.get(sender);
return mplayer.getRank().isAtLeast(this.getRank());
diff --git a/src/main/java/net/knarcraft/factions/cmd/req/ReqTaxEnabled.java b/src/main/java/net/knarcraft/factions/cmd/req/ReqTaxEnabled.java
index 027ca8dc..431b24fc 100644
--- a/src/main/java/net/knarcraft/factions/cmd/req/ReqTaxEnabled.java
+++ b/src/main/java/net/knarcraft/factions/cmd/req/ReqTaxEnabled.java
@@ -1,23 +1,26 @@
package net.knarcraft.factions.cmd.req;
-import net.knarcraft.factions.task.TaskTax;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.task.TaskTax;
import org.bukkit.command.CommandSender;
+import java.io.Serial;
+
public class ReqTaxEnabled extends RequirementAbstract {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
+ @Serial
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static ReqTaxEnabled i = new ReqTaxEnabled();
+ private static final ReqTaxEnabled i = new ReqTaxEnabled();
public static ReqTaxEnabled get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeEntityInternalFaction.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeEntityInternalFaction.java
index 299fce3f..554dcd29 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeEntityInternalFaction.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeEntityInternalFaction.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.cmd.type;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.command.type.TypeAbstractChoice;
import com.massivecraft.massivecore.store.EntityInternal;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.command.CommandSender;
import java.util.Collection;
@@ -26,9 +26,9 @@ public abstract class TypeEntityInternalFaction> ext
protected TypeEntityInternalFaction(Class clazz, Faction faction) {
super(clazz);
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
this.faction = faction;
@@ -54,18 +54,18 @@ public abstract class TypeEntityInternalFaction> ext
@Override
public boolean isValid(String arg, CommandSender sender) {
// In the generic case accept all
- if (this.getAll().isEmpty()) {
- return true;
- } else {
- return super.isValid(arg, sender);
- }
+ if (this.getAll().isEmpty()) {
+ return true;
+ } else {
+ return super.isValid(arg, sender);
+ }
}
@Override
public Collection getTabList(CommandSender sender, String arg) {
- if (this.getFaction() != null) {
- return super.getTabList(sender, arg);
- }
+ if (this.getFaction() != null) {
+ return super.getTabList(sender, arg);
+ }
// Default to tab list for the sender
Faction faction = MPlayer.get(sender).getFaction();
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeFaction.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeFaction.java
index 2643c7be..95ff55cd 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeFaction.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeFaction.java
@@ -1,14 +1,14 @@
package net.knarcraft.factions.cmd.type;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.FactionColl;
-import net.knarcraft.factions.entity.MPlayer;
-import net.knarcraft.factions.entity.MPlayerColl;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.TypeAbstract;
import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive;
import com.massivecraft.massivecore.util.IdUtil;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.FactionColl;
+import net.knarcraft.factions.entity.MPlayer;
+import net.knarcraft.factions.entity.MPlayerColl;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -21,7 +21,7 @@ public class TypeFaction extends TypeAbstract {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeFaction i = new TypeFaction();
+ private static final TypeFaction i = new TypeFaction();
public static TypeFaction get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionChunkChangeType.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionChunkChangeType.java
index 6271a0e8..6cda4b8b 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionChunkChangeType.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionChunkChangeType.java
@@ -1,14 +1,14 @@
package net.knarcraft.factions.cmd.type;
-import net.knarcraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.massivecore.command.type.enumeration.TypeEnum;
+import net.knarcraft.factions.event.EventFactionsChunkChangeType;
public class TypeFactionChunkChangeType extends TypeEnum {
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeFactionChunkChangeType i = new TypeFactionChunkChangeType();
+ private static final TypeFactionChunkChangeType i = new TypeFactionChunkChangeType();
public static TypeFactionChunkChangeType get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameAbstract.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameAbstract.java
index fbe0b8d9..51c44722 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameAbstract.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameAbstract.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.cmd.type;
+import com.massivecraft.massivecore.Named;
+import com.massivecraft.massivecore.command.type.TypeNameAbstract;
import net.knarcraft.factions.entity.FactionColl;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.util.MiscUtil;
-import com.massivecraft.massivecore.Named;
-import com.massivecraft.massivecore.command.type.TypeNameAbstract;
import org.bukkit.command.CommandSender;
public class TypeFactionNameAbstract extends TypeNameAbstract {
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameLenient.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameLenient.java
index 05ed788e..ada8247f 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameLenient.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameLenient.java
@@ -5,7 +5,7 @@ public class TypeFactionNameLenient extends TypeFactionNameAbstract {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeFactionNameLenient i = new TypeFactionNameLenient();
+ private static final TypeFactionNameLenient i = new TypeFactionNameLenient();
public static TypeFactionNameLenient get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameStrict.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameStrict.java
index 85864d2b..caeb2aef 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameStrict.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeFactionNameStrict.java
@@ -5,7 +5,7 @@ public class TypeFactionNameStrict extends TypeFactionNameAbstract {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeFactionNameStrict i = new TypeFactionNameStrict();
+ private static final TypeFactionNameStrict i = new TypeFactionNameStrict();
public static TypeFactionNameStrict get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeMFlag.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeMFlag.java
index ecb3e86e..b81d4b81 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeMFlag.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeMFlag.java
@@ -1,8 +1,8 @@
package net.knarcraft.factions.cmd.type;
+import com.massivecraft.massivecore.command.type.store.TypeEntity;
import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MFlagColl;
-import com.massivecraft.massivecore.command.type.store.TypeEntity;
import java.util.Collection;
@@ -11,7 +11,7 @@ public class TypeMFlag extends TypeEntity {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeMFlag i = new TypeMFlag();
+ private static final TypeMFlag i = new TypeMFlag();
public static TypeMFlag get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeMPerm.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeMPerm.java
index 6a36fbe2..19d2bf62 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeMPerm.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeMPerm.java
@@ -1,8 +1,8 @@
package net.knarcraft.factions.cmd.type;
+import com.massivecraft.massivecore.command.type.store.TypeEntity;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPermColl;
-import com.massivecraft.massivecore.command.type.store.TypeEntity;
import java.util.Collection;
@@ -11,7 +11,7 @@ public class TypeMPerm extends TypeEntity {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeMPerm i = new TypeMPerm();
+ private static final TypeMPerm i = new TypeMPerm();
public static TypeMPerm get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeMPermable.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeMPermable.java
index 8cc68b6d..f8b28bf7 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeMPermable.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeMPermable.java
@@ -1,14 +1,14 @@
package net.knarcraft.factions.cmd.type;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.collections.MassiveList;
+import com.massivecraft.massivecore.command.type.TypeAbstract;
+import com.massivecraft.massivecore.util.MUtil;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.FactionColl;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.Rank;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.collections.MassiveList;
-import com.massivecraft.massivecore.command.type.TypeAbstract;
-import com.massivecraft.massivecore.util.MUtil;
import org.bukkit.command.CommandSender;
import java.util.Collection;
@@ -20,7 +20,7 @@ public class TypeMPermable extends TypeAbstract {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeMPermable i = new TypeMPermable();
+ private static final TypeMPermable i = new TypeMPermable();
public static TypeMPermable get() {
return i;
@@ -38,9 +38,9 @@ public class TypeMPermable extends TypeAbstract {
public TypeMPermable(Faction faction) {
super(MPerm.MPermable.class);
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
this.faction = faction;
}
@@ -63,7 +63,7 @@ public class TypeMPermable extends TypeAbstract {
public MPerm.MPermable read(String arg, CommandSender sender) throws MassiveException {
if (arg.toLowerCase().startsWith("rank-")) {
String subArg = arg.substring("rank-".length());
- return new TypeRank(this.getFaction()).read(subArg, sender);
+ return TypeRank.get(this.getFaction(), null).read(subArg, sender);
}
if (arg.toLowerCase().startsWith("relation-")) {
@@ -81,7 +81,7 @@ public class TypeMPermable extends TypeAbstract {
return TypeFaction.get().read(subArg, sender);
}
- TypeRank typeRank = new TypeRank(this.getFaction());
+ TypeRank typeRank = TypeRank.get(this.getFaction(), null);
try {
return typeRank.read(arg, sender);
} catch (MassiveException ex) {
@@ -112,7 +112,7 @@ public class TypeMPermable extends TypeAbstract {
String rankName = arg.substring(idx + 1);
Faction faction = TypeFaction.get().read(factionName, sender);
- return TypeRank.get(faction).read(rankName, sender);
+ return TypeRank.get(faction, null).read(rankName, sender);
}
throw new MassiveException().addMsg("No rank, relation, player or faction matches: %s.", arg);
@@ -121,9 +121,9 @@ public class TypeMPermable extends TypeAbstract {
public Collection getTabList(CommandSender sender, String arg) {
List ret = new MassiveList<>();
Faction faction = this.getFaction();
- if (faction == null) {
- faction = MPlayer.get(sender).getFaction();
- }
+ if (faction == null) {
+ faction = MPlayer.get(sender).getFaction();
+ }
// Always add ranks, relations, other factions and other players
ret.addAll(faction.getRanks().getAll().stream().map(Rank::getName).collect(Collectors.toList()));
@@ -135,12 +135,12 @@ public class TypeMPermable extends TypeAbstract {
if (arg.length() >= 2) {
for (Faction f : FactionColl.get().getAll()) {
String name = f.getName();
- if (arg.length() <= name.length() && !name.toLowerCase().startsWith(arg.toLowerCase())) {
- continue;
- }
- if (arg.length() > name.length() && !arg.toLowerCase().startsWith(name.toLowerCase())) {
- continue;
- }
+ if (arg.length() <= name.length() && !name.toLowerCase().startsWith(arg.toLowerCase())) {
+ continue;
+ }
+ if (arg.length() > name.length() && !arg.toLowerCase().startsWith(name.toLowerCase())) {
+ continue;
+ }
ret.addAll(f.getRanks().getAll().stream().map(r -> name + "-" + r.getName()).collect(Collectors.toList()));
}
@@ -182,11 +182,11 @@ public class TypeMPermable extends TypeAbstract {
@Override
public boolean isValid(String arg, CommandSender sender) {
// In the generic case accept all
- if (this.getFaction() == null) {
- return true;
- } else {
- return super.isValid(arg, sender);
- }
+ if (this.getFaction() == null) {
+ return true;
+ } else {
+ return super.isValid(arg, sender);
+ }
}
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeMPlayer.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeMPlayer.java
index 42d97f1c..c8d1b7c2 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeMPlayer.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeMPlayer.java
@@ -1,8 +1,8 @@
package net.knarcraft.factions.cmd.type;
+import com.massivecraft.massivecore.command.type.Type;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.MPlayerColl;
-import com.massivecraft.massivecore.command.type.Type;
public class TypeMPlayer {
// -------------------------------------------- //
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeRank.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeRank.java
index 69acaf7d..c836d0eb 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeRank.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeRank.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.cmd.type;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.Rank;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveSet;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.Rank;
import org.bukkit.command.CommandSender;
import java.util.Collection;
@@ -15,7 +15,7 @@ public class TypeRank extends TypeEntityInternalFaction {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeRank i = new TypeRank();
+ private static final TypeRank i = new TypeRank();
public static TypeRank get() {
return i;
@@ -77,13 +77,13 @@ public class TypeRank extends TypeEntityInternalFaction {
if (this.currentRank != null) {
// You can't use "promote" to make someone leader.
Rank promote = getPromote(currentRank);
- if (value == promote && !promote.isLeader()) {
- names.add("promote");
- }
+ if (value == promote && !promote.isLeader()) {
+ names.add("promote");
+ }
- if (value == getDemote(currentRank)) {
- names.add("demote");
- }
+ if (value == getDemote(currentRank)) {
+ names.add("demote");
+ }
}
return names;
@@ -92,15 +92,15 @@ public class TypeRank extends TypeEntityInternalFaction {
private static Rank getPromote(Rank rank) {
Rank ret = null;
for (Rank r : rank.getFaction().getRanks().getAll()) {
- if (rank == r) {
- continue;
- }
- if (rank.isMoreThan(r)) {
- continue;
- }
- if (ret != null && ret.isLessThan(r)) {
- continue;
- }
+ if (rank == r) {
+ continue;
+ }
+ if (rank.isMoreThan(r)) {
+ continue;
+ }
+ if (ret != null && ret.isLessThan(r)) {
+ continue;
+ }
ret = r;
}
@@ -110,15 +110,15 @@ public class TypeRank extends TypeEntityInternalFaction {
private static Rank getDemote(Rank rank) {
Rank ret = null;
for (Rank r : rank.getFaction().getRanks().getAll()) {
- if (rank == r) {
- continue;
- }
- if (rank.isLessThan(r)) {
- continue;
- }
- if (ret != null && ret.isMoreThan(r)) {
- continue;
- }
+ if (rank == r) {
+ continue;
+ }
+ if (rank.isLessThan(r)) {
+ continue;
+ }
+ if (ret != null && ret.isMoreThan(r)) {
+ continue;
+ }
ret = r;
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeRel.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeRel.java
index 1f3c2cf0..ab377109 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeRel.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeRel.java
@@ -1,7 +1,7 @@
package net.knarcraft.factions.cmd.type;
-import net.knarcraft.factions.Rel;
import com.massivecraft.massivecore.command.type.enumeration.TypeEnum;
+import net.knarcraft.factions.Rel;
import java.util.Set;
@@ -10,7 +10,7 @@ public class TypeRel extends TypeEnum {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeRel i = new TypeRel();
+ private static final TypeRel i = new TypeRel();
public static TypeRel get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeRelation.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeRelation.java
index b820d712..39a978b3 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeRelation.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeRelation.java
@@ -7,7 +7,7 @@ public class TypeRelation extends TypeRel {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeRelation i = new TypeRelation();
+ private static final TypeRelation i = new TypeRelation();
public static TypeRelation get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeSortMPlayer.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeSortMPlayer.java
index 28b14788..68632d03 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeSortMPlayer.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeSortMPlayer.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.cmd.type;
+import com.massivecraft.massivecore.command.type.TypeAbstractChoice;
import net.knarcraft.factions.comparator.ComparatorMPlayerInactivity;
import net.knarcraft.factions.comparator.ComparatorMPlayerPower;
import net.knarcraft.factions.comparator.ComparatorMPlayerRole;
import net.knarcraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.command.type.TypeAbstractChoice;
import java.util.Comparator;
@@ -13,7 +13,7 @@ public class TypeSortMPlayer extends TypeAbstractChoice> {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeSortMPlayer i = new TypeSortMPlayer();
+ private static final TypeSortMPlayer i = new TypeSortMPlayer();
public static TypeSortMPlayer get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeTaxable.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeTaxable.java
index 1087a218..bfb39861 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeTaxable.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeTaxable.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.cmd.type;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MPlayer;
-import net.knarcraft.factions.entity.Rank;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.command.type.TypeAbstract;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MPlayer;
+import net.knarcraft.factions.entity.Rank;
import org.bukkit.command.CommandSender;
import java.util.Collection;
@@ -19,7 +19,7 @@ public class TypeTaxable extends TypeAbstract {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeTaxable i = new TypeTaxable();
+ private static final TypeTaxable i = new TypeTaxable();
public static TypeTaxable get() {
return i;
@@ -37,9 +37,9 @@ public class TypeTaxable extends TypeAbstract {
public TypeTaxable(Faction faction) {
super(String.class);
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
this.faction = faction;
}
@@ -62,7 +62,7 @@ public class TypeTaxable extends TypeAbstract {
public String read(String arg, CommandSender sender) throws MassiveException {
if (arg.toLowerCase().startsWith("rank-")) {
String subArg = arg.substring("rank-".length());
- return new TypeRank(this.getFaction()).read(subArg, sender).getId();
+ return TypeRank.get(this.getFaction(), null).read(subArg, sender).getId();
}
if (arg.toLowerCase().startsWith("player-")) {
@@ -71,7 +71,7 @@ public class TypeTaxable extends TypeAbstract {
}
- TypeRank typeRank = new TypeRank(this.getFaction());
+ TypeRank typeRank = TypeRank.get(this.getFaction(), null);
try {
return typeRank.read(arg, sender).getId();
} catch (MassiveException ex) {
@@ -90,9 +90,9 @@ public class TypeTaxable extends TypeAbstract {
public Collection getTabList(CommandSender sender, String arg) {
List ret = new MassiveList<>();
Faction faction = this.getFaction();
- if (faction == null) {
- faction = MPlayer.get(sender).getFaction();
- }
+ if (faction == null) {
+ faction = MPlayer.get(sender).getFaction();
+ }
// Always add ranks, relations, other factions and other players
ret.addAll(faction.getRanks().getAll().stream().map(Rank::getName).collect(Collectors.toList()));
@@ -124,11 +124,11 @@ public class TypeTaxable extends TypeAbstract {
@Override
public boolean isValid(String arg, CommandSender sender) {
// In the generic case accept all
- if (this.getFaction() == null) {
- return true;
- } else {
- return super.isValid(arg, sender);
- }
+ if (this.getFaction() == null) {
+ return true;
+ } else {
+ return super.isValid(arg, sender);
+ }
}
}
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeVote.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeVote.java
index 98e3c281..6a2271fa 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeVote.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeVote.java
@@ -10,7 +10,7 @@ public class TypeVote extends TypeEntityInternalFaction {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeVote i = new TypeVote();
+ private static final TypeVote i = new TypeVote();
public static TypeVote get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/cmd/type/TypeWarp.java b/src/main/java/net/knarcraft/factions/cmd/type/TypeWarp.java
index d03d93c5..9b2c5351 100644
--- a/src/main/java/net/knarcraft/factions/cmd/type/TypeWarp.java
+++ b/src/main/java/net/knarcraft/factions/cmd/type/TypeWarp.java
@@ -10,7 +10,7 @@ public class TypeWarp extends TypeEntityInternalFaction {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static TypeWarp i = new TypeWarp();
+ private static final TypeWarp i = new TypeWarp();
public static TypeWarp get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/comparator/ComparatorFactionList.java b/src/main/java/net/knarcraft/factions/comparator/ComparatorFactionList.java
index 3e753d67..2fb4c761 100644
--- a/src/main/java/net/knarcraft/factions/comparator/ComparatorFactionList.java
+++ b/src/main/java/net/knarcraft/factions/comparator/ComparatorFactionList.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.comparator;
-import net.knarcraft.factions.entity.Faction;
import com.massivecraft.massivecore.comparator.ComparatorAbstract;
import com.massivecraft.massivecore.comparator.ComparatorComparable;
import com.massivecraft.massivecore.util.IdUtil;
+import net.knarcraft.factions.entity.Faction;
import org.bukkit.command.CommandSender;
import java.lang.ref.WeakReference;
@@ -38,27 +38,27 @@ public class ComparatorFactionList extends ComparatorAbstract {
@Override
public int compareInner(Faction f1, Faction f2) {
// None a.k.a. Wilderness
- if (f1.isNone() && f2.isNone()) {
- return 0;
- }
- if (f1.isNone()) {
- return -1;
- }
- if (f2.isNone()) {
- return 1;
- }
+ if (f1.isNone() && f2.isNone()) {
+ return 0;
+ }
+ if (f1.isNone()) {
+ return -1;
+ }
+ if (f2.isNone()) {
+ return 1;
+ }
// Players Online
int ret = f2.getMPlayersWhereOnlineTo(this.getWatcher()).size() - f1.getMPlayersWhereOnlineTo(this.getWatcher()).size();
- if (ret != 0) {
- return ret;
- }
+ if (ret != 0) {
+ return ret;
+ }
// Players Total
ret = f2.getMPlayers().size() - f1.getMPlayers().size();
- if (ret != 0) {
- return ret;
- }
+ if (ret != 0) {
+ return ret;
+ }
// Tie by Id
return ComparatorComparable.get().compare(f1.getId(), f2.getId());
diff --git a/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerInactivity.java b/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerInactivity.java
index 301fad23..600bf3bc 100644
--- a/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerInactivity.java
+++ b/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerInactivity.java
@@ -1,15 +1,15 @@
package net.knarcraft.factions.comparator;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.Named;
import com.massivecraft.massivecore.comparator.ComparatorAbstract;
+import net.knarcraft.factions.entity.MPlayer;
public class ComparatorMPlayerInactivity extends ComparatorAbstract implements Named {
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static ComparatorMPlayerInactivity i = new ComparatorMPlayerInactivity();
+ private static final ComparatorMPlayerInactivity i = new ComparatorMPlayerInactivity();
public static ComparatorMPlayerInactivity get() {
return i;
@@ -30,13 +30,13 @@ public class ComparatorMPlayerInactivity extends ComparatorAbstract imp
boolean o1 = m1.isOnline();
boolean o2 = m2.isOnline();
- if (o1 && o2) {
- return 0;
- } else if (o1) {
- return -1;
- } else if (o2) {
- return +1;
- }
+ if (o1 && o2) {
+ return 0;
+ } else if (o1) {
+ return -1;
+ } else if (o2) {
+ return +1;
+ }
// Inactivity Time
long r1 = m1.getLastActivityMillis();
diff --git a/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerPower.java b/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerPower.java
index d2673c6e..be55a73c 100644
--- a/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerPower.java
+++ b/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerPower.java
@@ -1,15 +1,15 @@
package net.knarcraft.factions.comparator;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.Named;
import com.massivecraft.massivecore.comparator.ComparatorAbstract;
+import net.knarcraft.factions.entity.MPlayer;
public class ComparatorMPlayerPower extends ComparatorAbstract implements Named {
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static ComparatorMPlayerPower i = new ComparatorMPlayerPower();
+ private static final ComparatorMPlayerPower i = new ComparatorMPlayerPower();
public static ComparatorMPlayerPower get() {
return i;
@@ -28,9 +28,9 @@ public class ComparatorMPlayerPower extends ComparatorAbstract implemen
public int compareInner(MPlayer m1, MPlayer m2) {
// Power
int ret = m1.getPowerRounded() - m2.getPowerRounded();
- if (ret != 0) {
- return ret;
- }
+ if (ret != 0) {
+ return ret;
+ }
// MaxPower
return m1.getPowerMaxRounded() - m2.getPowerMaxRounded();
diff --git a/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerRole.java b/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerRole.java
index b35812c6..6d7ba8b8 100644
--- a/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerRole.java
+++ b/src/main/java/net/knarcraft/factions/comparator/ComparatorMPlayerRole.java
@@ -1,16 +1,16 @@
package net.knarcraft.factions.comparator;
-import net.knarcraft.factions.entity.MPlayer;
-import net.knarcraft.factions.entity.Rank;
import com.massivecraft.massivecore.Named;
import com.massivecraft.massivecore.comparator.ComparatorAbstract;
+import net.knarcraft.factions.entity.MPlayer;
+import net.knarcraft.factions.entity.Rank;
public class ComparatorMPlayerRole extends ComparatorAbstract implements Named {
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static ComparatorMPlayerRole i = new ComparatorMPlayerRole();
+ private static final ComparatorMPlayerRole i = new ComparatorMPlayerRole();
public static ComparatorMPlayerRole get() {
return i;
@@ -28,9 +28,9 @@ public class ComparatorMPlayerRole extends ComparatorAbstract implement
@Override
public int compareInner(MPlayer m1, MPlayer m2) {
// Rank
- if (m1.getFaction() != m2.getFaction()) {
- throw new IllegalArgumentException("Noncomparable players");
- }
+ if (m1.getFaction() != m2.getFaction()) {
+ throw new IllegalArgumentException("Noncomparable players");
+ }
Rank r1 = m1.getRank();
Rank r2 = m2.getRank();
return r2.getPriority() - r1.getPriority();
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineCanCombatHappen.java b/src/main/java/net/knarcraft/factions/engine/EngineCanCombatHappen.java
index c24ac052..d53d11ed 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineCanCombatHappen.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineCanCombatHappen.java
@@ -1,5 +1,8 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.MUtil;
import net.knarcraft.factions.Rel;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
@@ -7,9 +10,6 @@ import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsPvpDisallowed;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.MUtil;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -32,7 +32,7 @@ public class EngineCanCombatHappen extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineCanCombatHappen i = new EngineCanCombatHappen();
+ private static final EngineCanCombatHappen i = new EngineCanCombatHappen();
public static EngineCanCombatHappen get() {
return i;
@@ -44,9 +44,9 @@ public class EngineCanCombatHappen extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(EntityDamageByEntityEvent event) {
- if (this.canCombatDamageHappen(event, true)) {
- return;
- }
+ if (this.canCombatDamageHappen(event, true)) {
+ return;
+ }
event.setCancelled(true);
Entity damager = event.getDamager();
@@ -61,32 +61,30 @@ public class EngineCanCombatHappen extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(EntityCombustByEntityEvent event) {
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE, 0D);
- if (this.canCombatDamageHappen(sub, false)) {
- return;
- }
+ if (this.canCombatDamageHappen(sub, false)) {
+ return;
+ }
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(PotionSplashEvent event) {
// If a harmful potion is splashing ...
- if (!MUtil.isHarmfulPotion(event.getPotion())) {
- return;
- }
+ if (!MUtil.isHarmfulPotion(event.getPotion())) {
+ return;
+ }
ProjectileSource projectileSource = event.getPotion().getShooter();
- if (!(projectileSource instanceof Entity)) {
- return;
- }
-
- Entity thrower = (Entity) projectileSource;
+ if (!(projectileSource instanceof Entity thrower)) {
+ return;
+ }
// ... scan through affected entities to make sure they're all valid targets.
for (LivingEntity affectedEntity : event.getAffectedEntities()) {
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(thrower, affectedEntity, EntityDamageEvent.DamageCause.CUSTOM, 0D);
- if (this.canCombatDamageHappen(sub, true)) {
- continue;
- }
+ if (this.canCombatDamageHappen(sub, true)) {
+ continue;
+ }
// affected entity list doesn't accept modification (iter.remove() is a no-go), but this works
event.setIntensity(affectedEntity, 0.0);
@@ -96,16 +94,14 @@ public class EngineCanCombatHappen extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(AreaEffectCloudApplyEvent event) {
// If a harmful potion effect cloud is present ...
- if (!MUtil.isHarmfulPotion(event.getEntity().getBasePotionData().getType().getEffectType())) {
- return;
- }
+ if (!MUtil.isHarmfulPotion(event.getEntity().getBasePotionData().getType().getEffectType())) {
+ return;
+ }
ProjectileSource projectileSource = event.getEntity().getSource();
- if (!(projectileSource instanceof Entity)) {
- return;
- }
-
- Entity thrower = (Entity) projectileSource;
+ if (!(projectileSource instanceof Entity thrower)) {
+ return;
+ }
// ... create a dummy list to avoid ConcurrentModificationException ...
List affectedList = new ArrayList<>();
@@ -114,9 +110,9 @@ public class EngineCanCombatHappen extends Engine {
for (LivingEntity affectedEntity : event.getAffectedEntities()) {
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(thrower, affectedEntity, EntityDamageEvent.DamageCause.CUSTOM, 0D);
// Notification disabled due to the iterating nature of effect clouds.
- if (EngineCanCombatHappen.get().canCombatDamageHappen(sub, false)) {
- continue;
- }
+ if (EngineCanCombatHappen.get().canCombatDamageHappen(sub, false)) {
+ continue;
+ }
affectedList.add(affectedEntity);
}
@@ -137,9 +133,9 @@ public class EngineCanCombatHappen extends Engine {
// If the defender is a player ...
Entity edefender = event.getEntity();
- if (MUtil.isntPlayer(edefender)) {
- return true;
- }
+ if (MUtil.isntPlayer(edefender)) {
+ return true;
+ }
Player defender = (Player) edefender;
MPlayer mdefender = MPlayer.get(edefender);
@@ -148,9 +144,9 @@ public class EngineCanCombatHappen extends Engine {
// (we check null here since there may not be an attacker)
// (lack of attacker situations can be caused by other bukkit plugins)
- if (eattacker != null && eattacker.equals(edefender)) {
- return true;
- }
+ if (eattacker != null && eattacker.equals(edefender)) {
+ return true;
+ }
// ... gather defender PS and faction information ...
PS defenderPs = PS.valueOf(defender.getLocation());
@@ -160,13 +156,13 @@ public class EngineCanCombatHappen extends Engine {
if (MUtil.isPlayer(eattacker)) {
MPlayer mplayer = MPlayer.get(eattacker);
- if (mplayer != null && mplayer.isOverriding()) {
- return true;
- }
+ if (mplayer != null && mplayer.isOverriding()) {
+ return true;
+ }
}
// ... PVP flag may cause a damage block ...
- if (defenderPsFaction.getFlag(MFlag.getFlagPvp()) == false) {
+ if (!defenderPsFaction.getFlag(MFlag.getFlagPvp())) {
if (eattacker == null) {
// No attacker?
// Let's behave as if it were a player
@@ -184,16 +180,16 @@ public class EngineCanCombatHappen extends Engine {
}
// ... and if the attacker is a player ...
- if (MUtil.isntPlayer(eattacker)) {
- return true;
- }
+ if (MUtil.isntPlayer(eattacker)) {
+ return true;
+ }
Player attacker = (Player) eattacker;
MPlayer uattacker = MPlayer.get(attacker);
// ... does this player bypass all protection? ...
- if (MConf.get().playersWhoBypassAllProtection.contains(attacker.getName())) {
- return true;
- }
+ if (MConf.get().playersWhoBypassAllProtection.contains(attacker.getName())) {
+ return true;
+ }
// ... gather attacker PS and faction information ...
PS attackerPs = PS.valueOf(attacker.getLocation());
@@ -202,27 +198,27 @@ public class EngineCanCombatHappen extends Engine {
// ... PVP flag may cause a damage block ...
// (just checking the defender as above isn't enough. What about the attacker? It could be in a no-pvp area)
// NOTE: This check is probably not that important but we could keep it anyways.
- if (attackerPsFaction.getFlag(MFlag.getFlagPvp()) == false) {
+ if (!attackerPsFaction.getFlag(MFlag.getFlagPvp())) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.PEACEFUL_LAND, event);
- if (!ret && notify) {
- uattacker.msg("PVP is disabled in %s.", attackerPsFaction.describeTo(uattacker));
- }
+ if (!ret && notify) {
+ uattacker.msg("PVP is disabled in %s.", attackerPsFaction.describeTo(uattacker));
+ }
return ret;
}
// ... are PVP rules completely ignored in this world? ...
- if (!MConf.get().worldsPvpRulesEnabled.contains(defenderPs.getWorld())) {
- return true;
- }
+ if (!MConf.get().worldsPvpRulesEnabled.contains(defenderPs.getWorld())) {
+ return true;
+ }
Faction defendFaction = mdefender.getFaction();
Faction attackFaction = uattacker.getFaction();
if (attackFaction.isNone() && MConf.get().disablePVPForFactionlessPlayers) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.FACTIONLESS, event);
- if (!ret && notify) {
- uattacker.msg("You can't hurt other players until you join a faction.");
- }
+ if (!ret && notify) {
+ uattacker.msg("You can't hurt other players until you join a faction.");
+ }
return ret;
} else if (defendFaction.isNone()) {
if (defenderPsFaction == attackFaction && MConf.get().enablePVPAgainstFactionlessInAttackersLand) {
@@ -230,9 +226,9 @@ public class EngineCanCombatHappen extends Engine {
return true;
} else if (MConf.get().disablePVPForFactionlessPlayers) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.FACTIONLESS, event);
- if (!ret && notify) {
- uattacker.msg("You can't hurt players who are not currently in a faction.");
- }
+ if (!ret && notify) {
+ uattacker.msg("You can't hurt players who are not currently in a faction.");
+ }
return ret;
} else if (attackFaction.isNone() && MConf.get().enablePVPBetweenFactionlessPlayers) {
// Allow factionless vs factionless
@@ -243,11 +239,11 @@ public class EngineCanCombatHappen extends Engine {
Rel relation = defendFaction.getRelationTo(attackFaction);
// Check the relation
- if (relation.isFriend() && defenderPsFaction.getFlag(MFlag.getFlagFriendlyire()) == false) {
+ if (relation.isFriend() && !defenderPsFaction.getFlag(MFlag.getFlagFriendlyire())) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.FRIENDLYFIRE, event);
- if (!ret && notify) {
- uattacker.msg("You can't hurt %s.", relation.getDescPlayerMany());
- }
+ if (!ret && notify) {
+ uattacker.msg("You can't hurt %s.", relation.getDescPlayerMany());
+ }
return ret;
}
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineChat.java b/src/main/java/net/knarcraft/factions/engine/EngineChat.java
index 7ca6fbb7..382c4275 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineChat.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineChat.java
@@ -1,5 +1,8 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.event.EventMassiveCorePlayerToRecipientChat;
+import com.massivecraft.massivecore.util.MUtil;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.Rel;
import net.knarcraft.factions.RelationParticipator;
@@ -7,9 +10,6 @@ import net.knarcraft.factions.chat.ChatFormatter;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.event.EventMassiveCorePlayerToRecipientChat;
-import com.massivecraft.massivecore.util.MUtil;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
@@ -18,6 +18,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
import java.util.Iterator;
import java.util.function.Predicate;
@@ -27,7 +28,7 @@ public class EngineChat extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineChat i = new EngineChat();
+ private static final EngineChat i = new EngineChat();
public static EngineChat get() {
return i;
@@ -64,9 +65,9 @@ public class EngineChat extends Engine {
// SET FORMAT
// -------------------------------------------- //
- private class SetFormatEventExecutor implements EventExecutor {
+ private static class SetFormatEventExecutor implements EventExecutor {
@Override
- public void execute(Listener listener, Event event) throws EventException {
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
try {
if (!(event instanceof AsyncPlayerChatEvent)) {
return;
@@ -86,9 +87,9 @@ public class EngineChat extends Engine {
// PARSE TAGS
// -------------------------------------------- //
- private class ParseTagsEventExecutor implements EventExecutor {
+ private static class ParseTagsEventExecutor implements EventExecutor {
@Override
- public void execute(Listener listener, Event event) throws EventException {
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
try {
if (!(event instanceof AsyncPlayerChatEvent)) {
return;
@@ -115,9 +116,9 @@ public class EngineChat extends Engine {
// PARSE RELCOLOR
// -------------------------------------------- //
- private class ParseRelcolorEventExecutor implements EventExecutor {
+ private static class ParseRelcolorEventExecutor implements EventExecutor {
@Override
- public void execute(Listener listener, Event event) throws EventException {
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
try {
if (!(event instanceof EventMassiveCorePlayerToRecipientChat)) {
return;
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineChunkChange.java b/src/main/java/net/knarcraft/factions/engine/EngineChunkChange.java
index 4be881fd..6cdf4df9 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineChunkChange.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineChunkChange.java
@@ -1,5 +1,11 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.collections.MassiveList;
+import com.massivecraft.massivecore.collections.MassiveSet;
+import com.massivecraft.massivecore.mixin.MixinWorld;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Rel;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
@@ -9,12 +15,6 @@ import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsChunksChange;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.collections.MassiveList;
-import com.massivecraft.massivecore.collections.MassiveSet;
-import com.massivecraft.massivecore.mixin.MixinWorld;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -30,7 +30,7 @@ public class EngineChunkChange extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineChunkChange i = new EngineChunkChange();
+ private static final EngineChunkChange i = new EngineChunkChange();
public static EngineChunkChange get() {
return i;
@@ -60,9 +60,9 @@ public class EngineChunkChange extends Engine {
final Set chunks = event.getChunks();
// Override Mode? Sure!
- if (mplayer.isOverriding()) {
- return;
- }
+ if (mplayer.isOverriding()) {
+ return;
+ }
// CALC: Is there at least one normal faction among the current ones?
boolean currentFactionsContainsAtLeastOneNormal = false;
@@ -156,9 +156,9 @@ public class EngineChunkChange extends Engine {
// HOW: Next we check if the new faction has permission to claim nearby the nearby factions.
MPerm claimnear = MPerm.getPermClaimnear();
for (Faction nearbyFaction : nearbyFactions) {
- if (claimnear.has(mplayer, nearbyFaction, true)) {
- continue;
- }
+ if (claimnear.has(mplayer, nearbyFaction, true)) {
+ continue;
+ }
event.setCancelled(true);
return;
}
@@ -217,14 +217,14 @@ public class EngineChunkChange extends Engine {
Set oldChunks = entry.getValue();
// ... that is an actual faction ...
- if (oldFaction.isNone()) {
- continue;
- }
+ if (oldFaction.isNone()) {
+ continue;
+ }
// ... for which the mplayer lacks permission ...
- if (MPerm.getPermTerritory().has(mplayer, oldFaction, false)) {
- continue;
- }
+ if (MPerm.getPermTerritory().has(mplayer, oldFaction, false)) {
+ continue;
+ }
// ... consider all reasons to forbid "overclaiming/warclaiming" ...
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineCleanInactivity.java b/src/main/java/net/knarcraft/factions/engine/EngineCleanInactivity.java
index a80dc1ed..19538e55 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineCleanInactivity.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineCleanInactivity.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.event.EventMassiveCorePlayerCleanInactivityToleranceMillis;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.MPlayerColl;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.event.EventMassiveCorePlayerCleanInactivityToleranceMillis;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -17,7 +17,7 @@ public class EngineCleanInactivity extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineCleanInactivity i = new EngineCleanInactivity();
+ private static final EngineCleanInactivity i = new EngineCleanInactivity();
public static EngineCleanInactivity get() {
return i;
@@ -29,9 +29,9 @@ public class EngineCleanInactivity extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void ageBonus(EventMassiveCorePlayerCleanInactivityToleranceMillis event) {
- if (event.getColl() != MPlayerColl.get()) {
- return;
- }
+ if (event.getColl() != MPlayerColl.get()) {
+ return;
+ }
applyPlayerAgeBonus(event);
applyFactionAgeBonus(event);
@@ -40,16 +40,16 @@ public class EngineCleanInactivity extends Engine {
public void applyPlayerAgeBonus(EventMassiveCorePlayerCleanInactivityToleranceMillis event) {
// Calculate First Played
Long firstPlayed = event.getEntity().getFirstPlayed();
- Long age = 0L;
+ long age = 0L;
if (firstPlayed != null) {
age = System.currentTimeMillis() - firstPlayed;
}
// Calculate the Bonus!
Long bonus = calculateBonus(age, MConf.get().cleanInactivityToleranceMillisPlayerAgeToBonus);
- if (bonus == null) {
- return;
- }
+ if (bonus == null) {
+ return;
+ }
// Apply
event.getToleranceCauseMillis().put("Player Age Bonus", bonus);
@@ -65,30 +65,30 @@ public class EngineCleanInactivity extends Engine {
// Calculate the Bonus!
Long bonus = calculateBonus(age, MConf.get().cleanInactivityToleranceMillisFactionAgeToBonus);
- if (bonus == null) {
- return;
- }
+ if (bonus == null) {
+ return;
+ }
// Apply
event.getToleranceCauseMillis().put("Faction Age Bonus", bonus);
}
private Long calculateBonus(long age, Map ageToBonus) {
- if (ageToBonus.isEmpty()) {
- return null;
- }
+ if (ageToBonus.isEmpty()) {
+ return null;
+ }
- Long bonus = 0L;
+ long bonus = 0L;
for (Entry entry : ageToBonus.entrySet()) {
Long key = entry.getKey();
- if (key == null) {
- continue;
- }
+ if (key == null) {
+ continue;
+ }
Long value = entry.getValue();
- if (value == null) {
- continue;
- }
+ if (value == null) {
+ continue;
+ }
if (age >= key) {
bonus = value;
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineDenyCommands.java b/src/main/java/net/knarcraft/factions/engine/EngineDenyCommands.java
index 2d6d9a7e..ca47e20f 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineDenyCommands.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineDenyCommands.java
@@ -1,15 +1,15 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.MUtil;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Rel;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MPlayer;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.MUtil;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -22,7 +22,7 @@ public class EngineDenyCommands extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineDenyCommands i = new EngineDenyCommands();
+ private static final EngineDenyCommands i = new EngineDenyCommands();
public static EngineDenyCommands get() {
return i;
@@ -36,15 +36,15 @@ public class EngineDenyCommands extends Engine {
public void denyCommands(PlayerCommandPreprocessEvent event) {
// If a player is trying to run a command ...
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
MPlayer mplayer = MPlayer.get(player);
// ... and the player is not overriding ...
- if (mplayer.isOverriding()) {
- return;
- }
+ if (mplayer.isOverriding()) {
+ return;
+ }
// ... clean up the command ...
String command = event.getMessage();
@@ -72,19 +72,19 @@ public class EngineDenyCommands extends Engine {
if (MConf.get().denyCommandsDistance > -1 && !MConf.get().denyCommandsDistanceBypassIn.contains(factionAtRel)) {
for (Player otherplayer : player.getWorld().getPlayers()) {
MPlayer othermplayer = MPlayer.get(otherplayer);
- if (othermplayer == mplayer) {
- continue;
- }
+ if (othermplayer == mplayer) {
+ continue;
+ }
double distance = player.getLocation().distance(otherplayer.getLocation());
- if (MConf.get().denyCommandsDistance > distance) {
- continue;
- }
+ if (MConf.get().denyCommandsDistance > distance) {
+ continue;
+ }
Rel playerRel = mplayer.getRelationTo(othermplayer);
- if (!MConf.get().denyCommandsDistanceRelation.containsKey(playerRel)) {
- continue;
- }
+ if (!MConf.get().denyCommandsDistanceRelation.containsKey(playerRel)) {
+ continue;
+ }
String desc = playerRel.getDescPlayerOne();
@@ -95,17 +95,17 @@ public class EngineDenyCommands extends Engine {
}
// ... if there is no relation here then there are no further checks ...
- if (factionAtRel == null) {
- return;
- }
+ if (factionAtRel == null) {
+ return;
+ }
List deniedCommands = MConf.get().denyCommandsTerritoryRelation.get(factionAtRel);
- if (deniedCommands == null) {
- return;
- }
- if (!MUtil.containsCommand(command, deniedCommands)) {
- return;
- }
+ if (deniedCommands == null) {
+ return;
+ }
+ if (!MUtil.containsCommand(command, deniedCommands)) {
+ return;
+ }
mplayer.msg("You can't use \"/%s\" in %s territory.", command, Txt.getNicedEnum(factionAtRel));
event.setCancelled(true);
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineDenyTeleport.java b/src/main/java/net/knarcraft/factions/engine/EngineDenyTeleport.java
index 8614ef06..5b24149c 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineDenyTeleport.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineDenyTeleport.java
@@ -1,16 +1,16 @@
package net.knarcraft.factions.engine;
-import net.knarcraft.factions.Rel;
-import net.knarcraft.factions.entity.BoardColl;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MConf;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.Couple;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Rel;
+import net.knarcraft.factions.entity.BoardColl;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MConf;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -25,7 +25,7 @@ public class EngineDenyTeleport extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineDenyTeleport i = new EngineDenyTeleport();
+ private static final EngineDenyTeleport i = new EngineDenyTeleport();
public static EngineDenyTeleport get() {
return i;
@@ -45,9 +45,9 @@ public class EngineDenyTeleport extends Engine {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void canTeleportHappen(PlayerTeleportEvent event) {
Entry entry = shouldBeCancelled(event);
- if (entry == null) {
- return;
- }
+ if (entry == null) {
+ return;
+ }
event.setCancelled(true);
@@ -56,18 +56,18 @@ public class EngineDenyTeleport extends Engine {
String teleportDesc = Txt.getNicedEnum(cause);
String denyDesc = "";
- if (deny == TerritoryType.ENEMY) {
- denyDesc = "enemy";
- }
- if (deny == TerritoryType.WILDERNESS) {
- denyDesc = "wilderness";
- }
- if (deny == TerritoryType.OWN) {
- denyDesc = "your own";
- }
- if (deny == TerritoryType.OTHER) {
- denyDesc = "other faction's";
- }
+ if (deny == TerritoryType.ENEMY) {
+ denyDesc = "enemy";
+ }
+ if (deny == TerritoryType.WILDERNESS) {
+ denyDesc = "wilderness";
+ }
+ if (deny == TerritoryType.OWN) {
+ denyDesc = "your own";
+ }
+ if (deny == TerritoryType.OTHER) {
+ denyDesc = "other faction's";
+ }
Player player = event.getPlayer();
MixinMessage.get().msgOne(player, "Teleportation with %s is not allowed in %s territory.", teleportDesc, denyDesc);
@@ -75,9 +75,9 @@ public class EngineDenyTeleport extends Engine {
private Entry shouldBeCancelled(PlayerTeleportEvent event) {
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return null;
- }
+ if (MUtil.isntPlayer(player)) {
+ return null;
+ }
MPlayer mplayer = MPlayer.get(player);
@@ -92,40 +92,39 @@ public class EngineDenyTeleport extends Engine {
MConf mconf = MConf.get();
if (cause == TeleportCause.CHORUS_FRUIT) {
- if (!mconf.allowChorusFruitInEnemyTerritory && types.contains(TerritoryType.ENEMY)) {
- return Couple.valueOf(cause, TerritoryType.ENEMY);
- }
+ if (!mconf.allowChorusFruitInEnemyTerritory && types.contains(TerritoryType.ENEMY)) {
+ return Couple.valueOf(cause, TerritoryType.ENEMY);
+ }
- if (!mconf.allowChorusFruitInWildernessTerritory && types.contains(TerritoryType.WILDERNESS)) {
- return Couple.valueOf(cause, TerritoryType.WILDERNESS);
- }
+ if (!mconf.allowChorusFruitInWildernessTerritory && types.contains(TerritoryType.WILDERNESS)) {
+ return Couple.valueOf(cause, TerritoryType.WILDERNESS);
+ }
- if (!mconf.allowChorusFruitInOwnTerritory && types.contains(TerritoryType.OWN)) {
- return Couple.valueOf(cause, TerritoryType.OWN);
- }
+ if (!mconf.allowChorusFruitInOwnTerritory && types.contains(TerritoryType.OWN)) {
+ return Couple.valueOf(cause, TerritoryType.OWN);
+ }
- if (!mconf.allowChorusFruitInOtherTerritory && types.contains(TerritoryType.OTHER)) {
- return Couple.valueOf(cause, TerritoryType.OTHER);
- }
+ if (!mconf.allowChorusFruitInOtherTerritory && types.contains(TerritoryType.OTHER)) {
+ return Couple.valueOf(cause, TerritoryType.OTHER);
+ }
} else if (cause == TeleportCause.ENDER_PEARL) {
- if (!mconf.allowEnderPearlInEnemyTerritory && types.contains(TerritoryType.ENEMY)) {
- return Couple.valueOf(cause, TerritoryType.ENEMY);
- }
+ if (!mconf.allowEnderPearlInEnemyTerritory && types.contains(TerritoryType.ENEMY)) {
+ return Couple.valueOf(cause, TerritoryType.ENEMY);
+ }
- if (!mconf.allowEnderPearlInWildernessTerritory && types.contains(TerritoryType.WILDERNESS)) {
- return Couple.valueOf(cause, TerritoryType.WILDERNESS);
- }
+ if (!mconf.allowEnderPearlInWildernessTerritory && types.contains(TerritoryType.WILDERNESS)) {
+ return Couple.valueOf(cause, TerritoryType.WILDERNESS);
+ }
- if (!mconf.allowEnderPearlInOwnTerritory && types.contains(TerritoryType.OWN)) {
- return Couple.valueOf(cause, TerritoryType.OWN);
- }
+ if (!mconf.allowEnderPearlInOwnTerritory && types.contains(TerritoryType.OWN)) {
+ return Couple.valueOf(cause, TerritoryType.OWN);
+ }
+
+ if (!mconf.allowEnderPearlInOtherTerritory && types.contains(TerritoryType.OTHER)) {
+ return Couple.valueOf(cause, TerritoryType.OTHER);
+ }
+ } // Don't cancel other kinds of teleports
- if (!mconf.allowEnderPearlInOtherTerritory && types.contains(TerritoryType.OTHER)) {
- return Couple.valueOf(cause, TerritoryType.OTHER);
- }
- } else {
- // Don't cancel other kinds of teleports
- }
return null;
}
@@ -134,15 +133,15 @@ public class EngineDenyTeleport extends Engine {
Faction territoryFaction = BoardColl.get().getFactionAt(territory);
Rel relation = territoryFaction.getRelationTo(mplayer);
- if (territoryFaction.isNone()) {
- return TerritoryType.WILDERNESS;
- }
- if (relation == Rel.ENEMY) {
- return TerritoryType.ENEMY;
- }
- if (relation == Rel.FACTION) {
- return TerritoryType.OWN;
- }
+ if (territoryFaction.isNone()) {
+ return TerritoryType.WILDERNESS;
+ }
+ if (relation == Rel.ENEMY) {
+ return TerritoryType.ENEMY;
+ }
+ if (relation == Rel.FACTION) {
+ return TerritoryType.OWN;
+ }
return TerritoryType.OTHER;
}
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineEcon.java b/src/main/java/net/knarcraft/factions/engine/EngineEcon.java
index b064705a..a525f6d3 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineEcon.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineEcon.java
@@ -1,5 +1,9 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.money.Money;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.cmd.CmdFactions;
import net.knarcraft.factions.entity.Faction;
@@ -22,10 +26,6 @@ import net.knarcraft.factions.event.EventFactionsWarpAdd;
import net.knarcraft.factions.event.EventFactionsWarpRemove;
import net.knarcraft.factions.event.EventFactionsWarpTeleport;
import net.knarcraft.factions.integration.Econ;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.money.Money;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -39,7 +39,7 @@ public class EngineEcon extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineEcon i = new EngineEcon();
+ private static final EngineEcon i = new EngineEcon();
public static EngineEcon get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineExploit.java b/src/main/java/net/knarcraft/factions/engine/EngineExploit.java
index 857ecd70..55764719 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineExploit.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineExploit.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.engine;
-import net.knarcraft.factions.entity.MConf;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.entity.MConf;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@@ -26,7 +26,7 @@ public class EngineExploit extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineExploit i = new EngineExploit();
+ private static final EngineExploit i = new EngineExploit();
public static EngineExploit get() {
return i;
@@ -38,9 +38,9 @@ public class EngineExploit extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void obsidianGenerators(BlockFromToEvent event) {
- if (!MConf.get().handleExploitObsidianGenerators) {
- return;
- }
+ if (!MConf.get().handleExploitObsidianGenerators) {
+ return;
+ }
// thanks to ObGenBlocker and WorldGuard for this method
Block block = event.getToBlock();
@@ -57,12 +57,12 @@ public class EngineExploit extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void enderPearlClipping(PlayerTeleportEvent event) {
- if (!MConf.get().handleExploitEnderPearlClipping) {
- return;
- }
- if (event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
- return;
- }
+ if (!MConf.get().handleExploitEnderPearlClipping) {
+ return;
+ }
+ if (event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
+ return;
+ }
// this exploit works when the target location is within 0.31 blocks or so of a door or glass block or similar...
Location target = event.getTo();
@@ -104,31 +104,31 @@ public class EngineExploit extends Engine {
private static final int NETHER_TRAP_RADIUS_CHECK = 5;
private static final int NETHER_TRAP_RESET_RADIUS_SQUARED = 9;
- private HashMap> portalTraps = new HashMap<>();
+ private final HashMap> portalTraps = new HashMap<>();
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void portalTrapRemoveAnimation(PlayerTeleportEvent event) {
// If there is a teleport caused by a nether portal ...
- if (!MConf.get().handleNetherPortalTrap || event.getCause() != TeleportCause.NETHER_PORTAL) {
- return;
- }
+ if (!MConf.get().handleNetherPortalTrap || event.getCause() != TeleportCause.NETHER_PORTAL) {
+ return;
+ }
Player player = event.getPlayer();
Block from = event.getTo().getBlock();
// ... and the player can't build at the destination ...
- if (EnginePermBuild.canPlayerBuildAt(player, PS.valueOf(from), false)) {
- return;
- }
+ if (EnginePermBuild.canPlayerBuildAt(player, PS.valueOf(from), false)) {
+ return;
+ }
// ... reset the old portal blocks stored ...
this.portalReset(player);
// ... get all the portal blocks belonging to the new portal at the destination ...
List portalTrap = getPortal(from);
- if (portalTrap.isEmpty()) {
- return;
- }
+ if (portalTrap.isEmpty()) {
+ return;
+ }
// ... and then store those blocks and send an update as if they were air.
this.portalTraps.put(player.getUniqueId(), portalTrap);
@@ -138,18 +138,18 @@ public class EngineExploit extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void portalUpdate(PlayerMoveEvent event) {
// If a player moves ...
- if (!MConf.get().handleNetherPortalTrap || MUtil.isSameBlock(event)) {
- return;
- }
+ if (!MConf.get().handleNetherPortalTrap || MUtil.isSameBlock(event)) {
+ return;
+ }
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
// ... and he recently used a portal ...
List portalTrap = this.portalTraps.get(uuid);
- if (portalTrap == null) {
- return;
- }
+ if (portalTrap == null) {
+ return;
+ }
Location locationTo = event.getTo();
Location locationFrom = portalTrap.get(0).getLocation();
@@ -172,17 +172,17 @@ public class EngineExploit extends Engine {
// If a player has already a portal registered to him ...
List portalTrap = this.portalTraps.get(uuid);
- if (portalTrap == null) {
- return;
- }
+ if (portalTrap == null) {
+ return;
+ }
// ... remove them from the registry ...
this.portalTraps.remove(uuid);
// ... and send updates if the player and portal are in the same world.
- if (!player.getWorld().equals(portalTrap.get(0).getWorld())) {
- return;
- }
+ if (!player.getWorld().equals(portalTrap.get(0).getWorld())) {
+ return;
+ }
portalUpdateReset(player, portalTrap);
}
@@ -212,9 +212,9 @@ public class EngineExploit extends Engine {
for (int x = -(NETHER_TRAP_RADIUS_CHECK); x <= NETHER_TRAP_RADIUS_CHECK; x++) {
for (int y = -(NETHER_TRAP_RADIUS_CHECK); y <= NETHER_TRAP_RADIUS_CHECK; y++) {
for (int z = -(NETHER_TRAP_RADIUS_CHECK); z <= NETHER_TRAP_RADIUS_CHECK; z++) {
- if (from.getRelative(x, y, z).getType() == Material.NETHER_PORTAL) {
- ret.add(from.getRelative(x, y, z));
- }
+ if (from.getRelative(x, y, z).getType() == Material.NETHER_PORTAL) {
+ ret.add(from.getRelative(x, y, z));
+ }
}
}
}
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineFlagEndergrief.java b/src/main/java/net/knarcraft/factions/engine/EngineFlagEndergrief.java
index 9790df27..7a7a82c2 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineFlagEndergrief.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineFlagEndergrief.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.ps.PS;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MFlag;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.ps.PS;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
@@ -16,7 +16,7 @@ public class EngineFlagEndergrief extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineFlagEndergrief i = new EngineFlagEndergrief();
+ private static final EngineFlagEndergrief i = new EngineFlagEndergrief();
public static EngineFlagEndergrief get() {
return i;
@@ -30,16 +30,16 @@ public class EngineFlagEndergrief extends Engine {
public void blockEndergrief(EntityChangeBlockEvent event) {
// If an enderman is changing a block ...
Entity entity = event.getEntity();
- if (!(entity instanceof Enderman)) {
- return;
- }
+ if (!(entity instanceof Enderman)) {
+ return;
+ }
// ... and the faction there has endergrief disabled ...
PS ps = PS.valueOf(event.getBlock());
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction.getFlag(MFlag.getFlagEndergrief())) {
- return;
- }
+ if (faction.getFlag(MFlag.getFlagEndergrief())) {
+ return;
+ }
// ... stop the block alteration.
event.setCancelled(true);
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineFlagExplosion.java b/src/main/java/net/knarcraft/factions/engine/EngineFlagExplosion.java
index 60290755..a1706b77 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineFlagExplosion.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineFlagExplosion.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.ps.PS;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.util.EnumerationUtil;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.ps.PS;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
@@ -32,7 +32,7 @@ public class EngineFlagExplosion extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineFlagExplosion i = new EngineFlagExplosion();
+ private static final EngineFlagExplosion i = new EngineFlagExplosion();
public static EngineFlagExplosion get() {
return i;
@@ -42,21 +42,21 @@ public class EngineFlagExplosion extends Engine {
// FLAG: EXPLOSIONS
// -------------------------------------------- //
- protected Set DAMAGE_CAUSE_EXPLOSIONS = EnumSet.of(DamageCause.BLOCK_EXPLOSION, DamageCause.ENTITY_EXPLOSION);
+ protected final Set DAMAGE_CAUSE_EXPLOSIONS = EnumSet.of(DamageCause.BLOCK_EXPLOSION, DamageCause.ENTITY_EXPLOSION);
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockExplosion(HangingBreakEvent event) {
// If a hanging entity was broken by an explosion ...
- if (event.getCause() != RemoveCause.EXPLOSION) {
- return;
- }
+ if (event.getCause() != RemoveCause.EXPLOSION) {
+ return;
+ }
Entity entity = event.getEntity();
// ... and the faction there has explosions disabled ...
Faction faction = BoardColl.get().getFactionAt(PS.valueOf(entity.getLocation()));
- if (faction.isExplosionsAllowed()) {
- return;
- }
+ if (faction.isExplosionsAllowed()) {
+ return;
+ }
// ... then cancel.
event.setCancelled(true);
@@ -65,19 +65,19 @@ public class EngineFlagExplosion extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockExplosion(EntityDamageEvent event) {
// If an explosion damages ...
- if (!DAMAGE_CAUSE_EXPLOSIONS.contains(event.getCause())) {
- return;
- }
+ if (!DAMAGE_CAUSE_EXPLOSIONS.contains(event.getCause())) {
+ return;
+ }
// ... an entity that is modified on damage ...
- if (!EnumerationUtil.isEntityTypeEditOnDamage(event.getEntityType())) {
- return;
- }
+ if (!EnumerationUtil.isEntityTypeEditOnDamage(event.getEntityType())) {
+ return;
+ }
// ... and the faction has explosions disabled ...
- if (BoardColl.get().getFactionAt(PS.valueOf(event.getEntity())).isExplosionsAllowed()) {
- return;
- }
+ if (BoardColl.get().getFactionAt(PS.valueOf(event.getEntity())).isExplosionsAllowed()) {
+ return;
+ }
// ... then cancel!
event.setCancelled(true);
@@ -86,10 +86,9 @@ public class EngineFlagExplosion extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockExplosion(EntityExplodeEvent event) {
Location location = event.getLocation();
- Cancellable cancellable = event;
Collection blocks = event.blockList();
- blockExplosion(location, cancellable, blocks);
+ blockExplosion(location, event, blocks);
}
// Note that this method is used by EngineV18 for the BlockExplodeEvent
@@ -117,9 +116,9 @@ public class EngineFlagExplosion extends Engine {
faction2allowed.put(faction, allowed);
}
- if (!allowed) {
- iterator.remove();
- }
+ if (!allowed) {
+ iterator.remove();
+ }
}
}
@@ -127,17 +126,17 @@ public class EngineFlagExplosion extends Engine {
public void blockExplosion(EntityChangeBlockEvent event) {
// If a wither is changing a block ...
Entity entity = event.getEntity();
- if (!(entity instanceof Wither)) {
- return;
- }
+ if (!(entity instanceof Wither)) {
+ return;
+ }
// ... and the faction there has explosions disabled ...
PS ps = PS.valueOf(event.getBlock());
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction.isExplosionsAllowed()) {
- return;
- }
+ if (faction.isExplosionsAllowed()) {
+ return;
+ }
// ... stop the block alteration.
event.setCancelled(true);
@@ -146,10 +145,9 @@ public class EngineFlagExplosion extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockExplosion(BlockExplodeEvent event) {
Location location = event.getBlock().getLocation();
- Cancellable cancellable = event;
Collection blocks = event.blockList();
- EngineFlagExplosion.get().blockExplosion(location, cancellable, blocks);
+ EngineFlagExplosion.get().blockExplosion(location, event, blocks);
}
}
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineFlagFireSpread.java b/src/main/java/net/knarcraft/factions/engine/EngineFlagFireSpread.java
index 218c97bc..810d63f0 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineFlagFireSpread.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineFlagFireSpread.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.ps.PS;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MFlag;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.ps.PS;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.Cancellable;
@@ -20,7 +20,7 @@ public class EngineFlagFireSpread extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineFlagFireSpread i = new EngineFlagFireSpread();
+ private static final EngineFlagFireSpread i = new EngineFlagFireSpread();
public static EngineFlagFireSpread get() {
return i;
@@ -35,9 +35,9 @@ public class EngineFlagFireSpread extends Engine {
PS ps = PS.valueOf(block);
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction.getFlag(MFlag.getFlagFirespread())) {
- return;
- }
+ if (faction.getFlag(MFlag.getFlagFirespread())) {
+ return;
+ }
// then cancel the event.
cancellable.setCancelled(true);
@@ -46,9 +46,9 @@ public class EngineFlagFireSpread extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockFireSpread(BlockIgniteEvent event) {
// If fire is spreading ...
- if (event.getCause() != IgniteCause.SPREAD && event.getCause() != IgniteCause.LAVA) {
- return;
- }
+ if (event.getCause() != IgniteCause.SPREAD && event.getCause() != IgniteCause.LAVA) {
+ return;
+ }
// ... consider blocking it.
blockFireSpread(event.getBlock(), event);
@@ -58,9 +58,9 @@ public class EngineFlagFireSpread extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockFireSpread(BlockSpreadEvent event) {
// If fire is spreading ...
- if (event.getNewState().getType() != Material.FIRE) {
- return;
- }
+ if (event.getNewState().getType() != Material.FIRE) {
+ return;
+ }
// ... consider blocking it.
blockFireSpread(event.getBlock(), event);
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineFlagSpawn.java b/src/main/java/net/knarcraft/factions/engine/EngineFlagSpawn.java
index 6b568fed..8b7cae24 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineFlagSpawn.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineFlagSpawn.java
@@ -1,12 +1,12 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.collections.BackstringSet;
+import com.massivecraft.massivecore.ps.PS;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.util.EnumerationUtil;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.collections.BackstringSet;
-import com.massivecraft.massivecore.ps.PS;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
@@ -21,7 +21,7 @@ public class EngineFlagSpawn extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineFlagSpawn i = new EngineFlagSpawn();
+ private static final EngineFlagSpawn i = new EngineFlagSpawn();
public static EngineFlagSpawn get() {
return i;
@@ -52,9 +52,9 @@ public class EngineFlagSpawn extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockMonstersAndAnimals(CreatureSpawnEvent event) {
// If this is a natural spawn ..
- if (!NATURAL_SPAWN_REASONS.contains(event.getSpawnReason())) {
- return;
- }
+ if (!NATURAL_SPAWN_REASONS.contains(event.getSpawnReason())) {
+ return;
+ }
// ... get the spawn location ...
Location location = event.getLocation();
@@ -62,17 +62,17 @@ public class EngineFlagSpawn extends Engine {
// ... get the faction there ...
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction == null) {
- return;
- }
+ if (faction == null) {
+ return;
+ }
// ... get the entity type ...
EntityType type = event.getEntityType();
// ... and if this type can't spawn in the faction ...
- if (canSpawn(faction, type)) {
- return;
- }
+ if (canSpawn(faction, type)) {
+ return;
+ }
// ... then cancel.
event.setCancelled(true);
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineFlagZombiegrief.java b/src/main/java/net/knarcraft/factions/engine/EngineFlagZombiegrief.java
index 319fff21..599b73b7 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineFlagZombiegrief.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineFlagZombiegrief.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.ps.PS;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MFlag;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.ps.PS;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
@@ -16,7 +16,7 @@ public class EngineFlagZombiegrief extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineFlagZombiegrief i = new EngineFlagZombiegrief();
+ private static final EngineFlagZombiegrief i = new EngineFlagZombiegrief();
public static EngineFlagZombiegrief get() {
return i;
@@ -30,16 +30,16 @@ public class EngineFlagZombiegrief extends Engine {
public void denyZombieGrief(EntityBreakDoorEvent event) {
// If a zombie is breaking a door ...
Entity entity = event.getEntity();
- if (!(entity instanceof Zombie)) {
- return;
- }
+ if (!(entity instanceof Zombie)) {
+ return;
+ }
// ... and the faction there has zombiegrief disabled ...
PS ps = PS.valueOf(event.getBlock());
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction.getFlag(MFlag.getFlagZombiegrief())) {
- return;
- }
+ if (faction.getFlag(MFlag.getFlagZombiegrief())) {
+ return;
+ }
// ... stop the door breakage.
event.setCancelled(true);
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineFly.java b/src/main/java/net/knarcraft/factions/engine/EngineFly.java
index a9662606..faadca07 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineFly.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineFly.java
@@ -1,5 +1,11 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.MassiveException;
+import com.massivecraft.massivecore.event.EventMassiveCorePlayerUpdate;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.store.DriverFlatfile;
+import com.massivecraft.massivecore.util.MUtil;
import net.knarcraft.factions.Perm;
import net.knarcraft.factions.cmd.CmdFactions;
import net.knarcraft.factions.entity.BoardColl;
@@ -10,12 +16,6 @@ import net.knarcraft.factions.entity.MFlagColl;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsFlagChange;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.MassiveException;
-import com.massivecraft.massivecore.event.EventMassiveCorePlayerUpdate;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.store.DriverFlatfile;
-import com.massivecraft.massivecore.util.MUtil;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -30,7 +30,7 @@ public class EngineFly extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineFly i = new EngineFly();
+ private static final EngineFly i = new EngineFly();
public static EngineFly get() {
return i;
@@ -44,31 +44,31 @@ public class EngineFly extends Engine {
public void onMassiveCorePlayerUpdate(EventMassiveCorePlayerUpdate event) {
// If we are updating a player ...
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
// ... and that player isn't in creative or spectator mode ...
- if (EventMassiveCorePlayerUpdate.isFlyAllowed(player, false)) {
- return;
- }
+ if (EventMassiveCorePlayerUpdate.isFlyAllowed(player, false)) {
+ return;
+ }
// ... and the player is alive ...
- if (player.isDead()) {
- return;
- }
+ if (player.isDead()) {
+ return;
+ }
MPlayer mplayer = MPlayer.get(player);
// ... and the player enables flying ...
- if (!mplayer.isFlying()) {
- return;
- }
+ if (!mplayer.isFlying()) {
+ return;
+ }
// ... and the player can fly here...
- if (!canFlyInTerritory(mplayer, PS.valueOf(player))) {
- return;
- }
+ if (!canFlyInTerritory(mplayer, PS.valueOf(player))) {
+ return;
+ }
// ... set allowed ...
event.setAllowed(true);
@@ -80,27 +80,27 @@ public class EngineFly extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void moveChunkDetect(PlayerMoveEvent event) {
// If the player is moving from one chunk to another ...
- if (MUtil.isSameChunk(event)) {
- return;
- }
+ if (MUtil.isSameChunk(event)) {
+ return;
+ }
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
// ... gather info on the player and the move ...
MPlayer mplayer = MPlayer.get(player);
PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
// ... and they are currently flying ...
- if (!mplayer.isFlying()) {
- return;
- }
+ if (!mplayer.isFlying()) {
+ return;
+ }
// ... but can't fly at the new place ...
- if (canFlyInTerritory(mplayer, chunkTo)) {
- return;
- }
+ if (canFlyInTerritory(mplayer, chunkTo)) {
+ return;
+ }
// ... then perhaps they should not be
mplayer.setFlying(false);
@@ -109,12 +109,12 @@ public class EngineFly extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void flagUpdate(EventFactionsFlagChange event) {
- if (event.getFlag() != MFlag.getFlagFly()) {
- return;
- }
- if (event.isNewValue() == true) {
- return;
- }
+ if (event.getFlag() != MFlag.getFlagFly()) {
+ return;
+ }
+ if (event.isNewValue()) {
+ return;
+ }
// Disable for all players when disabled
event.getFaction().getOnlinePlayers().forEach(EngineFly::deactivateForPlayer);
@@ -123,24 +123,23 @@ public class EngineFly extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void territoryShield(EntityDamageByEntityEvent event) {
// If flying is diabled on PVP ...
- if (!MConf.get().flyDisableOnPvp) {
- return;
- }
+ if (!MConf.get().flyDisableOnPvp) {
+ return;
+ }
// ... and the defender is a player ...
Entity entity = event.getEntity();
- if (MUtil.isntPlayer(entity)) {
- return;
- }
+ if (MUtil.isntPlayer(entity)) {
+ return;
+ }
Player defender = (Player) entity;
MPlayer mdefender = MPlayer.get(defender);
// ... and the attacker is a player ...
Entity eattacker = MUtil.getLiableDamager(event);
- if (!(eattacker instanceof Player)) {
- return;
- }
- Player attacker = (Player) eattacker;
+ if (!(eattacker instanceof Player attacker)) {
+ return;
+ }
MPlayer mattacker = MPlayer.get(attacker);
// ... disable flying for both
@@ -206,12 +205,12 @@ public class EngineFly extends Engine {
if (isAdmin) {
boolean overriding = mplayer.isOverriding();
ex.addMsg("You can change the flag if you are overriding.");
- if (overriding) {
- ex.addMsg("You are already overriding.");
- } else {
- ex.addMsg("You can enable override with:");
- ex.addMessage(CmdFactions.get().cmdFactionsOverride.getTemplate(false, true, mplayer.getSender()));
- }
+ if (overriding) {
+ ex.addMsg("You are already overriding.");
+ } else {
+ ex.addMsg("You can enable override with:");
+ ex.addMessage(CmdFactions.get().cmdFactionsOverride.getTemplate(false, true, mplayer.getSender()));
+ }
if (!isDefault) {
ex.addMsg("You can also ask someone with access to the configuration files to make flying enabled by default.");
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineLastActivity.java b/src/main/java/net/knarcraft/factions/engine/EngineLastActivity.java
index 926e8ab3..1069337b 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineLastActivity.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineLastActivity.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.engine;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.event.EventHandler;
@@ -16,7 +16,7 @@ public class EngineLastActivity extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineLastActivity i = new EngineLastActivity();
+ private static final EngineLastActivity i = new EngineLastActivity();
public static EngineLastActivity get() {
return i;
@@ -27,21 +27,21 @@ public class EngineLastActivity extends Engine {
// -------------------------------------------- //
public static void updateLastActivity(CommandSender sender) {
- if (sender == null) {
- throw new RuntimeException("sender");
- }
- if (MUtil.isntSender(sender)) {
- return;
- }
+ if (sender == null) {
+ throw new RuntimeException("sender");
+ }
+ if (MUtil.isntSender(sender)) {
+ return;
+ }
MPlayer mplayer = MPlayer.get(sender);
mplayer.setLastActivityMillis();
}
public static void updateLastActivitySoon(final CommandSender sender) {
- if (sender == null) {
- throw new RuntimeException("sender");
- }
+ if (sender == null) {
+ throw new RuntimeException("sender");
+ }
Bukkit.getScheduler().scheduleSyncDelayedTask(Factions.get(), () -> updateLastActivity(sender));
}
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineMotd.java b/src/main/java/net/knarcraft/factions/engine/EngineMotd.java
index 22ada40d..353afd1d 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineMotd.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineMotd.java
@@ -1,13 +1,13 @@
package net.knarcraft.factions.engine;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.entity.Faction;
-import net.knarcraft.factions.entity.MConf;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.mixin.MixinActual;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.entity.Faction;
+import net.knarcraft.factions.entity.MConf;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -21,7 +21,7 @@ public class EngineMotd extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineMotd i = new EngineMotd();
+ private static final EngineMotd i = new EngineMotd();
public static EngineMotd get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineMoveChunk.java b/src/main/java/net/knarcraft/factions/engine/EngineMoveChunk.java
index 73cde117..4b0042cc 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineMoveChunk.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineMoveChunk.java
@@ -1,5 +1,10 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.mixin.MixinTitle;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.MUtil;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.AccessStatus;
import net.knarcraft.factions.TerritoryAccess;
import net.knarcraft.factions.entity.BoardColl;
@@ -7,11 +12,6 @@ import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.util.AsciiMap;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.mixin.MixinTitle;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.MUtil;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -24,7 +24,7 @@ public class EngineMoveChunk extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineMoveChunk i = new EngineMoveChunk();
+ private static final EngineMoveChunk i = new EngineMoveChunk();
public static EngineMoveChunk get() {
return i;
@@ -37,13 +37,13 @@ public class EngineMoveChunk extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void moveChunkDetect(PlayerMoveEvent event) {
// If the player is moving from one chunk to another ...
- if (MUtil.isSameChunk(event)) {
- return;
- }
+ if (MUtil.isSameChunk(event)) {
+ return;
+ }
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
// ... gather info on the player and the move ...
MPlayer mplayer = MPlayer.get(player);
@@ -67,9 +67,9 @@ public class EngineMoveChunk extends Engine {
}
private static void sendAutoMapUpdate(MPlayer mplayer, PS ps) {
- if (!mplayer.isMapAutoUpdating()) {
- return;
- }
+ if (!mplayer.isMapAutoUpdating()) {
+ return;
+ }
AsciiMap map = new AsciiMap(mplayer, ps, false);
mplayer.message(map.render());
}
@@ -78,9 +78,9 @@ public class EngineMoveChunk extends Engine {
Faction factionFrom = BoardColl.get().getFactionAt(psFrom);
Faction factionTo = BoardColl.get().getFactionAt(psTo);
- if (factionFrom == factionTo) {
- return;
- }
+ if (factionFrom == factionTo) {
+ return;
+ }
if (mplayer.isTerritoryInfoTitles()) {
String titleMain = parseTerritoryInfo(MConf.get().territoryInfoTitlesMain, mplayer, factionTo);
@@ -96,12 +96,12 @@ public class EngineMoveChunk extends Engine {
}
private static String parseTerritoryInfo(String string, MPlayer mplayer, Faction faction) {
- if (string == null) {
- throw new NullPointerException("string");
- }
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (string == null) {
+ throw new NullPointerException("string");
+ }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
string = Txt.parse(string);
string = string.replace("{name}", faction.getName());
@@ -112,9 +112,9 @@ public class EngineMoveChunk extends Engine {
}
private static void sendTerritoryAccessMessage(MPlayer mplayer, PS psFrom, PS psTo) {
- if (!MConf.get().territoryAccessShowMessage) {
- return;
- }
+ if (!MConf.get().territoryAccessShowMessage) {
+ return;
+ }
// Get TerritoryAccess for from & to chunks
TerritoryAccess accessFrom = BoardColl.get().getTerritoryAccessAt(psFrom);
@@ -123,9 +123,9 @@ public class EngineMoveChunk extends Engine {
// See if the status has changed
AccessStatus statusFrom = accessFrom.getTerritoryAccess(mplayer);
AccessStatus statusTo = accessTo.getTerritoryAccess(mplayer);
- if (statusFrom == statusTo) {
- return;
- }
+ if (statusFrom == statusTo) {
+ return;
+ }
// Inform
mplayer.message(statusTo.getStatusMessage());
@@ -138,9 +138,9 @@ public class EngineMoveChunk extends Engine {
private static void tryAutoClaim(MPlayer mplayer, PS chunkTo) {
// If the player is auto claiming ...
Faction autoClaimFaction = mplayer.getAutoClaimFaction();
- if (autoClaimFaction == null) {
- return;
- }
+ if (autoClaimFaction == null) {
+ return;
+ }
// ... try claim.
mplayer.tryClaim(autoClaimFaction, Collections.singletonList(chunkTo));
diff --git a/src/main/java/net/knarcraft/factions/engine/EnginePermBuild.java b/src/main/java/net/knarcraft/factions/engine/EnginePermBuild.java
index fcfdc866..6e2be820 100644
--- a/src/main/java/net/knarcraft/factions/engine/EnginePermBuild.java
+++ b/src/main/java/net/knarcraft/factions/engine/EnginePermBuild.java
@@ -1,5 +1,8 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.MUtil;
import net.knarcraft.factions.Factions;
import net.knarcraft.factions.TerritoryAccess;
import net.knarcraft.factions.entity.Board;
@@ -10,9 +13,6 @@ import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPerm;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.util.EnumerationUtil;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.MUtil;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@@ -51,7 +51,7 @@ public class EnginePermBuild extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EnginePermBuild i = new EnginePermBuild();
+ private static final EnginePermBuild i = new EnginePermBuild();
public static EnginePermBuild get() {
return i;
@@ -62,39 +62,39 @@ public class EnginePermBuild extends Engine {
// -------------------------------------------- //
public static Boolean isProtected(ProtectCase protectCase, boolean verboose, MPlayer mplayer, PS ps, Object object) {
- if (mplayer == null) {
- return null;
- }
- if (protectCase == null) {
- return null;
- }
+ if (mplayer == null) {
+ return null;
+ }
+ if (protectCase == null) {
+ return null;
+ }
String name = mplayer.getName();
- if (MConf.get().playersWhoBypassAllProtection.contains(name)) {
- return false;
- }
- if (mplayer.isOverriding()) {
- return false;
- }
+ if (MConf.get().playersWhoBypassAllProtection.contains(name)) {
+ return false;
+ }
+ if (mplayer.isOverriding()) {
+ return false;
+ }
MPerm perm = protectCase.getPerm(object);
- if (perm == null) {
- return null;
- }
- if (protectCase != ProtectCase.BUILD) {
- return !perm.has(mplayer, ps, verboose);
- }
+ if (perm == null) {
+ return null;
+ }
+ if (protectCase != ProtectCase.BUILD) {
+ return !perm.has(mplayer, ps, verboose);
+ }
if (!perm.has(mplayer, ps, false) && MPerm.getPermPainbuild().has(mplayer, ps, false)) {
- if (!verboose) {
- return false;
- }
+ if (!verboose) {
+ return false;
+ }
Faction hostFaction = BoardColl.get().getFactionAt(ps);
mplayer.msg("It is painful to build in the territory of %s.", hostFaction.describeTo(mplayer));
Player player = mplayer.getPlayer();
- if (player != null) {
- player.damage(MConf.get().actionDeniedPainAmount);
- }
+ if (player != null) {
+ player.damage(MConf.get().actionDeniedPainAmount);
+ }
}
return !perm.has(mplayer, ps, verboose);
@@ -102,20 +102,20 @@ public class EnginePermBuild extends Engine {
public static Boolean protect(ProtectCase protectCase, boolean verboose, Player player, PS ps, Object object, Cancellable cancellable) {
Boolean ret = isProtected(protectCase, verboose, MPlayer.get(player), ps, object);
- if (Boolean.TRUE.equals(ret) && cancellable != null) {
- cancellable.setCancelled(true);
- }
+ if (Boolean.TRUE.equals(ret) && cancellable != null) {
+ cancellable.setCancelled(true);
+ }
return ret;
}
public static Boolean build(Entity entity, Block block, Event event) {
- if (!(event instanceof Cancellable)) {
- return true;
- }
- if (MUtil.isntPlayer(entity)) {
- return false;
- }
+ if (!(event instanceof Cancellable)) {
+ return true;
+ }
+ if (MUtil.isntPlayer(entity)) {
+ return false;
+ }
Player player = (Player) entity;
boolean verboose = !isFake(event);
return protect(ProtectCase.BUILD, verboose, player, PS.valueOf(block), block, (Cancellable) event);
@@ -139,9 +139,9 @@ public class EnginePermBuild extends Engine {
public static boolean canPlayerBuildAt(Object senderObject, PS ps, boolean verboose) {
MPlayer mplayer = MPlayer.get(senderObject);
- if (mplayer == null) {
- return false;
- }
+ if (mplayer == null) {
+ return false;
+ }
Boolean ret = isProtected(ProtectCase.BUILD, verboose, mplayer, ps, null);
return !Boolean.TRUE.equals(ret);
@@ -180,9 +180,9 @@ public class EnginePermBuild extends Engine {
public void build(EntityChangeBlockEvent event) {
// Handling lilypads being broken by boats
Entity entity = event.getEntity();
- if (entity.getType() != EntityType.BOAT || entity.getPassengers().size() <= 0) {
- return;
- }
+ if (entity.getType() != EntityType.BOAT || entity.getPassengers().size() <= 0) {
+ return;
+ }
Entity player = entity.getPassengers().stream().filter(MUtil::isPlayer).findAny().orElse(entity);
build(player, event.getBlock(), event);
@@ -196,26 +196,26 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void useBlockItem(PlayerInteractEvent event) {
// If the player right clicks (or is physical with) a block ...
- if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.PHYSICAL) {
- return;
- }
+ if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.PHYSICAL) {
+ return;
+ }
Block block = event.getClickedBlock();
Player player = event.getPlayer();
- if (block == null) {
- return;
- }
+ if (block == null) {
+ return;
+ }
// ... and we are either allowed to use this block ...
Boolean ret = useBlock(player, block, true, event);
- if (Boolean.TRUE.equals(ret)) {
- return;
- }
+ if (Boolean.TRUE.equals(ret)) {
+ return;
+ }
// ... or are allowed to right click with the item, this event is safe to perform.
- if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
- return;
- }
+ if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
+ return;
+ }
useItem(player, block, event.getMaterial(), event);
}
@@ -241,9 +241,9 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void useEntity(PlayerInteractEntityEvent event) {
// Ignore Off Hand
- if (isOffHand(event)) {
- return;
- }
+ if (isOffHand(event)) {
+ return;
+ }
useEntity(event.getPlayer(), event.getRightClicked(), true, event);
}
@@ -254,22 +254,22 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void handleArmorStand(PlayerInteractAtEntityEvent event) {
// Ignore Off Hand
- if (isOffHand(event)) {
- return;
- }
+ if (isOffHand(event)) {
+ return;
+ }
// Gather Info
final Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
final Entity entity = event.getRightClicked();
final boolean verboose = true;
// Only care for armor stands.
- if (entity.getType() != EntityType.ARMOR_STAND) {
- return;
- }
+ if (entity.getType() != EntityType.ARMOR_STAND) {
+ return;
+ }
// If we can't use, block it
EnginePermBuild.useEntity(player, entity, verboose, event);
@@ -283,16 +283,16 @@ public class EnginePermBuild extends Engine {
public void buildEntity(EntityDamageByEntityEvent event) {
// If a player ...
Entity damager = MUtil.getLiableDamager(event);
- if (MUtil.isntPlayer(damager)) {
- return;
- }
+ if (MUtil.isntPlayer(damager)) {
+ return;
+ }
Player player = (Player) damager;
// ... damages an entity which is edited on damage ...
Entity entity = event.getEntity();
- if (entity == null || !EnumerationUtil.isEntityTypeEditOnDamage(entity.getType())) {
- return;
- }
+ if (entity == null || !EnumerationUtil.isEntityTypeEditOnDamage(entity.getType())) {
+ return;
+ }
// ... and the player can't build there, cancel the event
build(player, entity.getLocation().getBlock(), event);
@@ -302,23 +302,22 @@ public class EnginePermBuild extends Engine {
public void combustEntity(EntityCombustByEntityEvent event) {
// If a burning projectile ...
- if (!(event.getCombuster() instanceof Projectile)) {
- return;
- }
- Projectile entityProjectile = (Projectile) event.getCombuster();
+ if (!(event.getCombuster() instanceof Projectile entityProjectile)) {
+ return;
+ }
// ... fired by a player ...
ProjectileSource projectileSource = entityProjectile.getShooter();
- if (MUtil.isntPlayer(projectileSource)) {
- return;
- }
+ if (MUtil.isntPlayer(projectileSource)) {
+ return;
+ }
Player player = (Player) projectileSource;
// ... and hits an entity which is edited on damage (and thus likely to burn) ...
Entity entityTarget = event.getEntity();
- if (entityTarget == null || !EnumerationUtil.isEntityTypeEditOnDamage(entityTarget.getType())) {
- return;
- }
+ if (entityTarget == null || !EnumerationUtil.isEntityTypeEditOnDamage(entityTarget.getType())) {
+ return;
+ }
// ... and the player can't build there, cancel the event
Block block = entityTarget.getLocation().getBlock();
@@ -339,9 +338,9 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockBuild(BlockPistonExtendEvent event) {
// Is checking deactivated by MConf?
- if (!MConf.get().handlePistonProtectionThroughDenyBuild) {
- return;
- }
+ if (!MConf.get().handlePistonProtectionThroughDenyBuild) {
+ return;
+ }
Faction pistonFaction = BoardColl.get().getFactionAt(PS.valueOf(event.getBlock()));
@@ -354,14 +353,14 @@ public class EnginePermBuild extends Engine {
// Members of a faction might not have build rights in their own territory, but pistons should still work regardless
Faction targetFaction = BoardColl.get().getFactionAt(PS.valueOf(targetBlock));
- if (targetFaction == pistonFaction) {
- continue;
- }
+ if (targetFaction == pistonFaction) {
+ continue;
+ }
// Perm check
- if (MPerm.getPermBuild().has(pistonFaction, targetFaction)) {
- continue;
- }
+ if (MPerm.getPermBuild().has(pistonFaction, targetFaction)) {
+ continue;
+ }
event.setCancelled(true);
return;
@@ -371,9 +370,9 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockBuild(BlockPistonRetractEvent event) {
// Is checking deactivated by MConf?
- if (!MConf.get().handlePistonProtectionThroughDenyBuild) {
- return;
- }
+ if (!MConf.get().handlePistonProtectionThroughDenyBuild) {
+ return;
+ }
Faction pistonFaction = BoardColl.get().getFactionAt(PS.valueOf(event.getBlock()));
@@ -382,20 +381,20 @@ public class EnginePermBuild extends Engine {
// Check for all retracted blocks
for (Block block : blocks) {
// Is the retracted block air/water/lava? Don't worry about it
- if (block.isEmpty() || block.isLiquid()) {
- return;
- }
+ if (block.isEmpty() || block.isLiquid()) {
+ return;
+ }
// Members of a faction might not have build rights in their own territory, but pistons should still work regardless
Faction targetFaction = BoardColl.get().getFactionAt(PS.valueOf(block));
- if (targetFaction == pistonFaction) {
- continue;
- }
+ if (targetFaction == pistonFaction) {
+ continue;
+ }
// Perm check
- if (MPerm.getPermBuild().has(pistonFaction, targetFaction)) {
- continue;
- }
+ if (MPerm.getPermBuild().has(pistonFaction, targetFaction)) {
+ continue;
+ }
event.setCancelled(true);
return;
@@ -410,27 +409,27 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL)
public void buildFire(PlayerInteractEvent event) {
// If it is a left click on block and the clicked block is not null...
- if (event.getAction() != Action.LEFT_CLICK_BLOCK || event.getClickedBlock() == null) {
- return;
- }
+ if (event.getAction() != Action.LEFT_CLICK_BLOCK || event.getClickedBlock() == null) {
+ return;
+ }
// ... and the potential block is not null either ...
Block potentialBlock = event.getClickedBlock().getRelative(BlockFace.UP, 1);
- if (potentialBlock == null) {
- return;
- }
+ if (potentialBlock == null) {
+ return;
+ }
Material blockType = potentialBlock.getType();
// ... and we're only going to check for fire ... (checking everything else would be bad performance wise)
- if (blockType != Material.FIRE) {
- return;
- }
+ if (blockType != Material.FIRE) {
+ return;
+ }
// ... check if they can't build, cancel the event ...
- if (!Boolean.FALSE.equals(build(event.getPlayer(), potentialBlock, event))) {
- return;
- }
+ if (!Boolean.FALSE.equals(build(event.getPlayer(), potentialBlock, event))) {
+ return;
+ }
// ... and compensate for client side prediction
event.getPlayer().sendBlockChange(potentialBlock.getLocation(), blockType, potentialBlock.getState().getRawData());
@@ -442,9 +441,9 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void buildMove(BlockFromToEvent event) {
- if (!MConf.get().protectionLiquidFlowEnabled) {
- return;
- }
+ if (!MConf.get().protectionLiquidFlowEnabled) {
+ return;
+ }
// Prepare fields
Block fromBlock = event.getBlock();
@@ -455,21 +454,21 @@ public class EnginePermBuild extends Engine {
int chunkToZ = (fromBlock.getZ() + face.getModZ()) >> 4;
// If a liquid (or dragon egg) moves from one chunk to another ...
- if (chunkToX == chunkFromX && chunkToZ == chunkFromZ) {
- return;
- }
+ if (chunkToX == chunkFromX && chunkToZ == chunkFromZ) {
+ return;
+ }
// ... get the correct board for this block ...
Board board = BoardColl.get().getFixed(fromBlock.getWorld().getName().toLowerCase(), false);
- if (board == null) {
- return;
- }
+ if (board == null) {
+ return;
+ }
// ... get the access map ...
Map map = board.getMapRaw();
- if (map.isEmpty()) {
- return;
- }
+ if (map.isEmpty()) {
+ return;
+ }
// ... get the faction ids from and to ...
PS fromPs = PS.valueOf(chunkFromX, chunkFromZ);
@@ -482,22 +481,22 @@ public class EnginePermBuild extends Engine {
String toId = toTa != null ? toTa.getHostFactionId() : Factions.ID_NONE;
// ... and the chunks belong to different factions ...
- if (toId.equals(fromId)) {
- return;
- }
+ if (toId.equals(fromId)) {
+ return;
+ }
// ... and the faction "from" can not build at "to" ...
Faction fromFac = FactionColl.get().getFixed(fromId);
- if (fromFac == null) {
- fromFac = FactionColl.get().getNone();
- }
+ if (fromFac == null) {
+ fromFac = FactionColl.get().getNone();
+ }
Faction toFac = FactionColl.get().getFixed(toId);
- if (toFac == null) {
- toFac = FactionColl.get().getNone();
- }
- if (MPerm.getPermBuild().has(fromFac, toFac)) {
- return;
- }
+ if (toFac == null) {
+ toFac = FactionColl.get().getNone();
+ }
+ if (MPerm.getPermBuild().has(fromFac, toFac)) {
+ return;
+ }
// ... cancel the event!
event.setCancelled(true);
diff --git a/src/main/java/net/knarcraft/factions/engine/EnginePlayerData.java b/src/main/java/net/knarcraft/factions/engine/EnginePlayerData.java
index c25d646a..bc1dff14 100644
--- a/src/main/java/net/knarcraft/factions/engine/EnginePlayerData.java
+++ b/src/main/java/net/knarcraft/factions/engine/EnginePlayerData.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.MPlayerColl;
-import com.massivecraft.massivecore.Engine;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -14,7 +14,7 @@ public class EnginePlayerData extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EnginePlayerData i = new EnginePlayerData();
+ private static final EnginePlayerData i = new EnginePlayerData();
public static EnginePlayerData get() {
return i;
@@ -31,20 +31,20 @@ public class EnginePlayerData extends Engine {
// ... and if the if player was banned (not just kicked) ...
//if (!event.getReason().equals("Banned by admin.")) return;
- if (!player.isBanned()) {
- return;
- }
+ if (!player.isBanned()) {
+ return;
+ }
// ... and we remove player data when banned ...
- if (!MConf.get().removePlayerWhenBanned) {
- return;
- }
+ if (!MConf.get().removePlayerWhenBanned) {
+ return;
+ }
// ... get rid of their stored info.
MPlayer mplayer = MPlayerColl.get().get(player, false);
- if (mplayer == null) {
- return;
- }
+ if (mplayer == null) {
+ return;
+ }
if (mplayer.getRank().isLeader()) {
mplayer.getFaction().promoteNewLeader();
diff --git a/src/main/java/net/knarcraft/factions/engine/EnginePower.java b/src/main/java/net/knarcraft/factions/engine/EnginePower.java
index 128435ca..fd9e8312 100644
--- a/src/main/java/net/knarcraft/factions/engine/EnginePower.java
+++ b/src/main/java/net/knarcraft/factions/engine/EnginePower.java
@@ -1,5 +1,9 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.ps.PS;
+import com.massivecraft.massivecore.util.MUtil;
+import com.massivecraft.massivecore.util.PlayerUtil;
import net.knarcraft.factions.entity.BoardColl;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
@@ -7,10 +11,6 @@ import net.knarcraft.factions.entity.MFlag;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsPowerChange;
import net.knarcraft.factions.event.EventFactionsPowerChange.PowerChangeReason;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.ps.PS;
-import com.massivecraft.massivecore.util.MUtil;
-import com.massivecraft.massivecore.util.PlayerUtil;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -21,7 +21,7 @@ public class EnginePower extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EnginePower i = new EnginePower();
+ private static final EnginePower i = new EnginePower();
public static EnginePower get() {
return i;
@@ -35,15 +35,15 @@ public class EnginePower extends Engine {
public void powerLossOnDeath(PlayerDeathEvent event) {
// If a player dies ...
Player player = event.getEntity();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
// ... and this is the first death event this tick ...
// (yeah other plugins can case death event to fire twice the same tick)
- if (PlayerUtil.isDuplicateDeathEvent(event)) {
- return;
- }
+ if (PlayerUtil.isDuplicateDeathEvent(event)) {
+ return;
+ }
MPlayer mplayer = MPlayer.get(player);
@@ -65,9 +65,9 @@ public class EnginePower extends Engine {
EventFactionsPowerChange powerChangeEvent = new EventFactionsPowerChange(null, mplayer, PowerChangeReason.DEATH, newPower);
powerChangeEvent.run();
- if (powerChangeEvent.isCancelled()) {
- return;
- }
+ if (powerChangeEvent.isCancelled()) {
+ return;
+ }
newPower = powerChangeEvent.getNewPower();
mplayer.setPower(newPower);
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineSeeChunk.java b/src/main/java/net/knarcraft/factions/engine/EngineSeeChunk.java
index dbe6850a..96f8d454 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineSeeChunk.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineSeeChunk.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.engine;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.PeriodUtil;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
@@ -24,7 +24,7 @@ public class EngineSeeChunk extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineSeeChunk i = new EngineSeeChunk();
+ private static final EngineSeeChunk i = new EngineSeeChunk();
public static EngineSeeChunk get() {
return i;
@@ -39,9 +39,9 @@ public class EngineSeeChunk extends Engine {
// -------------------------------------------- //
public static void leaveAndWorldChangeRemoval(Player player) {
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
final MPlayer mplayer = MPlayer.get(player);
mplayer.setSeeingChunk(false);
@@ -68,9 +68,9 @@ public class EngineSeeChunk extends Engine {
// Do we have a new period?
final long now = System.currentTimeMillis();
final long length = 500;
- if (!PeriodUtil.isNewPeriod(this, length, now)) {
- return;
- }
+ if (!PeriodUtil.isNewPeriod(this, length, now)) {
+ return;
+ }
// Get the period number
final long period = PeriodUtil.getPeriod(length, now);
@@ -89,15 +89,15 @@ public class EngineSeeChunk extends Engine {
// For each player
for (Player player : Bukkit.getOnlinePlayers()) {
// Hide for dead players since the death screen looks better without.
- if (player.isDead()) {
- continue;
- }
+ if (player.isDead()) {
+ continue;
+ }
// The player must obviously have the feature activated.
MPlayer mplayer = MPlayer.get(player);
- if (!mplayer.isSeeingChunk()) {
- continue;
- }
+ if (!mplayer.isSeeingChunk()) {
+ continue;
+ }
// Calculate locations and play the effect there.
List locations = getLocations(player, steps, step);
@@ -110,18 +110,18 @@ public class EngineSeeChunk extends Engine {
public static List getLocations(Player player, int steps, int step) {
// Clean Args
- if (player == null) {
- throw new NullPointerException("player");
- }
- if (steps < 1) {
- throw new InvalidParameterException("steps must be larger than 0");
- }
- if (step < 0) {
- throw new InvalidParameterException("step must at least be 0");
- }
- if (step >= steps) {
- throw new InvalidParameterException("step must be less than steps");
- }
+ if (player == null) {
+ throw new NullPointerException("player");
+ }
+ if (steps < 1) {
+ throw new InvalidParameterException("steps must be larger than 0");
+ }
+ if (step < 0) {
+ throw new InvalidParameterException("step must at least be 0");
+ }
+ if (step >= steps) {
+ throw new InvalidParameterException("step must be less than steps");
+ }
// Create Ret
List ret = new ArrayList<>();
@@ -137,14 +137,14 @@ public class EngineSeeChunk extends Engine {
final int zmax = zmin + 15;
int keepEvery = 5;
- if (keepEvery <= 0) {
- keepEvery = Integer.MAX_VALUE;
- }
+ if (keepEvery <= 0) {
+ keepEvery = Integer.MAX_VALUE;
+ }
int skipEvery = 0;
- if (skipEvery <= 0) {
- skipEvery = Integer.MAX_VALUE;
- }
+ if (skipEvery <= 0) {
+ skipEvery = Integer.MAX_VALUE;
+ }
int x = xmin;
int z = zmin;
@@ -154,36 +154,36 @@ public class EngineSeeChunk extends Engine {
while (x + 1 <= xmax) {
x++;
i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
- ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
+ ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
}
// Add #2
while (z + 1 <= zmax) {
z++;
i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
- ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
+ ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
}
// Add #3
while (x - 1 >= xmin) {
x--;
i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
- ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
+ ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
}
// Add #4
while (z - 1 >= zmin) {
z--;
i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
- ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
+ ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
}
// Return Ret
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineShow.java b/src/main/java/net/knarcraft/factions/engine/EngineShow.java
index 52f58d00..8febc920 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineShow.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineShow.java
@@ -1,5 +1,11 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.PriorityLines;
+import com.massivecraft.massivecore.money.Money;
+import com.massivecraft.massivecore.util.TimeDiffUtil;
+import com.massivecraft.massivecore.util.TimeUnit;
+import com.massivecraft.massivecore.util.Txt;
import net.knarcraft.factions.comparator.ComparatorMPlayerRole;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
@@ -8,12 +14,6 @@ import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.event.EventFactionsChunkChangeType;
import net.knarcraft.factions.event.EventFactionsFactionShowAsync;
import net.knarcraft.factions.integration.Econ;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.PriorityLines;
-import com.massivecraft.massivecore.money.Money;
-import com.massivecraft.massivecore.util.TimeDiffUtil;
-import com.massivecraft.massivecore.util.TimeUnit;
-import com.massivecraft.massivecore.util.Txt;
import org.bukkit.command.CommandSender;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -56,7 +56,7 @@ public class EngineShow extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineShow i = new EngineShow();
+ private static final EngineShow i = new EngineShow();
public static EngineShow get() {
return i;
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineTeleportHomeOnDeath.java b/src/main/java/net/knarcraft/factions/engine/EngineTeleportHomeOnDeath.java
index 123de061..f97af891 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineTeleportHomeOnDeath.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineTeleportHomeOnDeath.java
@@ -1,11 +1,11 @@
package net.knarcraft.factions.engine;
+import com.massivecraft.massivecore.Engine;
+import com.massivecraft.massivecore.util.MUtil;
import net.knarcraft.factions.entity.Faction;
import net.knarcraft.factions.entity.MConf;
import net.knarcraft.factions.entity.MPlayer;
import net.knarcraft.factions.entity.Warp;
-import com.massivecraft.massivecore.Engine;
-import com.massivecraft.massivecore.util.MUtil;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -19,7 +19,7 @@ public class EngineTeleportHomeOnDeath extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineTeleportHomeOnDeath i = new EngineTeleportHomeOnDeath();
+ private static final EngineTeleportHomeOnDeath i = new EngineTeleportHomeOnDeath();
public static EngineTeleportHomeOnDeath get() {
return i;
@@ -32,33 +32,33 @@ public class EngineTeleportHomeOnDeath extends Engine {
public void teleportToHomeOnDeath(PlayerRespawnEvent event, EventPriority priority) {
// If a player is respawning ...
final Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
final MPlayer mplayer = MPlayer.get(player);
// ... homes are enabled, active and at this priority ...
- if (!MConf.get().warpsEnabled) {
- return;
- }
- if (!MConf.get().warpsTeleportToOnDeathActive) {
- return;
- }
- if (MConf.get().warpsTeleportToOnDeathPriority != priority) {
- return;
- }
+ if (!MConf.get().warpsEnabled) {
+ return;
+ }
+ if (!MConf.get().warpsTeleportToOnDeathActive) {
+ return;
+ }
+ if (MConf.get().warpsTeleportToOnDeathPriority != priority) {
+ return;
+ }
// ... and the player has a faction ...
final Faction faction = mplayer.getFaction();
- if (faction.isNone()) {
- return;
- }
+ if (faction.isNone()) {
+ return;
+ }
// ... and the faction has a home ...
- List warps = faction.getWarps().getAll((java.util.function.Predicate) (warp -> warp.getName().equalsIgnoreCase(MConf.get().warpsTeleportToOnDeathName)));
- if (warps.isEmpty()) {
- return;
- }
+ List warps = faction.getWarps().getAll(warp -> warp.getName().equalsIgnoreCase(MConf.get().warpsTeleportToOnDeathName));
+ if (warps.isEmpty()) {
+ return;
+ }
Warp warp = warps.get(0);
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineTerritoryShield.java b/src/main/java/net/knarcraft/factions/engine/EngineTerritoryShield.java
index 2aaf8db1..8551dc7d 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineTerritoryShield.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineTerritoryShield.java
@@ -1,9 +1,9 @@
package net.knarcraft.factions.engine;
-import net.knarcraft.factions.entity.MConf;
-import net.knarcraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.entity.MConf;
+import net.knarcraft.factions.entity.MPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -17,7 +17,7 @@ public class EngineTerritoryShield extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineTerritoryShield i = new EngineTerritoryShield();
+ private static final EngineTerritoryShield i = new EngineTerritoryShield();
public static EngineTerritoryShield get() {
return i;
@@ -31,32 +31,32 @@ public class EngineTerritoryShield extends Engine {
public void territoryShield(EntityDamageByEntityEvent event) {
// If the entity is a player ...
Entity entity = event.getEntity();
- if (MUtil.isntPlayer(entity)) {
- return;
- }
+ if (MUtil.isntPlayer(entity)) {
+ return;
+ }
Player player = (Player) entity;
MPlayer mplayer = MPlayer.get(player);
// ... and the attacker is a player ...
Entity attacker = MUtil.getLiableDamager(event);
- if (!(attacker instanceof Player)) {
- return;
- }
+ if (!(attacker instanceof Player)) {
+ return;
+ }
// ... and that player has a faction ...
- if (!mplayer.hasFaction()) {
- return;
- }
+ if (!mplayer.hasFaction()) {
+ return;
+ }
// ... and that player is in their own territory ...
- if (!mplayer.isInOwnTerritory()) {
- return;
- }
+ if (!mplayer.isInOwnTerritory()) {
+ return;
+ }
// ... and a territoryShieldFactor is configured ...
- if (MConf.get().territoryShieldFactor <= 0) {
- return;
- }
+ if (MConf.get().territoryShieldFactor <= 0) {
+ return;
+ }
// ... then scale the damage ...
double factor = 1D - MConf.get().territoryShieldFactor;
diff --git a/src/main/java/net/knarcraft/factions/engine/EngineVisualizations.java b/src/main/java/net/knarcraft/factions/engine/EngineVisualizations.java
index b5f709c7..db9f6159 100644
--- a/src/main/java/net/knarcraft/factions/engine/EngineVisualizations.java
+++ b/src/main/java/net/knarcraft/factions/engine/EngineVisualizations.java
@@ -1,8 +1,8 @@
package net.knarcraft.factions.engine;
-import net.knarcraft.factions.util.VisualizeUtil;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.util.VisualizeUtil;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerMoveEvent;
@@ -12,7 +12,7 @@ public class EngineVisualizations extends Engine {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static EngineVisualizations i = new EngineVisualizations();
+ private static final EngineVisualizations i = new EngineVisualizations();
public static EngineVisualizations get() {
return i;
@@ -24,9 +24,9 @@ public class EngineVisualizations extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMoveClearVisualizations(PlayerMoveEvent event) {
- if (MUtil.isSameBlock(event)) {
- return;
- }
+ if (MUtil.isSameBlock(event)) {
+ return;
+ }
VisualizeUtil.clear(event.getPlayer());
}
diff --git a/src/main/java/net/knarcraft/factions/engine/ProtectCase.java b/src/main/java/net/knarcraft/factions/engine/ProtectCase.java
index 9a5d6fd2..7104d054 100644
--- a/src/main/java/net/knarcraft/factions/engine/ProtectCase.java
+++ b/src/main/java/net/knarcraft/factions/engine/ProtectCase.java
@@ -38,10 +38,9 @@ public enum ProtectCase {
return MPerm.getPermBuild();
case USE_ENTITY:
- if (!(object instanceof Entity)) {
+ if (!(object instanceof Entity entity)) {
return null;
}
- Entity entity = (Entity) object;
EntityType type = entity.getType();
if (EnumerationUtil.isEntityTypeContainer(type)) {
return MPerm.getPermContainer();
@@ -51,10 +50,9 @@ public enum ProtectCase {
}
case USE_BLOCK:
- if (!(object instanceof Material)) {
+ if (!(object instanceof Material material)) {
return null;
}
- Material material = (Material) object;
if (EnumerationUtil.isMaterialEditOnInteract(material)) {
return MPerm.getPermBuild();
}
diff --git a/src/main/java/net/knarcraft/factions/entity/Board.java b/src/main/java/net/knarcraft/factions/entity/Board.java
index 9a724146..d2029245 100644
--- a/src/main/java/net/knarcraft/factions/entity/Board.java
+++ b/src/main/java/net/knarcraft/factions/entity/Board.java
@@ -1,10 +1,10 @@
package net.knarcraft.factions.entity;
import com.google.gson.reflect.TypeToken;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.TerritoryAccess;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.store.Entity;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.TerritoryAccess;
import java.lang.reflect.Type;
import java.util.Collections;
@@ -40,13 +40,10 @@ public class Board extends Entity implements BoardInterface {
@Override
public boolean isDefault() {
- if (this.map == null) {
- return true;
- }
- if (this.map.isEmpty()) {
- return true;
- }
- return false;
+ if (this.map == null) {
+ return true;
+ }
+ return this.map.isEmpty();
}
// -------------------------------------------- //
@@ -83,15 +80,15 @@ public class Board extends Entity implements BoardInterface {
@Override
public TerritoryAccess getTerritoryAccessAt(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
ps = ps.getChunkCoords(true);
TerritoryAccess ret = this.map.get(ps);
- if (ret == null || ret.getHostFaction() == null) {
- ret = TerritoryAccess.valueOf(Factions.ID_NONE);
- }
+ if (ret == null || ret.getHostFaction() == null) {
+ ret = TerritoryAccess.valueOf(Factions.ID_NONE);
+ }
return ret;
}
@@ -161,9 +158,9 @@ public class Board extends Entity implements BoardInterface {
@Override
public Map> getFactionToChunks(boolean withWorld) {
Function, PS> mapper = Entry::getKey;
- if (withWorld) {
- mapper = mapper.andThen(ps -> ps.withWorld(this.getId()));
- }
+ if (withWorld) {
+ mapper = mapper.andThen(ps -> ps.withWorld(this.getId()));
+ }
return map.entrySet().stream().collect(Collectors.groupingBy(
entry -> entry.getValue().getHostFaction(), // This specifies how to get the key
@@ -180,18 +177,18 @@ public class Board extends Entity implements BoardInterface {
@Override
public int getCount(Faction faction) {
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
return this.getCount(faction.getId());
}
@Override
public int getCount(String factionId) {
- if (factionId == null) {
- throw new NullPointerException("factionId");
- }
+ if (factionId == null) {
+ throw new NullPointerException("factionId");
+ }
return (int) this.map.values().stream()
.map(TerritoryAccess::getHostFactionId)
@@ -224,36 +221,32 @@ public class Board extends Entity implements BoardInterface {
// NEARBY DETECTION
- // Is this coord NOT completely surrounded by coords claimed by the same faction?
- // Simpler: Is there any nearby coord with a faction other than the faction here?
+ // Is this coordinate NOT completely surrounded by coordinates claimed by the same faction?
+ // Simpler: Is there any nearby coordinates with a faction other than the faction here?
@Override
public boolean isBorderPs(PS ps) {
ps = ps.getChunk(true);
- PS nearby = null;
+ PS nearby;
Faction faction = this.getFactionAt(ps);
nearby = ps.withChunkX(ps.getChunkX() + 1);
- if (faction != this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction != this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkX(ps.getChunkX() - 1);
- if (faction != this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction != this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkZ(ps.getChunkZ() + 1);
- if (faction != this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction != this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkZ(ps.getChunkZ() - 1);
- if (faction != this.getFactionAt(nearby)) {
- return true;
- }
-
- return false;
+ return faction != this.getFactionAt(nearby);
}
@Override
@@ -261,34 +254,30 @@ public class Board extends Entity implements BoardInterface {
return pss.stream().anyMatch(this::isBorderPs);
}
- // Is this coord connected to any coord claimed by the specified faction?
+ // Is this coordinate connected to any coordinates claimed by the specified faction?
@Override
public boolean isConnectedPs(PS ps, Faction faction) {
ps = ps.getChunk(true);
- PS nearby = null;
+ PS nearby;
nearby = ps.withChunkX(ps.getChunkX() + 1);
- if (faction == this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction == this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkX(ps.getChunkX() - 1);
- if (faction == this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction == this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkZ(ps.getChunkZ() + 1);
- if (faction == this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction == this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkZ(ps.getChunkZ() - 1);
- if (faction == this.getFactionAt(nearby)) {
- return true;
- }
-
- return false;
+ return faction == this.getFactionAt(nearby);
}
@Override
diff --git a/src/main/java/net/knarcraft/factions/entity/BoardColl.java b/src/main/java/net/knarcraft/factions/entity/BoardColl.java
index 699389a3..32540a43 100644
--- a/src/main/java/net/knarcraft/factions/entity/BoardColl.java
+++ b/src/main/java/net/knarcraft/factions/entity/BoardColl.java
@@ -1,6 +1,5 @@
package net.knarcraft.factions.entity;
-import net.knarcraft.factions.TerritoryAccess;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.collections.MassiveSet;
@@ -8,6 +7,7 @@ import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.store.Coll;
import com.massivecraft.massivecore.util.MUtil;
+import net.knarcraft.factions.TerritoryAccess;
import java.util.Collection;
import java.util.List;
@@ -22,7 +22,7 @@ public class BoardColl extends Coll implements BoardInterface {
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
- private static BoardColl i = new BoardColl();
+ private static final BoardColl i = new BoardColl();
public static BoardColl get() {
return i;
@@ -48,15 +48,15 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public String fixId(Object oid) {
- if (oid == null) {
- return null;
- }
- if (oid instanceof String) {
- return (String) oid;
- }
- if (oid instanceof Board) {
- return ((Board) oid).getId();
- }
+ if (oid == null) {
+ return null;
+ }
+ if (oid instanceof String) {
+ return (String) oid;
+ }
+ if (oid instanceof Board) {
+ return ((Board) oid).getId();
+ }
boolean debug = MassiveCoreMConf.get().debugEnabled;
String ret = MUtil.extract(String.class, "worldName", oid);
@@ -72,25 +72,25 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public TerritoryAccess getTerritoryAccessAt(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return null;
- }
+ if (board == null) {
+ return null;
+ }
return board.getTerritoryAccessAt(ps);
}
@Override
public Faction getFactionAt(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return null;
- }
+ if (board == null) {
+ return null;
+ }
return board.getFactionAt(ps);
}
@@ -98,25 +98,25 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public void setTerritoryAccessAt(PS ps, TerritoryAccess territoryAccess) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return;
- }
+ if (board == null) {
+ return;
+ }
board.setTerritoryAccessAt(ps, territoryAccess);
}
@Override
public void setFactionAt(PS ps, Faction faction) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return;
- }
+ if (board == null) {
+ return;
+ }
board.setFactionAt(ps, faction);
}
@@ -124,13 +124,13 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public void removeAt(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return;
- }
+ if (board == null) {
+ return;
+ }
board.removeAt(ps);
}
@@ -190,9 +190,9 @@ public class BoardColl extends Coll implements BoardInterface {
}
// Enforce create
- if (ret == null) {
- ret = new MassiveMap<>();
- }
+ if (ret == null) {
+ ret = new MassiveMap<>();
+ }
// Return
return ret;
@@ -250,13 +250,13 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public boolean isBorderPs(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return false;
- }
+ if (board == null) {
+ return false;
+ }
return board.isBorderPs(ps);
}
@@ -267,22 +267,22 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public boolean isConnectedPs(PS ps, Faction faction) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return false;
- }
+ if (board == null) {
+ return false;
+ }
return board.isConnectedPs(ps, faction);
}
@Override
public boolean isAnyConnectedPs(Set pss, Faction faction) {
for (PS ps : pss) {
- if (this.isConnectedPs(ps, faction)) {
- return true;
- }
+ if (this.isConnectedPs(ps, faction)) {
+ return true;
+ }
}
return false;
}
@@ -296,9 +296,9 @@ public class BoardColl extends Coll implements BoardInterface {
}
public Set getClaimedWorlds(String factionId) {
- if (factionId == null) {
- throw new NullPointerException("factionId");
- }
+ if (factionId == null) {
+ throw new NullPointerException("factionId");
+ }
return this.getAll().stream()
.filter(board -> board.hasClaimed(factionId))
.map(Board::getId)
@@ -314,29 +314,29 @@ public class BoardColl extends Coll implements BoardInterface {
// Distance 1 returns 3x3 = 9 chunks.
public static Set getNearbyChunks(PS psChunk, int distance) {
// Fix Args
- if (psChunk == null) {
- throw new NullPointerException("psChunk");
- }
+ if (psChunk == null) {
+ throw new NullPointerException("psChunk");
+ }
psChunk = psChunk.getChunk(true);
// Create
Set ret = new MassiveSet<>();
- if (distance < 0) {
- return ret;
- }
+ if (distance < 0) {
+ return ret;
+ }
// Fill
int chunkX = psChunk.getChunkX();
- int xmin = chunkX - distance;
- int xmax = chunkX + distance;
+ int xMin = chunkX - distance;
+ int xMax = chunkX + distance;
int chunkZ = psChunk.getChunkZ();
- int zmin = chunkZ - distance;
- int zmax = chunkZ + distance;
+ int zMin = chunkZ - distance;
+ int zMax = chunkZ + distance;
- for (int x = xmin; x <= xmax; x++) {
+ for (int x = xMin; x <= xMax; x++) {
PS psChunkX = psChunk.withChunkX(x);
- for (int z = zmin; z <= zmax; z++) {
+ for (int z = zMin; z <= zMax; z++) {
ret.add(psChunkX.withChunkZ(z));
}
}
@@ -347,16 +347,16 @@ public class BoardColl extends Coll implements BoardInterface {
public static Set getNearbyChunks(Collection chunks, int distance) {
// Fix Args
- if (chunks == null) {
- throw new NullPointerException("chunks");
- }
+ if (chunks == null) {
+ throw new NullPointerException("chunks");
+ }
// Create
Set ret = new MassiveSet<>();
- if (distance < 0) {
- return ret;
- }
+ if (distance < 0) {
+ return ret;
+ }
// Fill
for (PS chunk : chunks) {
@@ -369,9 +369,9 @@ public class BoardColl extends Coll implements BoardInterface {
public static Set getDistinctFactions(Collection chunks) {
// Fix Args
- if (chunks == null) {
- throw new NullPointerException("chunks");
- }
+ if (chunks == null) {
+ throw new NullPointerException("chunks");
+ }
// Create
Set ret = new MassiveSet<>();
@@ -379,9 +379,9 @@ public class BoardColl extends Coll implements BoardInterface {
// Fill
for (PS chunk : chunks) {
Faction faction = get().getFactionAt(chunk);
- if (faction == null) {
- continue;
- }
+ if (faction == null) {
+ continue;
+ }
ret.add(faction);
}
@@ -398,9 +398,9 @@ public class BoardColl extends Coll implements BoardInterface {
for (PS chunk : chunks) {
chunk = chunk.getChunk(true);
Faction faction = get().getFactionAt(chunk);
- if (faction == null) {
- faction = none;
- }
+ if (faction == null) {
+ faction = none;
+ }
ret.put(chunk, faction);
}
@@ -414,9 +414,9 @@ public class BoardColl extends Coll implements BoardInterface {
outer:
for (PS ps : pss) {
- if (discovered.contains(ps)) {
- continue outer;
- }
+ if (discovered.contains(ps)) {
+ continue outer;
+ }
List forest = new MassiveList<>();
forests.add(forest);
@@ -426,9 +426,9 @@ public class BoardColl extends Coll implements BoardInterface {
inner:
while (!stack.empty()) {
PS elm = stack.pop();
- if (discovered.contains(elm)) {
- continue inner;
- }
+ if (discovered.contains(elm)) {
+ continue inner;
+ }
System.out.println(elm);
discovered.add(elm);
forest.add(elm);
@@ -444,9 +444,9 @@ public class BoardColl extends Coll implements BoardInterface {
}
private static void addIfInSource(PS ps, Stack stack, Collection source) {
- if (source.contains(ps)) {
- stack.push(ps);
- }
+ if (source.contains(ps)) {
+ stack.push(ps);
+ }
}
}
diff --git a/src/main/java/net/knarcraft/factions/entity/BoardInterface.java b/src/main/java/net/knarcraft/factions/entity/BoardInterface.java
index ec7a7e43..03946721 100644
--- a/src/main/java/net/knarcraft/factions/entity/BoardInterface.java
+++ b/src/main/java/net/knarcraft/factions/entity/BoardInterface.java
@@ -1,7 +1,7 @@
package net.knarcraft.factions.entity;
-import net.knarcraft.factions.TerritoryAccess;
import com.massivecraft.massivecore.ps.PS;
+import net.knarcraft.factions.TerritoryAccess;
import java.util.Map;
import java.util.Set;
diff --git a/src/main/java/net/knarcraft/factions/entity/Faction.java b/src/main/java/net/knarcraft/factions/entity/Faction.java
index 9434e29f..f955923a 100644
--- a/src/main/java/net/knarcraft/factions/entity/Faction.java
+++ b/src/main/java/net/knarcraft/factions/entity/Faction.java
@@ -1,16 +1,6 @@
package net.knarcraft.factions.entity;
-import net.knarcraft.factions.Factions;
-import net.knarcraft.factions.FactionsIndex;
-import net.knarcraft.factions.FactionsParticipator;
-import net.knarcraft.factions.Rel;
-import net.knarcraft.factions.RelationParticipator;
-import net.knarcraft.factions.entity.MPerm.MPermable;
-import net.knarcraft.factions.predicate.PredicateCommandSenderFaction;
-import net.knarcraft.factions.predicate.PredicateMPlayerRank;
-import net.knarcraft.factions.util.MiscUtil;
-import net.knarcraft.factions.util.RelationUtil;
import com.massivecraft.massivecore.Couple;
import com.massivecraft.massivecore.Identified;
import com.massivecraft.massivecore.collections.MassiveList;
@@ -28,6 +18,16 @@ import com.massivecraft.massivecore.store.SenderColl;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
+import net.knarcraft.factions.Factions;
+import net.knarcraft.factions.FactionsIndex;
+import net.knarcraft.factions.FactionsParticipator;
+import net.knarcraft.factions.Rel;
+import net.knarcraft.factions.RelationParticipator;
+import net.knarcraft.factions.entity.MPerm.MPermable;
+import net.knarcraft.factions.predicate.PredicateCommandSenderFaction;
+import net.knarcraft.factions.predicate.PredicateMPlayerRank;
+import net.knarcraft.factions.util.MiscUtil;
+import net.knarcraft.factions.util.RelationUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -87,9 +87,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
@Override
public void preDetach(String id) {
- if (!this.isLive()) {
- return;
- }
+ if (!this.isLive()) {
+ return;
+ }
// NOTE: Existence check is required for compatibility with some plugins.
// If they have money ...
@@ -131,7 +131,7 @@ public class Faction extends Entity implements FactionsParticipator, MP
private long createdAtMillis = System.currentTimeMillis();
// Factions can set a few significant locations (warps)
- private EntityInternalMap warps = new EntityInternalMap<>(this, Warp.class);
+ private final EntityInternalMap warps = new EntityInternalMap<>(this, Warp.class);
// Factions usually do not have a powerboost. It defaults to 0.
// The powerBoost is a custom increase/decrease to default and maximum power.
@@ -144,13 +144,13 @@ public class Faction extends Entity implements FactionsParticipator, MP
// This is the ids of the invited players.
// They are actually "senderIds" since you can invite "@console" to your faction.
- private EntityInternalMap invitations = new EntityInternalMap<>(this, Invitation.class);
+ private final EntityInternalMap invitations = new EntityInternalMap<>(this, Invitation.class);
// This is where all the ranks are, they are faction specific
- private EntityInternalMap ranks = this.createRankMap();
+ private final EntityInternalMap ranks = this.createRankMap();
// This is the votes currently open in the faction
- private EntityInternalMap votes = new EntityInternalMap<>(this, Vote.class);
+ private final EntityInternalMap votes = new EntityInternalMap<>(this, Vote.class);
// The keys in this map are factionIds.
// Null means no special relation whishes.
@@ -164,7 +164,7 @@ public class Faction extends Entity implements FactionsParticipator, MP
// What is the base tax on members of the faction?
// Specific taxes on ranks or players.
- public static transient String IDENTIFIER_TAX_BASE = "base";
+ public static final transient String IDENTIFIER_TAX_BASE = "base";
private Map tax = new MassiveMap<>();
@@ -195,15 +195,14 @@ public class Faction extends Entity implements FactionsParticipator, MP
public void setName(String name) {
// Clean input
- String target = name;
// Detect Nochange
- if (MUtil.equals(this.name, target)) {
- return;
- }
+ if (MUtil.equals(this.name, name)) {
+ return;
+ }
// Apply
- this.name = target;
+ this.name = name;
// Mark as changed
this.changed();
@@ -220,9 +219,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public String getName(RelationParticipator observer) {
- if (observer == null) {
- return getName();
- }
+ if (observer == null) {
+ return getName();
+ }
return this.getName(this.getColorTo(observer).toString());
}
@@ -245,9 +244,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
String target = clean(description);
// Detect Nochange
- if (MUtil.equals(this.description, target)) {
- return;
- }
+ if (MUtil.equals(this.description, target)) {
+ return;
+ }
// Apply
this.description = target;
@@ -260,9 +259,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public String getDescriptionDesc() {
String motd = this.getDescription();
- if (motd == null) {
- motd = NODESCRIPTION;
- }
+ if (motd == null) {
+ motd = NODESCRIPTION;
+ }
return motd;
}
@@ -285,9 +284,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
String target = clean(motd);
// Detect Nochange
- if (MUtil.equals(this.motd, target)) {
- return;
- }
+ if (MUtil.equals(this.motd, target)) {
+ return;
+ }
// Apply
this.motd = target;
@@ -303,9 +302,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
private static String getMotdDesc(String motd) {
- if (motd == null) {
- motd = NOMOTD;
- }
+ if (motd == null) {
+ motd = NOMOTD;
+ }
return motd;
}
@@ -339,9 +338,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public void setCreatedAtMillis(long createdAtMillis) {
// Detect Nochange
- if (MUtil.equals(this.createdAtMillis, createdAtMillis)) {
- return;
- }
+ if (MUtil.equals(this.createdAtMillis, createdAtMillis)) {
+ return;
+ }
// Apply
this.createdAtMillis = createdAtMillis;
@@ -367,28 +366,28 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public Warp getWarp(Object oid) {
- if (oid == null) {
- throw new NullPointerException("oid");
- }
+ if (oid == null) {
+ throw new NullPointerException("oid");
+ }
Warp warp = this.getWarps().get(oid);
- if (warp == null) {
- return null;
- }
+ if (warp == null) {
+ return null;
+ }
- if (!warp.verifyIsValid()) {
- return null;
- }
+ if (!warp.verifyIsValid()) {
+ return null;
+ }
return warp;
}
public PS getWarpPS(Object oid) {
- if (oid == null) {
- throw new NullPointerException("oid");
- }
+ if (oid == null) {
+ throw new NullPointerException("oid");
+ }
Warp warp = this.getWarp(oid);
- if (warp == null) {
- return null;
- }
+ if (warp == null) {
+ return null;
+ }
return warp.getLocation();
}
@@ -408,9 +407,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
@Override
public double getPowerBoost() {
Double ret = this.powerBoost;
- if (ret == null) {
- ret = 0D;
- }
+ if (ret == null) {
+ ret = 0D;
+ }
return ret;
}
@@ -419,14 +418,14 @@ public class Faction extends Entity implements FactionsParticipator, MP
// Clean input
Double target = powerBoost;
- if (target == null || target == 0) {
- target = null;
- }
+ if (target == null || target == 0) {
+ target = null;
+ }
// Detect Nochange
- if (MUtil.equals(this.powerBoost, target)) {
- return;
- }
+ if (MUtil.equals(this.powerBoost, target)) {
+ return;
+ }
// Apply
this.powerBoost = target;
@@ -440,29 +439,29 @@ public class Faction extends Entity implements FactionsParticipator, MP
// -------------------------------------------- //
public double getMoney() {
- if (!MConf.get().econEnabled) {
- throw new UnsupportedOperationException("econ not enabled");
- }
- if (!MConf.get().bankEnabled) {
- throw new UnsupportedOperationException("bank not enabled");
- }
- if (!MConf.get().useNewMoneySystem) {
- throw new UnsupportedOperationException("this server does not use the new econ system");
- }
+ if (!MConf.get().econEnabled) {
+ throw new UnsupportedOperationException("econ not enabled");
+ }
+ if (!MConf.get().bankEnabled) {
+ throw new UnsupportedOperationException("bank not enabled");
+ }
+ if (!MConf.get().useNewMoneySystem) {
+ throw new UnsupportedOperationException("this server does not use the new econ system");
+ }
return this.convertGet(this.money, 0D);
}
public void setMoney(Double money) {
- if (!MConf.get().econEnabled) {
- throw new UnsupportedOperationException("econ not enabled");
- }
- if (!MConf.get().bankEnabled) {
- throw new UnsupportedOperationException("bank not enabled");
- }
- if (!MConf.get().useNewMoneySystem) {
- throw new UnsupportedOperationException("this server does not use the new econ system");
- }
+ if (!MConf.get().econEnabled) {
+ throw new UnsupportedOperationException("econ not enabled");
+ }
+ if (!MConf.get().bankEnabled) {
+ throw new UnsupportedOperationException("bank not enabled");
+ }
+ if (!MConf.get().useNewMoneySystem) {
+ throw new UnsupportedOperationException("this server does not use the new econ system");
+ }
this.money = this.convertSet(money, this.money, 0D);
}
@@ -517,9 +516,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public Rank getRank(String rankId) {
- if (rankId == null) {
- throw new NullPointerException("rankId");
- }
+ if (rankId == null) {
+ throw new NullPointerException("rankId");
+ }
return this.getRanks().getFixed(rankId);
}
@@ -536,9 +535,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public Rank getLeaderRank() {
Rank ret = null;
for (Rank rank : this.getRanks().getAll()) {
- if (ret != null && ret.isMoreThan(rank)) {
- continue;
- }
+ if (ret != null && ret.isMoreThan(rank)) {
+ continue;
+ }
ret = rank;
}
@@ -548,9 +547,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public Rank getLowestRank() {
Rank ret = null;
for (Rank rank : this.getRanks().getAll()) {
- if (ret != null && ret.isLessThan(rank)) {
- continue;
- }
+ if (ret != null && ret.isLessThan(rank)) {
+ continue;
+ }
ret = rank;
}
@@ -568,16 +567,16 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public void addVote(Vote vote) {
- if (vote == null) {
- throw new NullPointerException("vote");
- }
+ if (vote == null) {
+ throw new NullPointerException("vote");
+ }
this.getVotes().attach(vote);
}
public Optional getVoteByName(String name) {
- if (name == null) {
- throw new NullPointerException("name");
- }
+ if (name == null) {
+ throw new NullPointerException("name");
+ }
return this.getVotes().getAll().stream().filter(vote -> vote.getName().equalsIgnoreCase(name)).findFirst();
}
@@ -596,9 +595,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
MassiveMapDef target = new MassiveMapDef<>(relationWishes);
// Detect Nochange
- if (MUtil.equals(this.relationWishes, target)) {
- return;
- }
+ if (MUtil.equals(this.relationWishes, target)) {
+ return;
+ }
// Apply
this.relationWishes = target;
@@ -611,9 +610,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public Rel getRelationWish(String factionId) {
Rel ret = this.getRelationWishes().get(factionId);
- if (ret == null) {
- ret = Rel.NEUTRAL;
- }
+ if (ret == null) {
+ ret = Rel.NEUTRAL;
+ }
return ret;
}
@@ -664,9 +663,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
// ... resolve object and skip unknowns ...
MFlag mflag = MFlag.get(id);
- if (mflag == null) {
- continue;
- }
+ if (mflag == null) {
+ continue;
+ }
ret.put(mflag, entry.getValue());
}
@@ -687,23 +686,23 @@ public class Faction extends Entity implements FactionsParticipator, MP
MassiveMapDef target = new MassiveMapDef<>();
for (Map.Entry