diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactions.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactions.java index 20287ac8..c1bec29e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactions.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactions.java @@ -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/com/massivecraft/factions/cmd/CmdFactionsAccessSetFill.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessSetFill.java index 7696a6ff..672e7d55 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessSetFill.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessSetFill.java @@ -4,7 +4,6 @@ import com.massivecraft.factions.Perm; import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.Faction; import com.massivecraft.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; @@ -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/com/massivecraft/factions/cmd/CmdFactionsClean.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsClean.java index ee3c0412..0df7efea 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsClean.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsClean.java @@ -10,7 +10,6 @@ import com.massivecraft.factions.entity.Invitation; import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.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; @@ -26,7 +25,7 @@ public class CmdFactionsClean extends FactionsCommand { // -------------------------------------------- // @Override - public void perform() throws MassiveException { + public void perform() { Object message; int count; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationFlags.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationFlags.java index 81a8a795..1ee81d8b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationFlags.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationFlags.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.entity.MFlag; import com.massivecraft.factions.entity.MFlagColl; -import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.util.Txt; import java.util.List; @@ -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/com/massivecraft/factions/cmd/CmdFactionsDocumentationPerms.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationPerms.java index 16a02350..e0f869f4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationPerms.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationPerms.java @@ -1,7 +1,5 @@ package com.massivecraft.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/com/massivecraft/factions/cmd/CmdFactionsDocumentationPower.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationPower.java index 41c6ce70..3f5a0b36 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationPower.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationPower.java @@ -1,7 +1,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.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/com/massivecraft/factions/cmd/CmdFactionsDocumentationRanks.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationRanks.java index c81ecee9..d0692b18 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationRanks.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationRanks.java @@ -1,7 +1,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.entity.Rank; -import com.massivecraft.massivecore.MassiveException; import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.util.Txt; import org.bukkit.ChatColor; @@ -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/com/massivecraft/factions/cmd/CmdFactionsDocumentationTax.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationTax.java index fee90621..47607c9d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationTax.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationTax.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.cmd.req.ReqTaxEnabled; import com.massivecraft.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; @@ -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/com/massivecraft/factions/cmd/CmdFactionsDocumentationWarps.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationWarps.java index 9e72b95f..92ce2cdc 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationWarps.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDocumentationWarps.java @@ -4,7 +4,6 @@ import com.massivecraft.factions.cmd.req.ReqFactionWarpsEnabled; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm.MPermable; -import com.massivecraft.massivecore.MassiveException; import java.util.Set; @@ -22,7 +21,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/com/massivecraft/factions/cmd/CmdFactionsFlag.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFlag.java index 863fd57e..579066d3 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFlag.java +++ b/src/main/java/com/massivecraft/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/com/massivecraft/factions/cmd/CmdFactionsFly.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFly.java index 153c6751..e1fe7c31 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFly.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFly.java @@ -38,7 +38,7 @@ public class CmdFactionsFly extends MassiveCommandToggle { } @Override - public boolean getValue() throws MassiveException { + public boolean getValue() { return MPlayer.get(sender).isFlying(); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsHome.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsHome.java index 629f3058..8bb6d887 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsHome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsHome.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.cmd.type.TypeFaction; import com.massivecraft.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; @@ -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/com/massivecraft/factions/cmd/CmdFactionsInvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInvite.java index adacd5c4..ad226ace 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInvite.java +++ b/src/main/java/com/massivecraft/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/com/massivecraft/factions/cmd/CmdFactionsPerm.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPerm.java index 1be3ec07..a93fbddc 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPerm.java +++ b/src/main/java/com/massivecraft/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/com/massivecraft/factions/cmd/CmdFactionsPowerboost.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPowerboost.java index f40cbec8..27582521 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPowerboost.java +++ b/src/main/java/com/massivecraft/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/com/massivecraft/factions/cmd/CmdFactionsRank.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRank.java index ec78c717..2c725a25 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRank.java +++ b/src/main/java/com/massivecraft/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/com/massivecraft/factions/cmd/CmdFactionsRelation.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRelation.java index 4e7eda2d..7389404b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRelation.java +++ b/src/main/java/com/massivecraft/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/com/massivecraft/factions/cmd/CmdFactionsSetFill.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsSetFill.java index f13729b0..e96c43a5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsSetFill.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsSetFill.java @@ -4,7 +4,6 @@ import com.massivecraft.factions.Perm; import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.Faction; import com.massivecraft.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; @@ -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/com/massivecraft/factions/cmd/CmdFactionsSethome.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsSethome.java index 3bfc760b..ad2a6f4b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsSethome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsSethome.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.cmd.type.TypeFaction; import com.massivecraft.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; @@ -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/com/massivecraft/factions/cmd/CmdFactionsTaxRun.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTaxRun.java index 9892007d..9347b685 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTaxRun.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTaxRun.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.cmd.req.ReqTaxEnabled; import com.massivecraft.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/com/massivecraft/factions/cmd/CmdFactionsTop.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTop.java index f260d495..7db2a0c0 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTop.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTop.java @@ -64,17 +64,12 @@ public class CmdFactionsTop extends FactionsCommand { } private static double getNumber(TopCategory category, Faction faction) { - switch (category) { - case MONEY: - return Econ.getMoney(faction); - case MEMBERS: - return faction.getMPlayers().size(); - case TERRITORY: - return faction.getLandCount(); - case AGE: - return faction.getAge(); - } - throw new RuntimeException(); + return switch (category) { + case MONEY -> Econ.getMoney(faction); + case MEMBERS -> faction.getMPlayers().size(); + case TERRITORY -> faction.getLandCount(); + case AGE -> faction.getAge(); + }; } private static String getValue(TopCategory category, Faction faction, MPlayer mplayer) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsUnsethome.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsUnsethome.java index 428122b0..e1ce35c6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsUnsethome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsUnsethome.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.cmd.type.TypeFaction; import com.massivecraft.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; @@ -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/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java index 7073cf23..46ff5747 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java @@ -6,7 +6,6 @@ import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MPerm; import com.massivecraft.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; @@ -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/com/massivecraft/factions/cmd/CmdFactionsVote.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVote.java index 410ec86a..1e305dcb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVote.java +++ b/src/main/java/com/massivecraft/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/com/massivecraft/factions/cmd/CmdFactionsWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsWarp.java index f893507c..0cd16d0d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsWarp.java +++ b/src/main/java/com/massivecraft/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/com/massivecraft/factions/engine/EngineCanCombatHappen.java b/src/main/java/com/massivecraft/factions/engine/EngineCanCombatHappen.java index 469a9063..62a0997f 100644 --- a/src/main/java/com/massivecraft/factions/engine/EngineCanCombatHappen.java +++ b/src/main/java/com/massivecraft/factions/engine/EngineCanCombatHappen.java @@ -162,7 +162,7 @@ public class EngineCanCombatHappen extends Engine { } // ... 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 @@ -198,7 +198,7 @@ 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 anyway. - 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)); @@ -239,7 +239,7 @@ 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()); diff --git a/src/main/java/com/massivecraft/factions/engine/EngineChat.java b/src/main/java/com/massivecraft/factions/engine/EngineChat.java index 7d1fb4d7..90605627 100644 --- a/src/main/java/com/massivecraft/factions/engine/EngineChat.java +++ b/src/main/java/com/massivecraft/factions/engine/EngineChat.java @@ -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; @@ -66,7 +67,7 @@ public class EngineChat extends Engine { 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; @@ -88,7 +89,7 @@ public class EngineChat extends Engine { 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; @@ -117,7 +118,7 @@ public class EngineChat extends Engine { 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/com/massivecraft/factions/engine/EngineDenyTeleport.java b/src/main/java/com/massivecraft/factions/engine/EngineDenyTeleport.java index c6121d75..dfbabdc6 100644 --- a/src/main/java/com/massivecraft/factions/engine/EngineDenyTeleport.java +++ b/src/main/java/com/massivecraft/factions/engine/EngineDenyTeleport.java @@ -123,9 +123,8 @@ public class EngineDenyTeleport extends Engine { if (!mconf.allowEnderPearlInOtherTerritory && types.contains(TerritoryType.OTHER)) { return Couple.valueOf(cause, TerritoryType.OTHER); } - } else { - // Don't cancel other kinds of teleports } + // Don't cancel other kinds of teleports return null; } diff --git a/src/main/java/com/massivecraft/factions/engine/EngineFly.java b/src/main/java/com/massivecraft/factions/engine/EngineFly.java index a1759ba8..d7eed2b4 100644 --- a/src/main/java/com/massivecraft/factions/engine/EngineFly.java +++ b/src/main/java/com/massivecraft/factions/engine/EngineFly.java @@ -112,7 +112,7 @@ public class EngineFly extends Engine { if (event.getFlag() != MFlag.getFlagFly()) { return; } - if (event.isNewValue() == true) { + if (event.isNewValue()) { return; } diff --git a/src/main/java/com/massivecraft/factions/entity/Board.java b/src/main/java/com/massivecraft/factions/entity/Board.java index 36848f99..83dc539f 100644 --- a/src/main/java/com/massivecraft/factions/entity/Board.java +++ b/src/main/java/com/massivecraft/factions/entity/Board.java @@ -43,10 +43,7 @@ public class Board extends Entity implements BoardInterface { if (this.map == null) { return true; } - if (this.map.isEmpty()) { - return true; - } - return false; + return this.map.isEmpty(); } // -------------------------------------------- // @@ -249,11 +246,7 @@ public class Board extends Entity implements BoardInterface { } nearby = ps.withChunkZ(ps.getChunkZ() - 1); - if (faction != this.getFactionAt(nearby)) { - return true; - } - - return false; + return faction != this.getFactionAt(nearby); } @Override @@ -284,11 +277,7 @@ public class Board extends Entity implements BoardInterface { } 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/com/massivecraft/factions/entity/BoardColl.java b/src/main/java/com/massivecraft/factions/entity/BoardColl.java index 2da6d745..fed45736 100644 --- a/src/main/java/com/massivecraft/factions/entity/BoardColl.java +++ b/src/main/java/com/massivecraft/factions/entity/BoardColl.java @@ -37,6 +37,7 @@ public class BoardColl extends Coll implements BoardInterface { // STACK TRACEABILITY // -------------------------------------------- // + @SuppressWarnings("EmptyMethod") @Override public void onTick() { super.onTick(); diff --git a/src/main/java/com/massivecraft/factions/entity/Faction.java b/src/main/java/com/massivecraft/factions/entity/Faction.java index ca95816d..6ddb5748 100644 --- a/src/main/java/com/massivecraft/factions/entity/Faction.java +++ b/src/main/java/com/massivecraft/factions/entity/Faction.java @@ -829,11 +829,7 @@ public class Faction extends Entity implements FactionsParticipator, MP if (isPermitted(mplayer.getRank().getId(), permId)) { return true; } - if (isPermitted(RelationUtil.getRelationOfThatToMe(mplayer, this).toString(), permId)) { - return true; - } - - return false; + return isPermitted(RelationUtil.getRelationOfThatToMe(mplayer, this).toString(), permId); } public boolean isPlayerPermitted(MPlayer mplayer, MPerm mperm) { @@ -844,11 +840,7 @@ public class Faction extends Entity implements FactionsParticipator, MP if (isPermitted(faction.getId(), permId)) { return true; } - if (isPermitted(RelationUtil.getRelationOfThatToMe(faction, this).toString(), permId)) { - return true; - } - - return false; + return isPermitted(RelationUtil.getRelationOfThatToMe(faction, this).toString(), permId); } public boolean isFactionPermitted(Faction faction, MPerm mperm) { diff --git a/src/main/java/com/massivecraft/factions/entity/FactionColl.java b/src/main/java/com/massivecraft/factions/entity/FactionColl.java index 12e704a3..62f20b6e 100644 --- a/src/main/java/com/massivecraft/factions/entity/FactionColl.java +++ b/src/main/java/com/massivecraft/factions/entity/FactionColl.java @@ -28,6 +28,7 @@ public class FactionColl extends Coll { // STACK TRACEABILITY // -------------------------------------------- // + @SuppressWarnings("EmptyMethod") @Override public void onTick() { super.onTick(); diff --git a/src/main/java/com/massivecraft/factions/entity/MConfColl.java b/src/main/java/com/massivecraft/factions/entity/MConfColl.java index c342ef83..e0167986 100644 --- a/src/main/java/com/massivecraft/factions/entity/MConfColl.java +++ b/src/main/java/com/massivecraft/factions/entity/MConfColl.java @@ -18,6 +18,7 @@ public class MConfColl extends Coll { // STACK TRACEABILITY // -------------------------------------------- // + @SuppressWarnings("EmptyMethod") @Override public void onTick() { super.onTick(); diff --git a/src/main/java/com/massivecraft/factions/entity/MFlagColl.java b/src/main/java/com/massivecraft/factions/entity/MFlagColl.java index 2ad8dbe6..2d638d43 100644 --- a/src/main/java/com/massivecraft/factions/entity/MFlagColl.java +++ b/src/main/java/com/massivecraft/factions/entity/MFlagColl.java @@ -24,6 +24,7 @@ public class MFlagColl extends Coll { // STACK TRACEABILITY // -------------------------------------------- // + @SuppressWarnings("EmptyMethod") @Override public void onTick() { super.onTick(); diff --git a/src/main/java/com/massivecraft/factions/entity/MPermColl.java b/src/main/java/com/massivecraft/factions/entity/MPermColl.java index 0f984119..d11c7822 100644 --- a/src/main/java/com/massivecraft/factions/entity/MPermColl.java +++ b/src/main/java/com/massivecraft/factions/entity/MPermColl.java @@ -27,6 +27,7 @@ public class MPermColl extends Coll { // STACK TRACEABILITY // -------------------------------------------- // + @SuppressWarnings("EmptyMethod") @Override public void onTick() { super.onTick(); diff --git a/src/main/java/com/massivecraft/factions/entity/MPlayer.java b/src/main/java/com/massivecraft/factions/entity/MPlayer.java index 86e0854c..7b221e46 100644 --- a/src/main/java/com/massivecraft/factions/entity/MPlayer.java +++ b/src/main/java/com/massivecraft/factions/entity/MPlayer.java @@ -96,11 +96,7 @@ public class MPlayer extends SenderEntity implements FactionsParticipat if (this.isOverriding()) { return false; } - if (this.isTerritoryInfoTitles() != MConf.get().territoryInfoTitlesDefault) { - return false; - } - - return true; + return this.isTerritoryInfoTitles() == MConf.get().territoryInfoTitlesDefault; } // -------------------------------------------- // @@ -517,13 +513,7 @@ public class MPlayer extends SenderEntity implements FactionsParticipat // -------------------------------------------- // public boolean isMapAutoUpdating() { - if (this.mapAutoUpdating == null) { - return false; - } - if (this.mapAutoUpdating == false) { - return false; - } - return true; + return Objects.requireNonNullElse(this.mapAutoUpdating, false); } public void setMapAutoUpdating(Boolean mapAutoUpdating) { @@ -553,7 +543,7 @@ public class MPlayer extends SenderEntity implements FactionsParticipat if (this.overriding == null) { return false; } - if (this.overriding == false) { + if (!this.overriding) { return false; } diff --git a/src/main/java/com/massivecraft/factions/entity/MPlayerColl.java b/src/main/java/com/massivecraft/factions/entity/MPlayerColl.java index 8d26d4d6..09f5a5ae 100644 --- a/src/main/java/com/massivecraft/factions/entity/MPlayerColl.java +++ b/src/main/java/com/massivecraft/factions/entity/MPlayerColl.java @@ -21,6 +21,7 @@ public class MPlayerColl extends SenderColl { // STACK TRACEABILITY // -------------------------------------------- // + @SuppressWarnings("EmptyMethod") @Override public void onTick() { super.onTick(); diff --git a/src/main/java/com/massivecraft/factions/entity/Warp.java b/src/main/java/com/massivecraft/factions/entity/Warp.java index 0ecb3689..c60c3f5c 100644 --- a/src/main/java/com/massivecraft/factions/entity/Warp.java +++ b/src/main/java/com/massivecraft/factions/entity/Warp.java @@ -94,10 +94,7 @@ public class Warp extends EntityInternal implements Named { if (!MConf.get().warpsMustBeInClaimedTerritory) { return true; } - if (BoardColl.get().getFactionAt(this.getLocation()) == faction) { - return true; - } - return false; + return BoardColl.get().getFactionAt(this.getLocation()) == faction; } public boolean isValid() { diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsChunksChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsChunksChange.java index 8c20f3fb..5a56244c 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsChunksChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsChunksChange.java @@ -8,6 +8,7 @@ import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.util.MUtil; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.Map; @@ -22,7 +23,7 @@ public class EventFactionsChunksChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsCreate.java b/src/main/java/com/massivecraft/factions/event/EventFactionsCreate.java index 99f15381..757266b6 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsCreate.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsCreate.java @@ -2,6 +2,7 @@ package com.massivecraft.factions.event; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsCreate extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -11,7 +12,7 @@ public class EventFactionsCreate extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsCreateFlags.java b/src/main/java/com/massivecraft/factions/event/EventFactionsCreateFlags.java index ef6c29ff..a65af4b2 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsCreateFlags.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsCreateFlags.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.event; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; /** * External plugins that add Faction flags should make sure they exist when this event is called. @@ -13,7 +14,7 @@ public class EventFactionsCreateFlags extends EventFactionsAbstract { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsCreatePerms.java b/src/main/java/com/massivecraft/factions/event/EventFactionsCreatePerms.java index 154f26d2..ede6b364 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsCreatePerms.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsCreatePerms.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.event; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; /** * External plugins that add Faction perms should make sure they exist when this event is called. @@ -13,7 +14,7 @@ public class EventFactionsCreatePerms extends EventFactionsAbstract { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsDescriptionChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsDescriptionChange.java index 797eee57..c2bf9e1e 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsDescriptionChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsDescriptionChange.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.entity.Faction; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsDescriptionChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -12,7 +13,7 @@ public class EventFactionsDescriptionChange extends EventFactionsAbstractSender private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsDisband.java b/src/main/java/com/massivecraft/factions/event/EventFactionsDisband.java index e03af957..53898a60 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsDisband.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsDisband.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.entity.Faction; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsDisband extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -12,7 +13,7 @@ public class EventFactionsDisband extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsExpansions.java b/src/main/java/com/massivecraft/factions/event/EventFactionsExpansions.java index 2a38f652..8e6d45c5 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsExpansions.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsExpansions.java @@ -4,6 +4,7 @@ import com.massivecraft.massivecore.collections.MassiveTreeMap; import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; import java.util.Map; @@ -15,7 +16,7 @@ public class EventFactionsExpansions extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsFactionShowAsync.java b/src/main/java/com/massivecraft/factions/event/EventFactionsFactionShowAsync.java index 63f06eb3..fde25534 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsFactionShowAsync.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsFactionShowAsync.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.massivecore.PriorityLines; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Map; @@ -16,7 +17,7 @@ public class EventFactionsFactionShowAsync extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsFlagChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsFlagChange.java index 49b0ed8d..13ec906e 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsFlagChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsFlagChange.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MFlag; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsFlagChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -13,7 +14,7 @@ public class EventFactionsFlagChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsInvitedChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsInvitedChange.java index cb805990..b97087c3 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsInvitedChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsInvitedChange.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MPlayer; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsInvitedChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -13,7 +14,7 @@ public class EventFactionsInvitedChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsMembershipChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsMembershipChange.java index 9a010ab3..8ada36d4 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsMembershipChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsMembershipChange.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MPlayer; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsMembershipChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -13,7 +14,7 @@ public class EventFactionsMembershipChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsMotdChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsMotdChange.java index 96060c0f..884763d6 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsMotdChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsMotdChange.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.entity.Faction; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsMotdChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -12,7 +13,7 @@ public class EventFactionsMotdChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsNameChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsNameChange.java index e0464dc4..548f3e2c 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsNameChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsNameChange.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.entity.Faction; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsNameChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -12,7 +13,7 @@ public class EventFactionsNameChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsPermChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsPermChange.java index 93c8d9a5..4407467b 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsPermChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsPermChange.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.MPerm; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsPermChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -13,7 +14,7 @@ public class EventFactionsPermChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsPowerChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsPowerChange.java index cc960a81..6dd912be 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsPowerChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsPowerChange.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.entity.MPlayer; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsPowerChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -12,7 +13,7 @@ public class EventFactionsPowerChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } @@ -66,7 +67,6 @@ public class EventFactionsPowerChange extends EventFactionsAbstractSender { DEATH, COMMAND, UNDEFINED, - ; } } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsPvpDisallowed.java b/src/main/java/com/massivecraft/factions/event/EventFactionsPvpDisallowed.java index d86e1c96..e2fbe416 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsPvpDisallowed.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsPvpDisallowed.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.entity.MPlayer; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.jetbrains.annotations.NotNull; /** * This event is fired when PVP is disallowed between players due to any rules in Factions. @@ -21,7 +22,7 @@ public class EventFactionsPvpDisallowed extends EventFactionsAbstract { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsRankChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsRankChange.java index 7905b5a2..86df7d19 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsRankChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsRankChange.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.Rank; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsRankChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -13,7 +14,7 @@ public class EventFactionsRankChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsRelationChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsRelationChange.java index a36ace7a..7225e6e5 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsRelationChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsRelationChange.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Rel; import com.massivecraft.factions.entity.Faction; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsRelationChange extends EventFactionsAbstractSender { @@ -14,7 +15,7 @@ public class EventFactionsRelationChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsTitleChange.java b/src/main/java/com/massivecraft/factions/event/EventFactionsTitleChange.java index 6de85a85..37cedf86 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsTitleChange.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsTitleChange.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.entity.MPlayer; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsTitleChange extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -12,7 +13,7 @@ public class EventFactionsTitleChange extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsVoteAdd.java b/src/main/java/com/massivecraft/factions/event/EventFactionsVoteAdd.java index b2cb8564..0095c022 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsVoteAdd.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsVoteAdd.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Vote; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsVoteAdd extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -13,7 +14,7 @@ public class EventFactionsVoteAdd extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsVoteRemove.java b/src/main/java/com/massivecraft/factions/event/EventFactionsVoteRemove.java index 56edd7cd..740ae2ab 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsVoteRemove.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsVoteRemove.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Vote; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsVoteRemove extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -13,7 +14,7 @@ public class EventFactionsVoteRemove extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsWarpAdd.java b/src/main/java/com/massivecraft/factions/event/EventFactionsWarpAdd.java index 09645497..041c9d8f 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsWarpAdd.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsWarpAdd.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Warp; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsWarpAdd extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -13,7 +14,7 @@ public class EventFactionsWarpAdd extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsWarpRemove.java b/src/main/java/com/massivecraft/factions/event/EventFactionsWarpRemove.java index 725cfa38..6699ccf3 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsWarpRemove.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsWarpRemove.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Warp; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsWarpRemove extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -13,7 +14,7 @@ public class EventFactionsWarpRemove extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/EventFactionsWarpTeleport.java b/src/main/java/com/massivecraft/factions/event/EventFactionsWarpTeleport.java index 713543eb..a45244cb 100644 --- a/src/main/java/com/massivecraft/factions/event/EventFactionsWarpTeleport.java +++ b/src/main/java/com/massivecraft/factions/event/EventFactionsWarpTeleport.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.entity.Warp; import org.bukkit.command.CommandSender; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; public class EventFactionsWarpTeleport extends EventFactionsAbstractSender { // -------------------------------------------- // @@ -12,7 +13,7 @@ public class EventFactionsWarpTeleport extends EventFactionsAbstractSender { private static final HandlerList handlers = new HandlerList(); @Override - public HandlerList getHandlers() { + public @NotNull HandlerList getHandlers() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/integration/Econ.java b/src/main/java/com/massivecraft/factions/integration/Econ.java index 8b1f0dd3..93eeddd1 100644 --- a/src/main/java/com/massivecraft/factions/integration/Econ.java +++ b/src/main/java/com/massivecraft/factions/integration/Econ.java @@ -103,9 +103,7 @@ public class Econ { if (me instanceof Faction && mperm.has((Faction) me, fYou)) { return true; } - if (me instanceof MPlayer && mperm.has((MPlayer) me, fYou, false)) { - return true; - } + return me instanceof MPlayer && mperm.has((MPlayer) me, fYou, false); } // Otherwise you may not! ;,,; @@ -168,12 +166,12 @@ public class Econ { public static Set getMPlayers(EconomyParticipator ep) { Set mplayers = new HashSet<>(); - if (ep == null) { - // Add nothing - } else if (ep instanceof MPlayer) { - mplayers.add((MPlayer) ep); - } else if (ep instanceof Faction) { - mplayers.addAll(((Faction) ep).getMPlayers()); + if (ep != null) { + if (ep instanceof MPlayer) { + mplayers.add((MPlayer) ep); + } else if (ep instanceof Faction) { + mplayers.addAll(((Faction) ep).getMPlayers()); + } } return mplayers; @@ -294,8 +292,8 @@ public class Econ { faction.setMoney(money - amount); } else if (from != null) { boolean temp = Money.despawn(from, by, amount); - if (temp == false) { - return temp; + if (!temp) { + return false; } } diff --git a/src/main/java/com/massivecraft/factions/integration/dynmap/DynmapStyle.java b/src/main/java/com/massivecraft/factions/integration/dynmap/DynmapStyle.java index 6ea74e61..f4bb32fa 100644 --- a/src/main/java/com/massivecraft/factions/integration/dynmap/DynmapStyle.java +++ b/src/main/java/com/massivecraft/factions/integration/dynmap/DynmapStyle.java @@ -117,7 +117,7 @@ public class DynmapStyle { int ret = 0x00FF00; try { ret = Integer.parseInt(string.substring(1), 16); - } catch (NumberFormatException nfx) { + } catch (NumberFormatException ignored) { } return ret; diff --git a/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java b/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java index de5ca0a9..30ee1876 100644 --- a/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java +++ b/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java @@ -630,12 +630,7 @@ public class EngineDynmap extends Engine { return false; } - if (!hidden.isEmpty() && hidden.stream().anyMatch(ids::contains)) { - return false; - } - - - return true; + return hidden.isEmpty() || hidden.stream().noneMatch(ids::contains); } // Thread Safe / Asynchronous: Yes diff --git a/src/main/java/com/massivecraft/factions/integration/lwc/EngineLwc.java b/src/main/java/com/massivecraft/factions/integration/lwc/EngineLwc.java index c3fa0c7a..77ec4f86 100644 --- a/src/main/java/com/massivecraft/factions/integration/lwc/EngineLwc.java +++ b/src/main/java/com/massivecraft/factions/integration/lwc/EngineLwc.java @@ -58,7 +58,7 @@ public class EngineLwc extends Engine { if (remove == null) { return; } - if (remove == false) { + if (!remove) { return; } diff --git a/src/main/java/com/massivecraft/factions/integration/placeholderapi/PlaceholderFactions.java b/src/main/java/com/massivecraft/factions/integration/placeholderapi/PlaceholderFactions.java index 4b33c3a7..8ec1d441 100644 --- a/src/main/java/com/massivecraft/factions/integration/placeholderapi/PlaceholderFactions.java +++ b/src/main/java/com/massivecraft/factions/integration/placeholderapi/PlaceholderFactions.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.MPlayer; import me.clip.placeholderapi.expansion.PlaceholderExpansion; import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; import java.text.DecimalFormat; @@ -24,22 +25,22 @@ public class PlaceholderFactions extends PlaceholderExpansion { // -------------------------------------------- // @Override - public String getIdentifier() { + public @NotNull String getIdentifier() { return "factions"; } @Override - public String getAuthor() { + public @NotNull String getAuthor() { return "Madus"; } @Override - public String getVersion() { + public @NotNull String getVersion() { return Factions.get().getDescription().getVersion(); } @Override - public String onPlaceholderRequest(Player player, String params) { + public String onPlaceholderRequest(Player player, @NotNull String params) { if (player == null) { return null; } diff --git a/src/main/java/com/massivecraft/factions/task/TaskTax.java b/src/main/java/com/massivecraft/factions/task/TaskTax.java index 65d8e597..e4385102 100644 --- a/src/main/java/com/massivecraft/factions/task/TaskTax.java +++ b/src/main/java/com/massivecraft/factions/task/TaskTax.java @@ -181,11 +181,7 @@ public class TaskTax extends Task { } int inactiveDays = MConf.get().taxInactiveDays; - if (inactiveDays > 0 && offlinePeriod > inactiveDays * TimeUnit.MILLIS_PER_DAY) { - return false; - } - - return true; + return inactiveDays <= 0 || offlinePeriod <= inactiveDays * TimeUnit.MILLIS_PER_DAY; } private boolean tryKickPlayer(MPlayer mplayer) {