Fixes more warnings

This commit is contained in:
Kristian Knarvik 2023-06-23 21:51:30 +02:00
parent 9986e940c5
commit 75140cf97b
69 changed files with 142 additions and 175 deletions

View File

@ -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();

View File

@ -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<PS> getChunks() throws MassiveException {
public Set<PS> getChunks() {
// Common Startup
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);

View File

@ -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;

View File

@ -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:");

View File

@ -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.");

View File

@ -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 <h>%.2f <i>to <h>%.2f<i>.", 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 <h>%.2f<i>", msender.getPower());

View File

@ -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<Rank> ranks = msenderFaction.getRanks().getAll(Comparator.comparingInt(Rank::getPriority).reversed());

View File

@ -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<TimeUnit, Long> timeUnitcounts = TimeDiffUtil.limit(TimeDiffUtil.unitcounts(MConf.get().taxTaskPeriodMillis, TimeUnit.getAll()), 3);
String periodString = TimeDiffUtil.formatedVerboose(timeUnitcounts);

View File

@ -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) {

View File

@ -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();
}

View File

@ -38,7 +38,7 @@ public class CmdFactionsFly extends MassiveCommandToggle {
}
@Override
public boolean getValue() throws MassiveException {
public boolean getValue() {
return MPlayer.get(sender).isFlying();
}

View File

@ -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<String> args = MUtil.list(MConf.get().warpsHomeName, this.argAt(0));
CmdFactions.get().cmdFactionsWarp.cmdFactionsWarpGo.execute(me, args);
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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

View File

@ -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();

View File

@ -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();

View File

@ -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<PS> getChunks() throws MassiveException {
public Set<PS> getChunks() {
// Common Startup
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);

View File

@ -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<String> args = MUtil.list(MConf.get().warpsHomeName, this.argAt(0));
CmdFactions.get().cmdFactionsWarp.cmdFactionWarpAdd.execute(me, args);
}

View File

@ -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());
}

View File

@ -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) {

View File

@ -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<String> args = MUtil.list(MConf.get().warpsHomeName, this.argAt(0));
CmdFactions.get().cmdFactionsWarp.cmdFactionWarpRemove.execute(me, args);
}

View File

@ -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());

View File

@ -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();

View File

@ -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();
}

View File

@ -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("<i>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("<i>You can't hurt %s<i>.", relation.getDescPlayerMany());

View File

@ -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;

View File

@ -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;
}

View File

@ -112,7 +112,7 @@ public class EngineFly extends Engine {
if (event.getFlag() != MFlag.getFlagFly()) {
return;
}
if (event.isNewValue() == true) {
if (event.isNewValue()) {
return;
}

View File

@ -43,10 +43,7 @@ public class Board extends Entity<Board> 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<Board> 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<Board> implements BoardInterface {
}
nearby = ps.withChunkZ(ps.getChunkZ() - 1);
if (faction == this.getFactionAt(nearby)) {
return true;
}
return false;
return faction == this.getFactionAt(nearby);
}
@Override

View File

@ -37,6 +37,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface {
// STACK TRACEABILITY
// -------------------------------------------- //
@SuppressWarnings("EmptyMethod")
@Override
public void onTick() {
super.onTick();

View File

@ -829,11 +829,7 @@ public class Faction extends Entity<Faction> 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<Faction> 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) {

View File

@ -28,6 +28,7 @@ public class FactionColl extends Coll<Faction> {
// STACK TRACEABILITY
// -------------------------------------------- //
@SuppressWarnings("EmptyMethod")
@Override
public void onTick() {
super.onTick();

View File

@ -18,6 +18,7 @@ public class MConfColl extends Coll<MConf> {
// STACK TRACEABILITY
// -------------------------------------------- //
@SuppressWarnings("EmptyMethod")
@Override
public void onTick() {
super.onTick();

View File

@ -24,6 +24,7 @@ public class MFlagColl extends Coll<MFlag> {
// STACK TRACEABILITY
// -------------------------------------------- //
@SuppressWarnings("EmptyMethod")
@Override
public void onTick() {
super.onTick();

View File

@ -27,6 +27,7 @@ public class MPermColl extends Coll<MPerm> {
// STACK TRACEABILITY
// -------------------------------------------- //
@SuppressWarnings("EmptyMethod")
@Override
public void onTick() {
super.onTick();

View File

@ -96,11 +96,7 @@ public class MPlayer extends SenderEntity<MPlayer> 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<MPlayer> 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<MPlayer> implements FactionsParticipat
if (this.overriding == null) {
return false;
}
if (this.overriding == false) {
if (!this.overriding) {
return false;
}

View File

@ -21,6 +21,7 @@ public class MPlayerColl extends SenderColl<MPlayer> {
// STACK TRACEABILITY
// -------------------------------------------- //
@SuppressWarnings("EmptyMethod")
@Override
public void onTick() {
super.onTick();

View File

@ -94,10 +94,7 @@ public class Warp extends EntityInternal<Warp> 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() {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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,
;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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,13 +166,13 @@ public class Econ {
public static Set<MPlayer> getMPlayers(EconomyParticipator ep) {
Set<MPlayer> mplayers = new HashSet<>();
if (ep == null) {
// Add nothing
} else if (ep instanceof MPlayer) {
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;
}
}

View File

@ -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;

View File

@ -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

View File

@ -58,7 +58,7 @@ public class EngineLwc extends Engine {
if (remove == null) {
return;
}
if (remove == false) {
if (!remove) {
return;
}

View File

@ -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;
}

View File

@ -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) {