diff --git a/pom.xml b/pom.xml
index 296c675d..52ef35c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,7 +83,9 @@
package
- proguard
+
+ proguard
+
@@ -103,7 +105,7 @@
-
+
diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java
index 7d090084..3576dfa9 100644
--- a/src/main/java/com/massivecraft/factions/Conf.java
+++ b/src/main/java/com/massivecraft/factions/Conf.java
@@ -21,7 +21,6 @@ public class Conf {
public static final transient boolean DYNMAP_STYLE_BOOST = false;
public static List baseCommandAliases = new ArrayList<>();
public static boolean allowNoSlashCommand = true;
- public static Set allowedStealthFactions = new LinkedHashSet<>();
// Colors
public static ChatColor colorMember = ChatColor.GREEN;
diff --git a/src/main/java/com/massivecraft/factions/FLocation.java b/src/main/java/com/massivecraft/factions/FLocation.java
index f966303f..672818bc 100644
--- a/src/main/java/com/massivecraft/factions/FLocation.java
+++ b/src/main/java/com/massivecraft/factions/FLocation.java
@@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import java.io.Serializable;
import java.util.HashSet;
import java.util.LinkedHashSet;
+import java.util.Objects;
import java.util.Set;
public class FLocation implements Serializable {
@@ -251,6 +252,6 @@ public class FLocation implements Serializable {
}
FLocation that = (FLocation) obj;
- return this.x == that.x && this.z == that.z && (this.worldName == null ? that.worldName == null : this.worldName.equals(that.worldName));
+ return this.x == that.x && this.z == that.z && (Objects.equals(this.worldName, that.worldName));
}
}
\ No newline at end of file
diff --git a/src/main/java/com/massivecraft/factions/FPlayer.java b/src/main/java/com/massivecraft/factions/FPlayer.java
index 5a216868..7e7b164d 100644
--- a/src/main/java/com/massivecraft/factions/FPlayer.java
+++ b/src/main/java/com/massivecraft/factions/FPlayer.java
@@ -367,11 +367,11 @@ public interface FPlayer extends EconomyParticipator {
boolean checkIfNearbyEnemies();
- public int getCooldown(String cmd);
+ int getCooldown(String cmd);
- public void setCooldown(String cmd, long cooldown);
+ void setCooldown(String cmd, long cooldown);
- public boolean isCooldownEnded(String cmd);
+ boolean isCooldownEnded(String cmd);
// -------------------------------
diff --git a/src/main/java/com/massivecraft/factions/FPlayers.java b/src/main/java/com/massivecraft/factions/FPlayers.java
index a11917e7..4faf210c 100644
--- a/src/main/java/com/massivecraft/factions/FPlayers.java
+++ b/src/main/java/com/massivecraft/factions/FPlayers.java
@@ -14,9 +14,8 @@ public abstract class FPlayers {
}
private static FPlayers getFPlayersImpl() {
- switch (Conf.backEnd) {
- case JSON:
- return new JSONFPlayers();
+ if (Conf.backEnd == Conf.Backend.JSON) {
+ return new JSONFPlayers();
}
return null;
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java b/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java
index caf90c96..48bcbbaa 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdConvert.java
@@ -27,14 +27,11 @@ public class CmdConvert extends FCommand {
this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_RUNNING.toString());
return;
}
- switch (nb) {
- case JSON:
- FactionsJSON.convertTo();
- break;
- default:
- this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_INVALID.toString());
- return;
-
+ if (nb == Backend.JSON) {
+ FactionsJSON.convertTo();
+ } else {
+ this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_INVALID.toString());
+ return;
}
Conf.backEnd = nb;
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java
index 409072cd..138bc22e 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java
@@ -79,9 +79,7 @@ public class CmdHome extends FCommand {
final Location loc = me.getLocation().clone();
// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
- if (Conf.homesTeleportAllowedEnemyDistance > 0 &&
- !faction.isSafeZone() &&
- (!fme.isInOwnTerritory() || (fme.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) {
+ if (Conf.homesTeleportAllowedEnemyDistance > 0 && !faction.isSafeZone() && (!fme.isInOwnTerritory() || !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory)) {
World w = loc.getWorld();
double x = loc.getX();
double y = loc.getY();
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdList.java b/src/main/java/com/massivecraft/factions/cmd/CmdList.java
index a9af32a3..e6458ae4 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdList.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdList.java
@@ -69,7 +69,7 @@ public class CmdList extends FCommand {
});
// Then sort by how many members are online now
- Collections.sort(factionList, (f1, f2) -> {
+ factionList.sort((f1, f2) -> {
int f1Size = f1.getFPlayersWhereOnline(true).size();
int f2Size = f2.getFPlayersWhereOnline(true).size();
if (f1Size < f2Size) {
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdRules.java b/src/main/java/com/massivecraft/factions/cmd/CmdRules.java
index 91b75021..43c443e3 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdRules.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdRules.java
@@ -67,7 +67,7 @@ public class CmdRules extends FCommand {
String message = "";
StringBuilder string = new StringBuilder(message);
for (int i = 1; i <= args.size() - 1; i++) {
- string.append(" " + args.get(i));
+ string.append(" ").append(args.get(i));
}
fme.getFaction().addRule(string.toString());
fme.msg(TL.COMMAND_RULES_ADD_SUCCESS);
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java b/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java
index 496cd3a7..376d83f4 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java
@@ -72,9 +72,7 @@ public class CmdSeeChunk extends FCommand {
private void startTask() {
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(SaberFactions.plugin, () -> {
- Iterator itr = seeChunkMap.keySet().iterator();
- while (itr.hasNext()) {
- Object nameObject = itr.next();
+ for (Object nameObject : seeChunkMap.keySet()) {
String name = nameObject + "";
Player player = Bukkit.getPlayer(name);
showBorders(player);
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdStrikeSet.java b/src/main/java/com/massivecraft/factions/cmd/CmdStrikeSet.java
index c2230d0b..6f394027 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdStrikeSet.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdStrikeSet.java
@@ -43,25 +43,28 @@ public class CmdStrikeSet extends FCommand {
if (faction == null) {
fme.msg(TL.COMMAND_SETSTRIKES_FAILURE.toString().replace("{faction}", args.get(1)));
}
- if (args.get(0).equalsIgnoreCase("set")) {
- faction.setStrikes(argAsInt(2));
- success = true;
- } else if (args.get(0).equalsIgnoreCase("give")) {
- faction.setStrikes(faction.getStrikes() + argAsInt(2));
- success = true;
- } else if (args.get(0).equalsIgnoreCase("take")) {
- faction.setStrikes(faction.getStrikes() - argAsInt(2));
- success = true;
- }
- if (success) {
- for (FPlayer fPlayer : FPlayers.getInstance().getOnlinePlayers()) {
- fPlayer.msg(TL.COMMAND_SETSTRIKES_BROADCAST.toString()
- .replace("{faction}", faction.getTag())
- .replace("{reason}", getReason()));
+
+ if (faction != null) {
+ if (args.get(0).equalsIgnoreCase("set")) {
+ faction.setStrikes(argAsInt(2));
+ success = true;
+ } else if (args.get(0).equalsIgnoreCase("give")) {
+ faction.setStrikes(faction.getStrikes() + argAsInt(2));
+ success = true;
+ } else if (args.get(0).equalsIgnoreCase("take")) {
+ faction.setStrikes(faction.getStrikes() - argAsInt(2));
+ success = true;
+ }
+ if (success) {
+ for (FPlayer fPlayer : FPlayers.getInstance().getOnlinePlayers()) {
+ fPlayer.msg(TL.COMMAND_SETSTRIKES_BROADCAST.toString()
+ .replace("{faction}", faction.getTag())
+ .replace("{reason}", getReason()));
+ }
+ fme.msg(TL.COMMAND_SETSTRIKES_SUCCESS.toString()
+ .replace("{faction}", faction.getTag())
+ .replace("{strikes}", faction.getStrikes() + ""));
}
- fme.msg(TL.COMMAND_SETSTRIKES_SUCCESS.toString()
- .replace("{faction}", faction.getTag())
- .replace("{strikes}", faction.getStrikes() + ""));
}
}
diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java
index 0696ad25..783ca512 100644
--- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java
+++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java
@@ -496,7 +496,6 @@ public class FactionsBlockListener implements Listener {
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners");
- return;
}
}
}
diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java
index 43bad0fe..327e9031 100644
--- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java
+++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java
@@ -244,16 +244,9 @@ public class FactionsEntityListener implements Listener {
}
// Loop the blocklist to run checks on each aimed block
- Iterator blockList = event.blockList().iterator();
- while (blockList.hasNext()) {
- Block block = blockList.next();
-
- if (!this.checkExplosionForBlock(boomer, block)) {
- // The block don't have to explode
- blockList.remove();
- }
- }
+ // The block don't have to explode
+ event.blockList().removeIf(block -> !this.checkExplosionForBlock(boomer, block));
// Cancel the event if no block will explode
if (!event.blockList().isEmpty() && (boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart) && Conf.handleExploitTNTWaterlog) {
@@ -302,10 +295,7 @@ public class FactionsEntityListener implements Listener {
return false;
} else if (
// it's a bit crude just using fireball protection for Wither boss too, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever
- (boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) ||
- (faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) ||
- (faction.isWarZone() && Conf.warZoneBlockFireballs) ||
- faction.isSafeZone())) {
+ (boomer instanceof Fireball || boomer instanceof Wither) && (faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(block.getWorld().getName()) || faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline) || faction.isWarZone() && Conf.warZoneBlockFireballs || faction.isSafeZone())) {
// ghast fireball which needs prevention
return false;
} else
diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
index 635b44df..4e50e3aa 100644
--- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
+++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
@@ -992,9 +992,7 @@ public class FactionsPlayerListener implements Listener {
//we made it this far, since we didn't return yet, we must have sent the chat event through
//iterate through all of recipients and check if they're muted, then remove them from the event list
- List l = new ArrayList<>();
-
- l.addAll(e.getRecipients());
+ List l = new ArrayList<>(e.getRecipients());
for (int i = l.size() - 1; i >= 0; i--){ // going backwards in the list to prevent a ConcurrentModificationException
Player recipient = l.get(i);
diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java b/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java
index 6a7d4d83..5aa24fdf 100644
--- a/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java
+++ b/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java
@@ -7,6 +7,7 @@ import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.zcore.util.TagUtil;
import java.util.List;
+import java.util.Objects;
public abstract class FSidebarProvider {
@@ -24,7 +25,7 @@ public abstract class FSidebarProvider {
// Run through Placeholder API first
s = TagUtil.parsePlaceholders(fPlayer.getPlayer(), s);
- return qualityAssure(TagUtil.parsePlain(faction, fPlayer, s));
+ return qualityAssure(Objects.requireNonNull(TagUtil.parsePlain(faction, fPlayer, s)));
}
private String qualityAssure(String line) {
diff --git a/src/main/java/com/massivecraft/factions/skript/expressions/player/PlayerChunkLocationExpression.java b/src/main/java/com/massivecraft/factions/skript/expressions/player/PlayerChunkLocationExpression.java
index 33fcbe6c..68873c29 100644
--- a/src/main/java/com/massivecraft/factions/skript/expressions/player/PlayerChunkLocationExpression.java
+++ b/src/main/java/com/massivecraft/factions/skript/expressions/player/PlayerChunkLocationExpression.java
@@ -51,5 +51,4 @@ public class PlayerChunkLocationExpression extends SimpleExpression {
}
return null;
}
-
}
diff --git a/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java
index 8ff40c86..b6a55686 100644
--- a/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java
+++ b/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java
@@ -40,9 +40,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer