From bdbc1c79a2fd537f65f28662de4ca87cc1ebd9d9 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 24 Mar 2017 14:03:29 +0100 Subject: [PATCH] IntelliJ Inspection Based Cleanup --- .../factions/EconomyParticipator.java | 2 +- .../massivecraft/factions/PowerBoosted.java | 4 +- src/com/massivecraft/factions/Rel.java | 2 +- .../factions/RelationParticipator.java | 10 ++--- .../factions/TerritoryAccess.java | 12 ++--- .../factions/adapter/BoardMapAdapter.java | 2 +- .../factions/chat/ChatFormatter.java | 2 +- .../cmd/CmdFactionsAccessAbstract.java | 2 +- .../factions/cmd/CmdFactionsFaction.java | 2 +- .../factions/cmd/CmdFactionsInviteList.java | 3 +- .../factions/cmd/CmdFactionsInviteRemove.java | 4 +- .../factions/cmd/CmdFactionsName.java | 2 +- .../factions/cmd/CmdFactionsPermList.java | 2 +- .../factions/cmd/CmdFactionsRank.java | 4 +- .../factions/cmd/CmdFactionsRelationList.java | 4 +- .../factions/cmd/CmdFactionsRelationSet.java | 2 +- .../factions/cmd/CmdFactionsSetCircle.java | 2 +- .../factions/cmd/CmdFactionsSetFill.java | 4 +- .../factions/cmd/CmdFactionsSetSquare.java | 2 +- .../factions/cmd/CmdFactionsStatus.java | 5 ++- .../factions/cmd/CmdFactionsUnstuck.java | 2 +- .../factions/cmd/type/TypeFaction.java | 2 +- .../factions/cmd/type/TypeRank.java | 6 +-- .../factions/engine/DisallowCause.java | 1 - .../factions/engine/EngineEcon.java | 2 +- .../factions/engine/EngineExploit.java | 4 +- .../factions/engine/EngineFlagExplosion.java | 2 +- .../factions/engine/EngineSeeChunk.java | 2 +- .../factions/engine/EngineShow.java | 12 ++--- .../massivecraft/factions/entity/Board.java | 14 +++--- .../factions/entity/BoardColl.java | 16 +++---- .../factions/entity/BoardInterface.java | 40 ++++++++--------- .../massivecraft/factions/entity/Faction.java | 44 +++++++++---------- .../factions/entity/FactionColl.java | 4 +- .../massivecraft/factions/entity/MConf.java | 28 ++++++------ .../factions/entity/MFlagColl.java | 2 +- .../massivecraft/factions/entity/MPerm.java | 4 +- .../factions/entity/MPermColl.java | 2 +- .../massivecraft/factions/entity/MPlayer.java | 2 +- .../event/EventFactionsChunksChange.java | 2 +- .../event/EventFactionsExpansions.java | 2 +- .../event/EventFactionsFactionShowAsync.java | 2 +- .../event/EventFactionsMembershipChange.java | 2 +- .../EventFactionsRemovePlayerMillis.java | 2 +- .../factions/integration/Econ.java | 4 +- .../factions/integration/V19/EngineV19.java | 2 +- .../herochat/ChannelFactionsAbstract.java | 6 +-- .../herochat/ChannelFactionsFaction.java | 2 +- .../worldguard/EngineWorldGuard.java | 2 +- .../factions/update/UpdateUtil.java | 4 +- .../factions/util/AsciiCompassDirection.java | 2 +- .../massivecraft/factions/util/MiscUtil.java | 10 ++--- .../factions/util/VisualizeUtil.java | 4 +- 53 files changed, 154 insertions(+), 153 deletions(-) diff --git a/src/com/massivecraft/factions/EconomyParticipator.java b/src/com/massivecraft/factions/EconomyParticipator.java index c57bf9b9..94c14b79 100644 --- a/src/com/massivecraft/factions/EconomyParticipator.java +++ b/src/com/massivecraft/factions/EconomyParticipator.java @@ -2,5 +2,5 @@ package com.massivecraft.factions; public interface EconomyParticipator extends RelationParticipator { - public boolean msg(String msg, Object... args); + boolean msg(String msg, Object... args); } diff --git a/src/com/massivecraft/factions/PowerBoosted.java b/src/com/massivecraft/factions/PowerBoosted.java index 58aaf1b1..84ccebfe 100644 --- a/src/com/massivecraft/factions/PowerBoosted.java +++ b/src/com/massivecraft/factions/PowerBoosted.java @@ -2,6 +2,6 @@ package com.massivecraft.factions; public interface PowerBoosted { - public double getPowerBoost(); - public void setPowerBoost(Double powerBoost); + double getPowerBoost(); + void setPowerBoost(Double powerBoost); } diff --git a/src/com/massivecraft/factions/Rel.java b/src/com/massivecraft/factions/Rel.java index 8572dc03..965649d5 100644 --- a/src/com/massivecraft/factions/Rel.java +++ b/src/com/massivecraft/factions/Rel.java @@ -90,7 +90,7 @@ public enum Rel implements Colorized, Named this.descPlayerMany = descPlayerMany; this.descFactionOne = descFactionOne; this.descFactionMany = descFactionMany; - this.names = Collections.unmodifiableSet(new MassiveSet(names)); + this.names = Collections.unmodifiableSet(new MassiveSet<>(names)); } // -------------------------------------------- // diff --git a/src/com/massivecraft/factions/RelationParticipator.java b/src/com/massivecraft/factions/RelationParticipator.java index 349aa22c..9a495431 100644 --- a/src/com/massivecraft/factions/RelationParticipator.java +++ b/src/com/massivecraft/factions/RelationParticipator.java @@ -5,11 +5,11 @@ import org.bukkit.ChatColor; public interface RelationParticipator { - public String describeTo(RelationParticipator observer); - public String describeTo(RelationParticipator observer, boolean ucfirst); + String describeTo(RelationParticipator observer); + String describeTo(RelationParticipator observer, boolean ucfirst); - public Rel getRelationTo(RelationParticipator observer); - public Rel getRelationTo(RelationParticipator observer, boolean ignorePeaceful); + Rel getRelationTo(RelationParticipator observer); + Rel getRelationTo(RelationParticipator observer, boolean ignorePeaceful); - public ChatColor getColorTo(RelationParticipator observer); + ChatColor getColorTo(RelationParticipator observer); } diff --git a/src/com/massivecraft/factions/TerritoryAccess.java b/src/com/massivecraft/factions/TerritoryAccess.java index cdb35c33..6e92c343 100644 --- a/src/com/massivecraft/factions/TerritoryAccess.java +++ b/src/com/massivecraft/factions/TerritoryAccess.java @@ -53,7 +53,7 @@ public class TerritoryAccess return valueOf(hostFactionId, with, factionIds, playerIds); } - Set factionIds = new HashSet(this.getFactionIds()); + Set factionIds = new HashSet<>(this.getFactionIds()); if (with) { factionIds.add(factionId); @@ -68,7 +68,7 @@ public class TerritoryAccess public TerritoryAccess withPlayerId(String playerId, boolean with) { playerId = playerId.toLowerCase(); - Set playerIds = new HashSet(this.getPlayerIds()); + Set playerIds = new HashSet<>(this.getPlayerIds()); if (with) { playerIds.add(playerId); @@ -102,7 +102,7 @@ public class TerritoryAccess public LinkedHashSet getGrantedMPlayers() { - LinkedHashSet ret = new LinkedHashSet(); + LinkedHashSet ret = new LinkedHashSet<>(); for (String playerId : this.getPlayerIds()) { ret.add(MPlayer.get(playerId)); @@ -112,7 +112,7 @@ public class TerritoryAccess public LinkedHashSet getGrantedFactions() { - LinkedHashSet ret = new LinkedHashSet(); + LinkedHashSet ret = new LinkedHashSet<>(); for (String factionId : this.getFactionIds()) { ret.add(FactionColl.get().get(factionId)); @@ -129,7 +129,7 @@ public class TerritoryAccess if (hostFactionId == null) throw new IllegalArgumentException("hostFactionId was null"); this.hostFactionId = hostFactionId; - Set factionIdsInner = new TreeSet(); + Set factionIdsInner = new TreeSet<>(); if (factionIds != null) { factionIdsInner.addAll(factionIds); @@ -140,7 +140,7 @@ public class TerritoryAccess } this.factionIds = Collections.unmodifiableSet(factionIdsInner); - Set playerIdsInner = new TreeSet(String.CASE_INSENSITIVE_ORDER); + Set playerIdsInner = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); if (playerIds != null) { for (String playerId : playerIds) diff --git a/src/com/massivecraft/factions/adapter/BoardMapAdapter.java b/src/com/massivecraft/factions/adapter/BoardMapAdapter.java index e016d72a..89fc0bfc 100644 --- a/src/com/massivecraft/factions/adapter/BoardMapAdapter.java +++ b/src/com/massivecraft/factions/adapter/BoardMapAdapter.java @@ -31,7 +31,7 @@ public class BoardMapAdapter implements JsonDeserializer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - Map ret = new ConcurrentSkipListMap(); + Map ret = new ConcurrentSkipListMap<>(); JsonObject jsonObject = json.getAsJsonObject(); diff --git a/src/com/massivecraft/factions/chat/ChatFormatter.java b/src/com/massivecraft/factions/chat/ChatFormatter.java index f033fa3c..083e1524 100644 --- a/src/com/massivecraft/factions/chat/ChatFormatter.java +++ b/src/com/massivecraft/factions/chat/ChatFormatter.java @@ -55,7 +55,7 @@ public class ChatFormatter String[] parts = submatch.split(ESC_SEPARATOR); // The modifier ids are something like ["lp", "rp"] and tagId something like "sender" - List modifierIds = new ArrayList(Arrays.asList(parts)); + List modifierIds = new ArrayList<>(Arrays.asList(parts)); String tagId = modifierIds.remove(0); // Fetch tag for the id diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsAccessAbstract.java b/src/com/massivecraft/factions/cmd/CmdFactionsAccessAbstract.java index 9280dc28..3d21c36a 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsAccessAbstract.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsAccessAbstract.java @@ -66,7 +66,7 @@ public abstract class CmdFactionsAccessAbstract extends FactionsCommand public static String describeRelationParticipators(Collection relationParticipators, RelationParticipator observer) { if (relationParticipators.size() == 0) return Txt.parse("none"); - List descriptions = new ArrayList(); + List descriptions = new ArrayList<>(); for (RelationParticipator relationParticipator : relationParticipators) { descriptions.add(relationParticipator.describeTo(observer)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java b/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java index 83fd9879..30f9cf76 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java @@ -53,7 +53,7 @@ public class CmdFactionsFaction extends FactionsCommand MixinMessage.get().messageOne(sender, Txt.titleize("Faction " + faction.getName(msender))); // Lines - TreeSet priorityLiness = new TreeSet(event.getIdPriorityLiness().values()); + TreeSet priorityLiness = new TreeSet<>(event.getIdPriorityLiness().values()); for (PriorityLines priorityLines : priorityLiness) { MixinMessage.get().messageOne(sender, priorityLines.getLines()); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsInviteList.java b/src/com/massivecraft/factions/cmd/CmdFactionsInviteList.java index 892ff008..994a14cd 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsInviteList.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsInviteList.java @@ -46,7 +46,8 @@ public class CmdFactionsInviteList extends FactionsCommand // Pager Create final List mplayers = faction.getInvitedMPlayers(); - final Pager pager = new Pager(this, "Invited Players List", page, mplayers, new Stringifier(){ + final Pager pager = new Pager<>(this, "Invited Players List", page, mplayers, new Stringifier() + { public String toString(MPlayer target, int index) { // TODO: Madus would like to implement this in MPlayer diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsInviteRemove.java b/src/com/massivecraft/factions/cmd/CmdFactionsInviteRemove.java index 9eb743f3..dd82fa00 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsInviteRemove.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsInviteRemove.java @@ -33,7 +33,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand @Override public void perform() throws MassiveException { - Set mplayers = new HashSet(); + Set mplayers = new HashSet<>(); boolean all = false; // Args @@ -123,7 +123,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand // Inform Faction if all if (all) { - List names = new ArrayList(); + List names = new ArrayList<>(); for (MPlayer mplayer : mplayers) { names.add(mplayer.describeTo(msender, true)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsName.java b/src/com/massivecraft/factions/cmd/CmdFactionsName.java index 5d0aff2a..bdf56ffa 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsName.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsName.java @@ -45,7 +45,7 @@ public class CmdFactionsName extends FactionsCommand return; } - ArrayList errors = new ArrayList(); + ArrayList errors = new ArrayList<>(); errors.addAll(FactionColl.get().validateName(newName)); if (errors.size() > 0) { diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPermList.java b/src/com/massivecraft/factions/cmd/CmdFactionsPermList.java index ba1d2d77..8cdb06b0 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPermList.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPermList.java @@ -31,7 +31,7 @@ public class CmdFactionsPermList extends FactionsCommand int page = this.readArg(); // Create messages - List messages = new ArrayList(); + List messages = new ArrayList<>(); for (MPerm perm : MPerm.getAll()) { diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRank.java b/src/com/massivecraft/factions/cmd/CmdFactionsRank.java index 2c17dbf5..b9e0098a 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRank.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRank.java @@ -284,7 +284,7 @@ public class CmdFactionsRank extends FactionsCommand endFaction.setInvited(target, false); // Create recipients - Set recipients = new HashSet(); + Set recipients = new HashSet<>(); recipients.addAll(targetFaction.getMPlayersWhereOnline(true)); recipients.addAll(endFaction.getMPlayersWhereOnline(true)); recipients.add(msender); @@ -369,7 +369,7 @@ public class CmdFactionsRank extends FactionsCommand } // Create recipients - Set recipients = new HashSet(); + Set recipients = new HashSet<>(); recipients.addAll(targetFaction.getMPlayers()); recipients.add(msender); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRelationList.java b/src/com/massivecraft/factions/cmd/CmdFactionsRelationList.java index 8b9f6a6c..cdb77864 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRelationList.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRelationList.java @@ -26,7 +26,7 @@ public class CmdFactionsRelationList extends FactionsCommand // COSTANTS // -------------------------------------------- // - public static final Set RELEVANT_RELATIONS = new MassiveSet(Rel.ENEMY, Rel.TRUCE, Rel.ALLY); + public static final Set RELEVANT_RELATIONS = new MassiveSet<>(Rel.ENEMY, Rel.TRUCE, Rel.ALLY); public static final String SEPERATOR = Txt.parse(": "); // -------------------------------------------- // @@ -54,7 +54,7 @@ public class CmdFactionsRelationList extends FactionsCommand final Set relations = this.readArg(RELEVANT_RELATIONS); // Pager Create - final Pager pager = new Pager(this, "", page, new Stringifier() + final Pager pager = new Pager<>(this, "", page, new Stringifier() { @Override public String toString(String item, int index) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRelationSet.java b/src/com/massivecraft/factions/cmd/CmdFactionsRelationSet.java index 8ffa35a1..2a02d6f8 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRelationSet.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRelationSet.java @@ -83,7 +83,7 @@ public class CmdFactionsRelationSet extends FactionsCommand } // TODO: The ally case should work!! - // * this might have to be bumped up to make that happen, & allow ALLY,NEUTRAL only + // this might have to be bumped up to make that happen, & allow ALLY,NEUTRAL only if (newRelation != Rel.TRUCE && otherFaction.getFlag(MFlag.getFlagPeaceful())) { otherFaction.msg("This will have no effect while your faction is peaceful."); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSetCircle.java b/src/com/massivecraft/factions/cmd/CmdFactionsSetCircle.java index 850895d0..7a48a04e 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSetCircle.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSetCircle.java @@ -43,7 +43,7 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius { // Common Startup final PS chunk = PS.valueOf(me.getLocation()).getChunk(true); - final Set chunks = new LinkedHashSet(); + final Set chunks = new LinkedHashSet<>(); chunks.add(chunk); // The center should come first for pretty messages diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSetFill.java b/src/com/massivecraft/factions/cmd/CmdFactionsSetFill.java index 8ccaa7db..58f14598 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSetFill.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSetFill.java @@ -46,7 +46,7 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple { // Common Startup final PS chunk = PS.valueOf(me.getLocation()).getChunk(true); - final Set chunks = new LinkedHashSet(); + final Set chunks = new LinkedHashSet<>(); // What faction (aka color) resides there? // NOTE: Wilderness/None is valid. @@ -81,7 +81,7 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple if (color == null) throw new NullPointerException("color"); // Expand - Set expansion = new LinkedHashSet(); + Set expansion = new LinkedHashSet<>(); for (PS chunk : set) { Set neighbours = MUtil.set( diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSetSquare.java b/src/com/massivecraft/factions/cmd/CmdFactionsSetSquare.java index 89afe9d4..76606525 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSetSquare.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSetSquare.java @@ -43,7 +43,7 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius { // Common Startup final PS chunk = PS.valueOf(me.getLocation()).getChunk(true); - final Set chunks = new LinkedHashSet(); + final Set chunks = new LinkedHashSet<>(); chunks.add(chunk); // The center should come first for pretty messages diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsStatus.java b/src/com/massivecraft/factions/cmd/CmdFactionsStatus.java index cbfc109c..b54d7866 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsStatus.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsStatus.java @@ -54,7 +54,8 @@ public class CmdFactionsStatus extends FactionsCommand // Pager Create String title = Txt.parse("Status of %s.", faction.describeTo(msender, true)); - final Pager pager = new Pager(this, title, page, mplayers, new Stringifier(){ + final Pager pager = new Pager<>(this, title, page, mplayers, new Stringifier() + { @Override public String toString(MPlayer mplayer, int index) { @@ -86,7 +87,7 @@ public class CmdFactionsStatus extends FactionsCommand { color = ""; } - + String power = Txt.parse("Power: %s%.0f/%.0f", Txt.parse(color), currentPower, maxPower); // Time diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java b/src/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java index 6e397a38..106f3678 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java @@ -122,7 +122,7 @@ public class CmdFactionsUnstuck extends FactionsCommand public static List getChunkSpiral(PS center) { // Create Ret - List ret = new ArrayList(); + List ret = new ArrayList<>(); // Fill Ret center = center.getChunk(true); diff --git a/src/com/massivecraft/factions/cmd/type/TypeFaction.java b/src/com/massivecraft/factions/cmd/type/TypeFaction.java index 1c2ba492..d1c96fd9 100644 --- a/src/com/massivecraft/factions/cmd/type/TypeFaction.java +++ b/src/com/massivecraft/factions/cmd/type/TypeFaction.java @@ -79,7 +79,7 @@ public class TypeFaction extends TypeAbstract public Collection getTabList(CommandSender sender, String arg) { // Create - Set ret = new TreeSet(ComparatorCaseInsensitive.get()); + Set ret = new TreeSet<>(ComparatorCaseInsensitive.get()); // Fill for (Faction faction : FactionColl.get().getAll()) diff --git a/src/com/massivecraft/factions/cmd/type/TypeRank.java b/src/com/massivecraft/factions/cmd/type/TypeRank.java index ed8bd5c1..3885ae2a 100644 --- a/src/com/massivecraft/factions/cmd/type/TypeRank.java +++ b/src/com/massivecraft/factions/cmd/type/TypeRank.java @@ -18,14 +18,14 @@ public class TypeRank extends TypeEnum // CONSTANTS // -------------------------------------------- // - public static final Set NAMES_PROMOTE = new MassiveSet( + public static final Set NAMES_PROMOTE = new MassiveSet<>( "Promote", "+", "Plus", "Up" ); - public static final Set NAMES_DEMOTE = new MassiveSet( + public static final Set NAMES_DEMOTE = new MassiveSet<>( "Demote", "-", "Minus", @@ -101,7 +101,7 @@ public class TypeRank extends TypeEnum public Set getNamesInner(Rel value) { // Create - Set ret = new MassiveSet(); + Set ret = new MassiveSet<>(); // Fill Exact ret.addAll(value.getNames()); diff --git a/src/com/massivecraft/factions/engine/DisallowCause.java b/src/com/massivecraft/factions/engine/DisallowCause.java index ae0dfbc3..c585547e 100644 --- a/src/com/massivecraft/factions/engine/DisallowCause.java +++ b/src/com/massivecraft/factions/engine/DisallowCause.java @@ -12,6 +12,5 @@ public enum DisallowCause OWN_TERRITORY // END OF LIST - ; } diff --git a/src/com/massivecraft/factions/engine/EngineEcon.java b/src/com/massivecraft/factions/engine/EngineEcon.java index 0ce87d40..081a39fb 100644 --- a/src/com/massivecraft/factions/engine/EngineEcon.java +++ b/src/com/massivecraft/factions/engine/EngineEcon.java @@ -118,7 +118,7 @@ public class EngineEcon extends Engine public void payForAction(EventFactionsChunksChange event) { double cost = 0; - List typeNames = new ArrayList(); + List typeNames = new ArrayList<>(); for (Entry> typeChunks : event.getTypeChunks().entrySet()) { diff --git a/src/com/massivecraft/factions/engine/EngineExploit.java b/src/com/massivecraft/factions/engine/EngineExploit.java index 3edc370c..5dc683ea 100644 --- a/src/com/massivecraft/factions/engine/EngineExploit.java +++ b/src/com/massivecraft/factions/engine/EngineExploit.java @@ -114,7 +114,7 @@ public class EngineExploit extends Engine if (!center.isLiquid()) return; // a single surrounding block in all 6 directions is broken if the material is weak enough - List targets = new ArrayList(); + List targets = new ArrayList<>(); targets.add(center.getRelative(0, 0, 1)); targets.add(center.getRelative(0, 0, -1)); targets.add(center.getRelative(0, 1, 0)); @@ -141,7 +141,7 @@ public class EngineExploit extends Engine private static final int NETHER_TRAP_RADIUS_CHECK = 5; private static final int NETHER_TRAP_RESET_RADIUS_SQUARED = 9; - private HashMap> portalTraps = new HashMap>(); + private HashMap> portalTraps = new HashMap<>(); @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void portalTrapRemoveAnimation(PlayerTeleportEvent event) diff --git a/src/com/massivecraft/factions/engine/EngineFlagExplosion.java b/src/com/massivecraft/factions/engine/EngineFlagExplosion.java index 2072cb4e..1c684a18 100644 --- a/src/com/massivecraft/factions/engine/EngineFlagExplosion.java +++ b/src/com/massivecraft/factions/engine/EngineFlagExplosion.java @@ -79,7 +79,7 @@ public class EngineFlagExplosion extends Engine // Current allowed Boolean allowed = true; // Caching to speed things up. - Map faction2allowed = new HashMap(); + Map faction2allowed = new HashMap<>(); // If an explosion occurs at a location ... Location location = event.getLocation(); diff --git a/src/com/massivecraft/factions/engine/EngineSeeChunk.java b/src/com/massivecraft/factions/engine/EngineSeeChunk.java index cfe107c3..e505be30 100644 --- a/src/com/massivecraft/factions/engine/EngineSeeChunk.java +++ b/src/com/massivecraft/factions/engine/EngineSeeChunk.java @@ -112,7 +112,7 @@ public class EngineSeeChunk extends Engine if (step >= steps) throw new InvalidParameterException("step must be less than steps"); // Create Ret - List ret = new ArrayList(); + List ret = new ArrayList<>(); final Location location = player.getLocation(); final World world = location.getWorld(); diff --git a/src/com/massivecraft/factions/engine/EngineShow.java b/src/com/massivecraft/factions/engine/EngineShow.java index 512c8e12..384abc21 100644 --- a/src/com/massivecraft/factions/engine/EngineShow.java +++ b/src/com/massivecraft/factions/engine/EngineShow.java @@ -72,7 +72,7 @@ public class EngineShow extends Engine // FLAGS // We display all editable and non default ones. The rest we skip. - List flagDescs = new LinkedList(); + List flagDescs = new LinkedList<>(); for (Entry entry : faction.getFlags().entrySet()) { final MFlag mflag = entry.getKey(); @@ -103,7 +103,7 @@ public class EngineShow extends Engine if (Econ.isEnabled()) { // LANDVALUES - List landvalueLines = new LinkedList(); + List landvalueLines = new LinkedList<>(); long landCount = faction.getLandCount(); for (EventFactionsChunkChangeType type : EventFactionsChunkChangeType.values()) { @@ -137,10 +137,10 @@ public class EngineShow extends Engine } // FOLLOWERS - List followerLines = new ArrayList(); + List followerLines = new ArrayList<>(); - List followerNamesOnline = new ArrayList(); - List followerNamesOffline = new ArrayList(); + List followerNamesOnline = new ArrayList<>(); + List followerNamesOffline = new ArrayList<>(); List followers = faction.getMPlayers(); Collections.sort(followers, PlayerRoleComparator.get()); @@ -201,7 +201,7 @@ public class EngineShow extends Engine public static List table(List strings, int cols) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); StringBuilder row = new StringBuilder(); int count = 0; diff --git a/src/com/massivecraft/factions/entity/Board.java b/src/com/massivecraft/factions/entity/Board.java index 144e8493..727527c2 100644 --- a/src/com/massivecraft/factions/entity/Board.java +++ b/src/com/massivecraft/factions/entity/Board.java @@ -72,12 +72,12 @@ public class Board extends Entity implements BoardInterface public Board() { - this.map = new ConcurrentSkipListMap(); + this.map = new ConcurrentSkipListMap<>(); } public Board(Map map) { - this.map = new ConcurrentSkipListMap(map); + this.map = new ConcurrentSkipListMap<>(map); } // -------------------------------------------- // @@ -186,7 +186,7 @@ public class Board extends Entity implements BoardInterface @Override public Set getChunks(String factionId) { - Set ret = new HashSet(); + Set ret = new HashSet<>(); for (Entry entry : this.map.entrySet()) { TerritoryAccess ta = entry.getValue(); @@ -202,7 +202,7 @@ public class Board extends Entity implements BoardInterface @Override public Map> getFactionToChunks() { - Map> ret = new MassiveMap>(); + Map> ret = new MassiveMap<>(); for (Entry entry : this.map.entrySet()) { @@ -215,7 +215,7 @@ public class Board extends Entity implements BoardInterface Set chunks = ret.get(faction); if (chunks == null) { - chunks = new MassiveSet(); + chunks = new MassiveSet<>(); ret.put(faction, chunks); } @@ -251,7 +251,7 @@ public class Board extends Entity implements BoardInterface @Override public Map getFactionToCount() { - Map ret = new MassiveMap(); + Map ret = new MassiveMap<>(); for (Entry entry : this.map.entrySet()) { @@ -388,7 +388,7 @@ public class Board extends Entity implements BoardInterface // Make room for the list of names height--; - Map fList = new HashMap(); + Map fList = new HashMap<>(); int chrIdx = 0; boolean overflown = false; diff --git a/src/com/massivecraft/factions/entity/BoardColl.java b/src/com/massivecraft/factions/entity/BoardColl.java index 350565c1..8e1f3e20 100644 --- a/src/com/massivecraft/factions/entity/BoardColl.java +++ b/src/com/massivecraft/factions/entity/BoardColl.java @@ -132,7 +132,7 @@ public class BoardColl extends Coll implements BoardInterface public Set getChunks(Faction faction) { // Create - Set ret = new HashSet(); + Set ret = new HashSet<>(); // Fill for (Board board : this.getAll()) @@ -148,7 +148,7 @@ public class BoardColl extends Coll implements BoardInterface public Set getChunks(String factionId) { // Create - Set ret = new HashSet(); + Set ret = new HashSet<>(); // Fill for (Board board : this.getAll()) @@ -194,7 +194,7 @@ public class BoardColl extends Coll implements BoardInterface } // Enforce create - if (ret == null) ret = new MassiveMap>(); + if (ret == null) ret = new MassiveMap<>(); // Return return ret; @@ -249,7 +249,7 @@ public class BoardColl extends Coll implements BoardInterface } } - if (ret == null) ret = new MassiveMap(); + if (ret == null) ret = new MassiveMap<>(); return ret; } @@ -360,7 +360,7 @@ public class BoardColl extends Coll implements BoardInterface psChunk = psChunk.getChunk(true); // Create - Set ret = new LinkedHashSet(); + Set ret = new LinkedHashSet<>(); if (distance < 0) return ret; // Fill @@ -391,7 +391,7 @@ public class BoardColl extends Coll implements BoardInterface if (chunks == null) throw new NullPointerException("chunks"); // Create - Set ret = new LinkedHashSet(); + Set ret = new LinkedHashSet<>(); if (distance < 0) return ret; @@ -411,7 +411,7 @@ public class BoardColl extends Coll implements BoardInterface if (chunks == null) throw new NullPointerException("chunks"); // Create - Set ret = new LinkedHashSet(); + Set ret = new LinkedHashSet<>(); // Fill for (PS chunk : chunks) @@ -428,7 +428,7 @@ public class BoardColl extends Coll implements BoardInterface public static Map getChunkFaction(Collection chunks) { // Create - Map ret = new LinkedHashMap(); + Map ret = new LinkedHashMap<>(); // Fill Faction none = FactionColl.get().getNone(); diff --git a/src/com/massivecraft/factions/entity/BoardInterface.java b/src/com/massivecraft/factions/entity/BoardInterface.java index 4d96a014..1a158089 100644 --- a/src/com/massivecraft/factions/entity/BoardInterface.java +++ b/src/com/massivecraft/factions/entity/BoardInterface.java @@ -11,40 +11,40 @@ import java.util.Set; public interface BoardInterface { // GET - public TerritoryAccess getTerritoryAccessAt(PS ps); - public Faction getFactionAt(PS ps); + TerritoryAccess getTerritoryAccessAt(PS ps); + Faction getFactionAt(PS ps); // SET - public void setTerritoryAccessAt(PS ps, TerritoryAccess territoryAccess); - public void setFactionAt(PS ps, Faction faction); + void setTerritoryAccessAt(PS ps, TerritoryAccess territoryAccess); + void setFactionAt(PS ps, Faction faction); // REMOVE - public void removeAt(PS ps); - public void removeAll(Faction faction); - public void clean(); + void removeAt(PS ps); + void removeAll(Faction faction); + void clean(); // CHUNKS - public Set getChunks(Faction faction); - public Set getChunks(String factionId); - public Map> getFactionToChunks(); + Set getChunks(Faction faction); + Set getChunks(String factionId); + Map> getFactionToChunks(); // COUNT - public int getCount(Faction faction); - public int getCount(String factionId); - public Map getFactionToCount(); + int getCount(Faction faction); + int getCount(String factionId); + Map getFactionToCount(); // CLAIMED - public boolean hasClaimed(Faction faction); - public boolean hasClaimed(String factionId); + boolean hasClaimed(Faction faction); + boolean hasClaimed(String factionId); // NEARBY DETECTION - public boolean isBorderPs(PS ps); - public boolean isAnyBorderPs(Set pss); - public boolean isConnectedPs(PS ps, Faction faction); - public boolean isAnyConnectedPs(Set pss, Faction faction); + boolean isBorderPs(PS ps); + boolean isAnyBorderPs(Set pss); + boolean isConnectedPs(PS ps, Faction faction); + boolean isAnyConnectedPs(Set pss, Faction faction); // MAP // TODO: Could the degrees be embedded in centerPs yaw instead? - public List getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height); + List getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height); } diff --git a/src/com/massivecraft/factions/entity/Faction.java b/src/com/massivecraft/factions/entity/Faction.java index b0241d5f..dae18c5c 100644 --- a/src/com/massivecraft/factions/entity/Faction.java +++ b/src/com/massivecraft/factions/entity/Faction.java @@ -140,19 +140,19 @@ public class Faction extends Entity implements FactionsParticipator // This is the ids of the invited players. // They are actually "senderIds" since you can invite "@console" to your faction. // Null means no one is invited - private MassiveTreeSetDef invitedPlayerIds = new MassiveTreeSetDef(ComparatorCaseInsensitive.get()); + private MassiveTreeSetDef invitedPlayerIds = new MassiveTreeSetDef<>(ComparatorCaseInsensitive.get()); // The keys in this map are factionIds. // Null means no special relation whishes. - private MassiveMapDef relationWishes = new MassiveMapDef(); + private MassiveMapDef relationWishes = new MassiveMapDef<>(); // The flag overrides are modifications to the default values. // Null means default. - private MassiveMapDef flags = new MassiveMapDef(); + private MassiveMapDef flags = new MassiveMapDef<>(); // The perm overrides are modifications to the default values. // Null means default. - private MassiveMapDef> perms = new MassiveMapDef>(); + private MassiveMapDef> perms = new MassiveMapDef<>(); // -------------------------------------------- // // FIELD: id @@ -465,7 +465,7 @@ public class Faction extends Entity implements FactionsParticipator public void setInvitedPlayerIds(Collection invitedPlayerIds) { // Clean input - MassiveTreeSetDef target = new MassiveTreeSetDef(ComparatorCaseInsensitive.get()); + MassiveTreeSetDef target = new MassiveTreeSetDef<>(ComparatorCaseInsensitive.get()); if (invitedPlayerIds != null) { for (String invitedPlayerId : invitedPlayerIds) @@ -498,7 +498,7 @@ public class Faction extends Entity implements FactionsParticipator public boolean setInvited(String playerId, boolean invited) { - List invitedPlayerIds = new ArrayList(this.getInvitedPlayerIds()); + List invitedPlayerIds = new ArrayList<>(this.getInvitedPlayerIds()); boolean ret; if (invited) { @@ -520,7 +520,7 @@ public class Faction extends Entity implements FactionsParticipator public List getInvitedMPlayers() { - List mplayers = new ArrayList(); + List mplayers = new ArrayList<>(); for (String id : this.getInvitedPlayerIds()) { @@ -544,7 +544,7 @@ public class Faction extends Entity implements FactionsParticipator public void setRelationWishes(Map relationWishes) { // Clean input - MassiveMapDef target = new MassiveMapDef(relationWishes); + MassiveMapDef target = new MassiveMapDef<>(relationWishes); // Detect Nochange if (MUtil.equals(this.relationWishes, target)) return; @@ -598,7 +598,7 @@ public class Faction extends Entity implements FactionsParticipator public Map getFlags() { // We start with default values ... - Map ret = new LinkedHashMap(); + Map ret = new LinkedHashMap<>(); for (MFlag mflag : MFlag.getAll()) { ret.put(mflag, mflag.isStandard()); @@ -632,7 +632,7 @@ public class Faction extends Entity implements FactionsParticipator public void setFlags(Map flags) { - Map flagIds = new LinkedHashMap(); + Map flagIds = new LinkedHashMap<>(); for (Entry entry : flags.entrySet()) { flagIds.put(entry.getKey().getId(), entry.getValue()); @@ -643,7 +643,7 @@ public class Faction extends Entity implements FactionsParticipator public void setFlagIds(Map flagIds) { // Clean input - MassiveMapDef target = new MassiveMapDef(); + MassiveMapDef target = new MassiveMapDef<>(); for (Entry entry : flagIds.entrySet()) { String key = entry.getKey(); @@ -660,7 +660,7 @@ public class Faction extends Entity implements FactionsParticipator if (MUtil.equals(this.flags, target)) return; // Apply - this.flags = new MassiveMapDef(target); + this.flags = new MassiveMapDef<>(target); // Mark as changed this.changed(); @@ -724,10 +724,10 @@ public class Faction extends Entity implements FactionsParticipator public Map> getPerms() { // We start with default values ... - Map> ret = new LinkedHashMap>(); + Map> ret = new LinkedHashMap<>(); for (MPerm mperm : MPerm.getAll()) { - ret.put(mperm, new LinkedHashSet(mperm.getStandard())); + ret.put(mperm, new LinkedHashSet<>(mperm.getStandard())); } // ... and if anything is explicitly set we use that info ... @@ -749,7 +749,7 @@ public class Faction extends Entity implements FactionsParticipator MPerm mperm = MPerm.get(id); if (mperm == null) continue; - ret.put(mperm, new LinkedHashSet(entry.getValue())); + ret.put(mperm, new LinkedHashSet<>(entry.getValue())); } return ret; @@ -757,7 +757,7 @@ public class Faction extends Entity implements FactionsParticipator public void setPerms(Map> perms) { - Map> permIds = new LinkedHashMap>(); + Map> permIds = new LinkedHashMap<>(); for (Entry> entry : perms.entrySet()) { permIds.put(entry.getKey().getId(), entry.getValue()); @@ -768,7 +768,7 @@ public class Faction extends Entity implements FactionsParticipator public void setPermIds(Map> perms) { // Clean input - MassiveMapDef> target = new MassiveMapDef>(); + MassiveMapDef> target = new MassiveMapDef<>(); for (Entry> entry : perms.entrySet()) { String key = entry.getKey(); @@ -866,7 +866,7 @@ public class Faction extends Entity implements FactionsParticipator public void setPermittedRelations(MPerm perm, Rel... rels) { - Set temp = new HashSet(); + Set temp = new HashSet<>(); temp.addAll(Arrays.asList(rels)); this.setPermittedRelations(perm, temp); } @@ -1008,7 +1008,7 @@ public class Faction extends Entity implements FactionsParticipator // FOREIGN KEY: MPLAYER // -------------------------------------------- // - protected transient Set mplayers = new MassiveSet(); + protected transient Set mplayers = new MassiveSet<>(); public void reindexMPlayers() { @@ -1045,7 +1045,7 @@ public class Faction extends Entity implements FactionsParticipator public List getMPlayers() { this.checkMPlayerIndex(); - return new ArrayList(this.mplayers); + return new ArrayList<>(this.mplayers); } public List getMPlayersWhere(Predicate predicate) @@ -1083,7 +1083,7 @@ public class Faction extends Entity implements FactionsParticipator public List getOnlineCommandSenders() { // Create Ret - List ret = new ArrayList(); + List ret = new ArrayList<>(); // Fill Ret for (CommandSender sender : IdUtil.getLocalSenders()) @@ -1103,7 +1103,7 @@ public class Faction extends Entity implements FactionsParticipator public List getOnlinePlayers() { // Create Ret - List ret = new ArrayList(); + List ret = new ArrayList<>(); // Fill Ret for (Player player : MUtil.getOnlinePlayers()) diff --git a/src/com/massivecraft/factions/entity/FactionColl.java b/src/com/massivecraft/factions/entity/FactionColl.java index ebd2ed94..7d330f7e 100644 --- a/src/com/massivecraft/factions/entity/FactionColl.java +++ b/src/com/massivecraft/factions/entity/FactionColl.java @@ -246,7 +246,7 @@ public class FactionColl extends Coll public ArrayList validateName(String str) { // Create - ArrayList errors = new ArrayList(); + ArrayList errors = new ArrayList<>(); // Fill // Check minimum length @@ -295,7 +295,7 @@ public class FactionColl extends Coll public Map> getRelationNames(Faction faction, Set rels) { // Create - Map> ret = new LinkedHashMap>(); + Map> ret = new LinkedHashMap<>(); MFlag flagPeaceful = MFlag.getFlagPeaceful(); boolean peaceful = faction.getFlag(flagPeaceful); for (Rel rel : rels) diff --git a/src/com/massivecraft/factions/entity/MConf.java b/src/com/massivecraft/factions/entity/MConf.java index a2a7e2f2..cd0b1c90 100644 --- a/src/com/massivecraft/factions/entity/MConf.java +++ b/src/com/massivecraft/factions/entity/MConf.java @@ -79,7 +79,7 @@ public class MConf extends Entity // Add player names here who should bypass all protections. // Should /not/ be used for admins. There is "/f adminmode" for that. // This is for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections. - public Set playersWhoBypassAllProtection = new LinkedHashSet(); + public Set playersWhoBypassAllProtection = new LinkedHashSet<>(); // -------------------------------------------- // // TASKS @@ -337,7 +337,7 @@ public class MConf extends Entity // A list of commands to block for members of permanent factions. // I don't really understand the user case for this option. - public List denyCommandsPermanentFactionMember = new ArrayList(); + public List denyCommandsPermanentFactionMember = new ArrayList<>(); // Lists of commands to deny depending on your relation to the current faction territory. // You may for example not type /home (might be the plugin Essentials) in the territory of your enemies. @@ -537,7 +537,7 @@ public class MConf extends Entity // This way they can be protected in Faction territory. // Interacting with these materials when they are already placed in the terrain results in an edit. - public BackstringSet materialsEditOnInteract = new BackstringSet(Material.class, + public BackstringSet materialsEditOnInteract = new BackstringSet<>(Material.class, "DIODE_BLOCK_OFF", // Minecraft 1.? "DIODE_BLOCK_ON", // Minecraft 1.? "NOTE_BLOCK", // Minecraft 1.? @@ -551,7 +551,7 @@ public class MConf extends Entity // Interacting with the the terrain holding this item in hand results in an edit. // There's no need to add all block materials here. Only special items other than blocks. - public BackstringSet materialsEditTools = new BackstringSet(Material.class, + public BackstringSet materialsEditTools = new BackstringSet<>(Material.class, "FIREBALL", // Minecraft 1.? "FLINT_AND_STEEL", // Minecraft 1.? "BUCKET", // Minecraft 1.? @@ -563,7 +563,7 @@ public class MConf extends Entity // The duplication bug found in Spigot 1.8 protocol patch // https://github.com/MassiveCraft/Factions/issues/693 - public BackstringSet materialsEditToolsDupeBug = new BackstringSet(Material.class, + public BackstringSet materialsEditToolsDupeBug = new BackstringSet<>(Material.class, "CHEST", // Minecraft 1.? "SIGN_POST", // Minecraft 1.? "TRAPPED_CHEST", // Minecraft 1.? @@ -573,7 +573,7 @@ public class MConf extends Entity ); // Interacting with these materials placed in the terrain results in door toggling. - public BackstringSet materialsDoor = new BackstringSet(Material.class, + public BackstringSet materialsDoor = new BackstringSet<>(Material.class, "WOODEN_DOOR", // Minecraft 1.? "ACACIA_DOOR", // Minecraft 1.8 "BIRCH_DOOR", // Minecraft 1.8 @@ -590,7 +590,7 @@ public class MConf extends Entity ); // Interacting with these materials placed in the terrain results in opening a container. - public BackstringSet materialsContainer = new BackstringSet(Material.class, + public BackstringSet materialsContainer = new BackstringSet<>(Material.class, "DISPENSER", // Minecraft 1.? "CHEST", // Minecraft 1.? "FURNACE", // Minecraft 1.? @@ -624,26 +624,26 @@ public class MConf extends Entity ); // Interacting with these entities results in an edit. - public BackstringSet entityTypesEditOnInteract = new BackstringSet(EntityType.class, + public BackstringSet entityTypesEditOnInteract = new BackstringSet<>(EntityType.class, "ITEM_FRAME", // Minecraft 1.? "ARMOR_STAND" // Minecraft 1.8 ); // Damaging these entities results in an edit. - public BackstringSet entityTypesEditOnDamage = new BackstringSet(EntityType.class, + public BackstringSet entityTypesEditOnDamage = new BackstringSet<>(EntityType.class, "ITEM_FRAME", // Minecraft 1.? "ARMOR_STAND", // Minecraft 1.8 "ENDER_CRYSTAL" // Minecraft 1.10 ); // Interacting with these entities results in opening a container. - public BackstringSet entityTypesContainer = new BackstringSet(EntityType.class, + public BackstringSet entityTypesContainer = new BackstringSet<>(EntityType.class, "MINECART_CHEST", // Minecraft 1.? "MINECART_HOPPER" // Minecraft 1.? ); // The complete list of entities considered to be monsters. - public BackstringSet entityTypesMonsters = new BackstringSet(EntityType.class, + public BackstringSet entityTypesMonsters = new BackstringSet<>(EntityType.class, "BLAZE", // Minecraft 1.? "CAVE_SPIDER", // Minecraft 1.? "CREEPER", // Minecraft 1.? @@ -675,7 +675,7 @@ public class MConf extends Entity ); // List of entities considered to be animals. - public BackstringSet entityTypesAnimals = new BackstringSet(EntityType.class, + public BackstringSet entityTypesAnimals = new BackstringSet<>(EntityType.class, "BAT", // Minecraft 1.? "CHICKEN", // Minecraft 1.? "COW", // Minecraft 1.? @@ -714,7 +714,7 @@ public class MConf extends Entity public boolean herochatFactionIsShortcutAllowed = false; public boolean herochatFactionCrossWorld = true; public boolean herochatFactionMuted = false; - public Set herochatFactionWorlds = new HashSet(); + public Set herochatFactionWorlds = new HashSet<>(); // The Allies Channel public String herochatAlliesName = "Allies"; @@ -725,7 +725,7 @@ public class MConf extends Entity public boolean herochatAlliesIsShortcutAllowed = false; public boolean herochatAlliesCrossWorld = true; public boolean herochatAlliesMuted = false; - public Set herochatAlliesWorlds = new HashSet(); + public Set herochatAlliesWorlds = new HashSet<>(); // -------------------------------------------- // // INTEGRATION: LWC diff --git a/src/com/massivecraft/factions/entity/MFlagColl.java b/src/com/massivecraft/factions/entity/MFlagColl.java index 136c5b61..075454c5 100644 --- a/src/com/massivecraft/factions/entity/MFlagColl.java +++ b/src/com/massivecraft/factions/entity/MFlagColl.java @@ -47,7 +47,7 @@ public class MFlagColl extends Coll public List getAll(boolean registered) { // Create - List ret = new ArrayList(); + List ret = new ArrayList<>(); // Fill for (MFlag mflag : this.getAll()) diff --git a/src/com/massivecraft/factions/entity/MPerm.java b/src/com/massivecraft/factions/entity/MPerm.java index d606751a..72b2ebe2 100644 --- a/src/com/massivecraft/factions/entity/MPerm.java +++ b/src/com/massivecraft/factions/entity/MPerm.java @@ -231,7 +231,7 @@ public class MPerm extends Entity implements Prioritized, Registerable, N // What is the standard (aka default) perm value? // This value will be set for factions from the beginning. // Example: ... set of relations ... - private Set standard = new LinkedHashSet(); + private Set standard = new LinkedHashSet<>(); public Set getStandard() { return this.standard; } public MPerm setStandard(Set standard) { this.standard = standard; this.changed(); return this; } @@ -305,7 +305,7 @@ public class MPerm extends Entity implements Prioritized, Registerable, N public String getDesc(boolean withName, boolean withDesc) { - List parts = new ArrayList(); + List parts = new ArrayList<>(); if (withName) { diff --git a/src/com/massivecraft/factions/entity/MPermColl.java b/src/com/massivecraft/factions/entity/MPermColl.java index f1534b21..b092abd8 100644 --- a/src/com/massivecraft/factions/entity/MPermColl.java +++ b/src/com/massivecraft/factions/entity/MPermColl.java @@ -47,7 +47,7 @@ public class MPermColl extends Coll public List getAll(boolean registered) { // Create - List ret = new ArrayList(); + List ret = new ArrayList<>(); // Fill for (MPerm mperm : this.getAll()) diff --git a/src/com/massivecraft/factions/entity/MPlayer.java b/src/com/massivecraft/factions/entity/MPlayer.java index 138b7cd8..bb888ccc 100644 --- a/src/com/massivecraft/factions/entity/MPlayer.java +++ b/src/com/massivecraft/factions/entity/MPlayer.java @@ -925,7 +925,7 @@ public class MPlayer extends SenderEntity implements FactionsParticipat public static Set getClaimInformees(MPlayer msender, Faction... factions) { - Set ret = new HashSet(); + Set ret = new HashSet<>(); if (msender != null) ret.add(msender); diff --git a/src/com/massivecraft/factions/event/EventFactionsChunksChange.java b/src/com/massivecraft/factions/event/EventFactionsChunksChange.java index 9c790a95..425d2b75 100644 --- a/src/com/massivecraft/factions/event/EventFactionsChunksChange.java +++ b/src/com/massivecraft/factions/event/EventFactionsChunksChange.java @@ -62,7 +62,7 @@ public class EventFactionsChunksChange extends EventFactionsAbstractSender MPlayer msender = this.getMPlayer(); Faction self = null; if (msender != null) self = msender.getFaction(); - Map currentChunkType = new LinkedHashMap(); + Map currentChunkType = new LinkedHashMap<>(); for (Entry entry : this.oldChunkFaction.entrySet()) { PS chunk = entry.getKey(); diff --git a/src/com/massivecraft/factions/event/EventFactionsExpansions.java b/src/com/massivecraft/factions/event/EventFactionsExpansions.java index 644a6e84..33e28600 100644 --- a/src/com/massivecraft/factions/event/EventFactionsExpansions.java +++ b/src/com/massivecraft/factions/event/EventFactionsExpansions.java @@ -21,7 +21,7 @@ public class EventFactionsExpansions extends EventFactionsAbstractSender // FIELDS // -------------------------------------------- // - private final MassiveTreeMap expansions = new MassiveTreeMap(ComparatorCaseInsensitive.get()); + private final MassiveTreeMap expansions = new MassiveTreeMap<>(ComparatorCaseInsensitive.get()); public Map getExpansions() { return this.expansions; } // -------------------------------------------- // diff --git a/src/com/massivecraft/factions/event/EventFactionsFactionShowAsync.java b/src/com/massivecraft/factions/event/EventFactionsFactionShowAsync.java index 86336051..07859baa 100644 --- a/src/com/massivecraft/factions/event/EventFactionsFactionShowAsync.java +++ b/src/com/massivecraft/factions/event/EventFactionsFactionShowAsync.java @@ -36,7 +36,7 @@ public class EventFactionsFactionShowAsync extends EventFactionsAbstractSender { super(true, sender); this.faction = faction; - this.idPriorityLiness = new HashMap(); + this.idPriorityLiness = new HashMap<>(); } } diff --git a/src/com/massivecraft/factions/event/EventFactionsMembershipChange.java b/src/com/massivecraft/factions/event/EventFactionsMembershipChange.java index 4ab88f62..6b4b9d28 100644 --- a/src/com/massivecraft/factions/event/EventFactionsMembershipChange.java +++ b/src/com/massivecraft/factions/event/EventFactionsMembershipChange.java @@ -72,7 +72,7 @@ public class EventFactionsMembershipChange extends EventFactionsAbstractSender private final boolean cancellable; public boolean isCancellable() { return this.cancellable; } - private MembershipChangeReason(boolean cancellable) + MembershipChangeReason(boolean cancellable) { this.cancellable = cancellable; } diff --git a/src/com/massivecraft/factions/event/EventFactionsRemovePlayerMillis.java b/src/com/massivecraft/factions/event/EventFactionsRemovePlayerMillis.java index 765e386d..1d04dbd2 100644 --- a/src/com/massivecraft/factions/event/EventFactionsRemovePlayerMillis.java +++ b/src/com/massivecraft/factions/event/EventFactionsRemovePlayerMillis.java @@ -31,7 +31,7 @@ public class EventFactionsRemovePlayerMillis extends EventMassiveCore public long getMillis() { return this.millis; } public void setMillis(long millis) { this.millis = millis; } - private Map causeMillis = new LinkedHashMap(); + private Map causeMillis = new LinkedHashMap<>(); public Map getCauseMillis() { return this.causeMillis; } // -------------------------------------------- // diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 680accdb..b388c6a6 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -160,7 +160,7 @@ public class Econ public static Set getMPlayers(EconomyParticipator ep) { - Set mplayers = new HashSet(); + Set mplayers = new HashSet<>(); if (ep == null) { @@ -180,7 +180,7 @@ public class Econ public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount) { - Set recipients = new HashSet(); + Set recipients = new HashSet<>(); recipients.addAll(getMPlayers(invoker)); recipients.addAll(getMPlayers(from)); recipients.addAll(getMPlayers(to)); diff --git a/src/com/massivecraft/factions/integration/V19/EngineV19.java b/src/com/massivecraft/factions/integration/V19/EngineV19.java index 82019e18..23d27067 100644 --- a/src/com/massivecraft/factions/integration/V19/EngineV19.java +++ b/src/com/massivecraft/factions/integration/V19/EngineV19.java @@ -49,7 +49,7 @@ public class EngineV19 extends Engine Entity thrower = (Entity)projectileSource; // ... create a dummy list to avoid ConcurrentModificationException ... - List affectedList = new ArrayList(); + List affectedList = new ArrayList<>(); // ... then scan through affected entities to make sure they're all valid targets ... for (LivingEntity affectedEntity : event.getAffectedEntities()) diff --git a/src/com/massivecraft/factions/integration/herochat/ChannelFactionsAbstract.java b/src/com/massivecraft/factions/integration/herochat/ChannelFactionsAbstract.java index aac58709..41d5780d 100644 --- a/src/com/massivecraft/factions/integration/herochat/ChannelFactionsAbstract.java +++ b/src/com/massivecraft/factions/integration/herochat/ChannelFactionsAbstract.java @@ -97,7 +97,7 @@ public abstract class ChannelFactionsAbstract implements Channel @Override public Set getMembers() { - Set ret = new HashSet(); + Set ret = new HashSet<>(); for (Chatter chatter : Herochat.getChatterManager().getChatters()) { if(chatter.hasChannel(this)) ret.add(chatter); @@ -200,7 +200,7 @@ public abstract class ChannelFactionsAbstract implements Channel { message = this.applyFormat(this.getFormatSupplier().getEmoteFormat(), "").replace("%2$s", message); - Set recipients = new HashSet(); + Set recipients = new HashSet<>(); for (Chatter member : this.getMembers()) { recipients.add(member.getPlayer()); @@ -225,7 +225,7 @@ public abstract class ChannelFactionsAbstract implements Channel public Set getRecipients(Player sender) { - Set ret = new HashSet(); + Set ret = new HashSet<>(); MPlayer fsender = MPlayer.get(sender); Faction faction = fsender.getFaction(); diff --git a/src/com/massivecraft/factions/integration/herochat/ChannelFactionsFaction.java b/src/com/massivecraft/factions/integration/herochat/ChannelFactionsFaction.java index afcf613b..ce2d002e 100644 --- a/src/com/massivecraft/factions/integration/herochat/ChannelFactionsFaction.java +++ b/src/com/massivecraft/factions/integration/herochat/ChannelFactionsFaction.java @@ -28,7 +28,7 @@ public class ChannelFactionsFaction extends ChannelFactionsAbstract @Override public void setDistance(int distance) { MConf.get().herochatFactionDistance = distance; } @Override public void addWorld(String world) { MConf.get().herochatFactionWorlds.add(world); } - @Override public Set getWorlds() { return new HashSet(MConf.get().herochatFactionWorlds); } + @Override public Set getWorlds() { return new HashSet<>(MConf.get().herochatFactionWorlds); } @Override public void setWorlds(Set worlds) { MConf.get().herochatFactionWorlds = worlds; } @Override public boolean isShortcutAllowed() { return MConf.get().herochatFactionIsShortcutAllowed; } diff --git a/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java b/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java index dfd9dc88..603f4e28 100644 --- a/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java +++ b/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java @@ -128,7 +128,7 @@ public class EngineWorldGuard extends Engine ProtectedCuboidRegion region = new ProtectedCuboidRegion(regionName, minChunk, maxChunk); Map regionMap = regionManager.getRegions(); - List regionList = new ArrayList(regionMap.values()); + List regionList = new ArrayList<>(regionMap.values()); // Let's find what we've overlapped List overlapRegions = region.getIntersectingRegions(regionList); diff --git a/src/com/massivecraft/factions/update/UpdateUtil.java b/src/com/massivecraft/factions/update/UpdateUtil.java index 34cbd4d9..22a35622 100644 --- a/src/com/massivecraft/factions/update/UpdateUtil.java +++ b/src/com/massivecraft/factions/update/UpdateUtil.java @@ -113,7 +113,7 @@ public class UpdateUtil public static List getUniverses() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (String collname : MStore.getDb().getCollnames()) { @@ -232,7 +232,7 @@ public class UpdateUtil // Before and After Set before = entity.factionIds; if (before == null) return false; - Set after = new LinkedHashSet(); + Set after = new LinkedHashSet<>(); for (String id : before) { if (id == null) continue; diff --git a/src/com/massivecraft/factions/util/AsciiCompassDirection.java b/src/com/massivecraft/factions/util/AsciiCompassDirection.java index d4a5ada9..bc5df38b 100644 --- a/src/com/massivecraft/factions/util/AsciiCompassDirection.java +++ b/src/com/massivecraft/factions/util/AsciiCompassDirection.java @@ -79,7 +79,7 @@ public enum AsciiCompassDirection if (degrees < 0) degrees += 360; // Get ordinal - int ordinal = (int) Math.floor(degrees / 45);; + int ordinal = (int) Math.floor(degrees / 45); // Return return AsciiCompassDirection.values()[ordinal]; diff --git a/src/com/massivecraft/factions/util/MiscUtil.java b/src/com/massivecraft/factions/util/MiscUtil.java index f26ed40d..6b62f84f 100644 --- a/src/com/massivecraft/factions/util/MiscUtil.java +++ b/src/com/massivecraft/factions/util/MiscUtil.java @@ -24,11 +24,11 @@ public class MiscUtil return values; } - public static HashSet substanceChars = new HashSet(Arrays.asList(new String []{ - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", - "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", - "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", - "s", "t", "u", "v", "w", "x", "y", "z" + public static HashSet substanceChars = new HashSet<>(Arrays.asList(new String[]{ + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", + "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", + "s", "t", "u", "v", "w", "x", "y", "z" })); public static String getComparisonString(String str) diff --git a/src/com/massivecraft/factions/util/VisualizeUtil.java b/src/com/massivecraft/factions/util/VisualizeUtil.java index befc5f1f..1f998a2d 100644 --- a/src/com/massivecraft/factions/util/VisualizeUtil.java +++ b/src/com/massivecraft/factions/util/VisualizeUtil.java @@ -18,7 +18,7 @@ import java.util.UUID; public class VisualizeUtil { - protected static Map> playerLocations = new HashMap>(); + protected static Map> playerLocations = new HashMap<>(); public static Set getPlayerLocations(Player player) { return getPlayerLocations(player.getUniqueId()); @@ -28,7 +28,7 @@ public class VisualizeUtil Set ret = playerLocations.get(uuid); if (ret == null) { - ret = new HashSet(); + ret = new HashSet<>(); playerLocations.put(uuid, ret); } return ret;