IntelliJ Inspection Based Cleanup

This commit is contained in:
Olof Larsson 2017-03-24 14:03:29 +01:00
parent 60b4472735
commit bdbc1c79a2
53 changed files with 154 additions and 153 deletions

View File

@ -2,5 +2,5 @@ package com.massivecraft.factions;
public interface EconomyParticipator extends RelationParticipator public interface EconomyParticipator extends RelationParticipator
{ {
public boolean msg(String msg, Object... args); boolean msg(String msg, Object... args);
} }

View File

@ -2,6 +2,6 @@ package com.massivecraft.factions;
public interface PowerBoosted public interface PowerBoosted
{ {
public double getPowerBoost(); double getPowerBoost();
public void setPowerBoost(Double powerBoost); void setPowerBoost(Double powerBoost);
} }

View File

@ -90,7 +90,7 @@ public enum Rel implements Colorized, Named
this.descPlayerMany = descPlayerMany; this.descPlayerMany = descPlayerMany;
this.descFactionOne = descFactionOne; this.descFactionOne = descFactionOne;
this.descFactionMany = descFactionMany; this.descFactionMany = descFactionMany;
this.names = Collections.unmodifiableSet(new MassiveSet<String>(names)); this.names = Collections.unmodifiableSet(new MassiveSet<>(names));
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -5,11 +5,11 @@ import org.bukkit.ChatColor;
public interface RelationParticipator public interface RelationParticipator
{ {
public String describeTo(RelationParticipator observer); String describeTo(RelationParticipator observer);
public String describeTo(RelationParticipator observer, boolean ucfirst); String describeTo(RelationParticipator observer, boolean ucfirst);
public Rel getRelationTo(RelationParticipator observer); Rel getRelationTo(RelationParticipator observer);
public Rel getRelationTo(RelationParticipator observer, boolean ignorePeaceful); Rel getRelationTo(RelationParticipator observer, boolean ignorePeaceful);
public ChatColor getColorTo(RelationParticipator observer); ChatColor getColorTo(RelationParticipator observer);
} }

View File

@ -53,7 +53,7 @@ public class TerritoryAccess
return valueOf(hostFactionId, with, factionIds, playerIds); return valueOf(hostFactionId, with, factionIds, playerIds);
} }
Set<String> factionIds = new HashSet<String>(this.getFactionIds()); Set<String> factionIds = new HashSet<>(this.getFactionIds());
if (with) if (with)
{ {
factionIds.add(factionId); factionIds.add(factionId);
@ -68,7 +68,7 @@ public class TerritoryAccess
public TerritoryAccess withPlayerId(String playerId, boolean with) public TerritoryAccess withPlayerId(String playerId, boolean with)
{ {
playerId = playerId.toLowerCase(); playerId = playerId.toLowerCase();
Set<String> playerIds = new HashSet<String>(this.getPlayerIds()); Set<String> playerIds = new HashSet<>(this.getPlayerIds());
if (with) if (with)
{ {
playerIds.add(playerId); playerIds.add(playerId);
@ -102,7 +102,7 @@ public class TerritoryAccess
public LinkedHashSet<MPlayer> getGrantedMPlayers() public LinkedHashSet<MPlayer> getGrantedMPlayers()
{ {
LinkedHashSet<MPlayer> ret = new LinkedHashSet<MPlayer>(); LinkedHashSet<MPlayer> ret = new LinkedHashSet<>();
for (String playerId : this.getPlayerIds()) for (String playerId : this.getPlayerIds())
{ {
ret.add(MPlayer.get(playerId)); ret.add(MPlayer.get(playerId));
@ -112,7 +112,7 @@ public class TerritoryAccess
public LinkedHashSet<Faction> getGrantedFactions() public LinkedHashSet<Faction> getGrantedFactions()
{ {
LinkedHashSet<Faction> ret = new LinkedHashSet<Faction>(); LinkedHashSet<Faction> ret = new LinkedHashSet<>();
for (String factionId : this.getFactionIds()) for (String factionId : this.getFactionIds())
{ {
ret.add(FactionColl.get().get(factionId)); ret.add(FactionColl.get().get(factionId));
@ -129,7 +129,7 @@ public class TerritoryAccess
if (hostFactionId == null) throw new IllegalArgumentException("hostFactionId was null"); if (hostFactionId == null) throw new IllegalArgumentException("hostFactionId was null");
this.hostFactionId = hostFactionId; this.hostFactionId = hostFactionId;
Set<String> factionIdsInner = new TreeSet<String>(); Set<String> factionIdsInner = new TreeSet<>();
if (factionIds != null) if (factionIds != null)
{ {
factionIdsInner.addAll(factionIds); factionIdsInner.addAll(factionIds);
@ -140,7 +140,7 @@ public class TerritoryAccess
} }
this.factionIds = Collections.unmodifiableSet(factionIdsInner); this.factionIds = Collections.unmodifiableSet(factionIdsInner);
Set<String> playerIdsInner = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); Set<String> playerIdsInner = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
if (playerIds != null) if (playerIds != null)
{ {
for (String playerId : playerIds) for (String playerId : playerIds)

View File

@ -31,7 +31,7 @@ public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess
@Override @Override
public Map<PS, TerritoryAccess> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException public Map<PS, TerritoryAccess> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{ {
Map<PS, TerritoryAccess> ret = new ConcurrentSkipListMap<PS, TerritoryAccess>(); Map<PS, TerritoryAccess> ret = new ConcurrentSkipListMap<>();
JsonObject jsonObject = json.getAsJsonObject(); JsonObject jsonObject = json.getAsJsonObject();

View File

@ -55,7 +55,7 @@ public class ChatFormatter
String[] parts = submatch.split(ESC_SEPARATOR); String[] parts = submatch.split(ESC_SEPARATOR);
// The modifier ids are something like ["lp", "rp"] and tagId something like "sender" // The modifier ids are something like ["lp", "rp"] and tagId something like "sender"
List<String> modifierIds = new ArrayList<String>(Arrays.asList(parts)); List<String> modifierIds = new ArrayList<>(Arrays.asList(parts));
String tagId = modifierIds.remove(0); String tagId = modifierIds.remove(0);
// Fetch tag for the id // Fetch tag for the id

View File

@ -66,7 +66,7 @@ public abstract class CmdFactionsAccessAbstract extends FactionsCommand
public static String describeRelationParticipators(Collection<? extends RelationParticipator> relationParticipators, RelationParticipator observer) public static String describeRelationParticipators(Collection<? extends RelationParticipator> relationParticipators, RelationParticipator observer)
{ {
if (relationParticipators.size() == 0) return Txt.parse("<silver><em>none"); if (relationParticipators.size() == 0) return Txt.parse("<silver><em>none");
List<String> descriptions = new ArrayList<String>(); List<String> descriptions = new ArrayList<>();
for (RelationParticipator relationParticipator : relationParticipators) for (RelationParticipator relationParticipator : relationParticipators)
{ {
descriptions.add(relationParticipator.describeTo(observer)); descriptions.add(relationParticipator.describeTo(observer));

View File

@ -53,7 +53,7 @@ public class CmdFactionsFaction extends FactionsCommand
MixinMessage.get().messageOne(sender, Txt.titleize("Faction " + faction.getName(msender))); MixinMessage.get().messageOne(sender, Txt.titleize("Faction " + faction.getName(msender)));
// Lines // Lines
TreeSet<PriorityLines> priorityLiness = new TreeSet<PriorityLines>(event.getIdPriorityLiness().values()); TreeSet<PriorityLines> priorityLiness = new TreeSet<>(event.getIdPriorityLiness().values());
for (PriorityLines priorityLines : priorityLiness) for (PriorityLines priorityLines : priorityLiness)
{ {
MixinMessage.get().messageOne(sender, priorityLines.getLines()); MixinMessage.get().messageOne(sender, priorityLines.getLines());

View File

@ -46,7 +46,8 @@ public class CmdFactionsInviteList extends FactionsCommand
// Pager Create // Pager Create
final List<MPlayer> mplayers = faction.getInvitedMPlayers(); final List<MPlayer> mplayers = faction.getInvitedMPlayers();
final Pager<MPlayer> pager = new Pager<MPlayer>(this, "Invited Players List", page, mplayers, new Stringifier<MPlayer>(){ final Pager<MPlayer> pager = new Pager<>(this, "Invited Players List", page, mplayers, new Stringifier<MPlayer>()
{
public String toString(MPlayer target, int index) public String toString(MPlayer target, int index)
{ {
// TODO: Madus would like to implement this in MPlayer // TODO: Madus would like to implement this in MPlayer

View File

@ -33,7 +33,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
@Override @Override
public void perform() throws MassiveException public void perform() throws MassiveException
{ {
Set<MPlayer> mplayers = new HashSet<MPlayer>(); Set<MPlayer> mplayers = new HashSet<>();
boolean all = false; boolean all = false;
// Args // Args
@ -123,7 +123,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
// Inform Faction if all // Inform Faction if all
if (all) if (all)
{ {
List<String> names = new ArrayList<String>(); List<String> names = new ArrayList<>();
for (MPlayer mplayer : mplayers) for (MPlayer mplayer : mplayers)
{ {
names.add(mplayer.describeTo(msender, true)); names.add(mplayer.describeTo(msender, true));

View File

@ -45,7 +45,7 @@ public class CmdFactionsName extends FactionsCommand
return; return;
} }
ArrayList<String> errors = new ArrayList<String>(); ArrayList<String> errors = new ArrayList<>();
errors.addAll(FactionColl.get().validateName(newName)); errors.addAll(FactionColl.get().validateName(newName));
if (errors.size() > 0) if (errors.size() > 0)
{ {

View File

@ -31,7 +31,7 @@ public class CmdFactionsPermList extends FactionsCommand
int page = this.readArg(); int page = this.readArg();
// Create messages // Create messages
List<String> messages = new ArrayList<String>(); List<String> messages = new ArrayList<>();
for (MPerm perm : MPerm.getAll()) for (MPerm perm : MPerm.getAll())
{ {

View File

@ -284,7 +284,7 @@ public class CmdFactionsRank extends FactionsCommand
endFaction.setInvited(target, false); endFaction.setInvited(target, false);
// Create recipients // Create recipients
Set<MPlayer> recipients = new HashSet<MPlayer>(); Set<MPlayer> recipients = new HashSet<>();
recipients.addAll(targetFaction.getMPlayersWhereOnline(true)); recipients.addAll(targetFaction.getMPlayersWhereOnline(true));
recipients.addAll(endFaction.getMPlayersWhereOnline(true)); recipients.addAll(endFaction.getMPlayersWhereOnline(true));
recipients.add(msender); recipients.add(msender);
@ -369,7 +369,7 @@ public class CmdFactionsRank extends FactionsCommand
} }
// Create recipients // Create recipients
Set<MPlayer> recipients = new HashSet<MPlayer>(); Set<MPlayer> recipients = new HashSet<>();
recipients.addAll(targetFaction.getMPlayers()); recipients.addAll(targetFaction.getMPlayers());
recipients.add(msender); recipients.add(msender);

View File

@ -26,7 +26,7 @@ public class CmdFactionsRelationList extends FactionsCommand
// COSTANTS // COSTANTS
// -------------------------------------------- // // -------------------------------------------- //
public static final Set<Rel> RELEVANT_RELATIONS = new MassiveSet<Rel>(Rel.ENEMY, Rel.TRUCE, Rel.ALLY); public static final Set<Rel> RELEVANT_RELATIONS = new MassiveSet<>(Rel.ENEMY, Rel.TRUCE, Rel.ALLY);
public static final String SEPERATOR = Txt.parse("<silver>: "); public static final String SEPERATOR = Txt.parse("<silver>: ");
// -------------------------------------------- // // -------------------------------------------- //
@ -54,7 +54,7 @@ public class CmdFactionsRelationList extends FactionsCommand
final Set<Rel> relations = this.readArg(RELEVANT_RELATIONS); final Set<Rel> relations = this.readArg(RELEVANT_RELATIONS);
// Pager Create // Pager Create
final Pager<String> pager = new Pager<String>(this, "", page, new Stringifier<String>() final Pager<String> pager = new Pager<>(this, "", page, new Stringifier<String>()
{ {
@Override @Override
public String toString(String item, int index) public String toString(String item, int index)

View File

@ -83,7 +83,7 @@ public class CmdFactionsRelationSet extends FactionsCommand
} }
// TODO: The ally case should work!! // 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())) if (newRelation != Rel.TRUCE && otherFaction.getFlag(MFlag.getFlagPeaceful()))
{ {
otherFaction.msg("<i>This will have no effect while your faction is peaceful."); otherFaction.msg("<i>This will have no effect while your faction is peaceful.");

View File

@ -43,7 +43,7 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius
{ {
// Common Startup // Common Startup
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true); final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
final Set<PS> chunks = new LinkedHashSet<PS>(); final Set<PS> chunks = new LinkedHashSet<>();
chunks.add(chunk); // The center should come first for pretty messages chunks.add(chunk); // The center should come first for pretty messages

View File

@ -46,7 +46,7 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple
{ {
// Common Startup // Common Startup
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true); final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
final Set<PS> chunks = new LinkedHashSet<PS>(); final Set<PS> chunks = new LinkedHashSet<>();
// What faction (aka color) resides there? // What faction (aka color) resides there?
// NOTE: Wilderness/None is valid. // NOTE: Wilderness/None is valid.
@ -81,7 +81,7 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple
if (color == null) throw new NullPointerException("color"); if (color == null) throw new NullPointerException("color");
// Expand // Expand
Set<PS> expansion = new LinkedHashSet<PS>(); Set<PS> expansion = new LinkedHashSet<>();
for (PS chunk : set) for (PS chunk : set)
{ {
Set<PS> neighbours = MUtil.set( Set<PS> neighbours = MUtil.set(

View File

@ -43,7 +43,7 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius
{ {
// Common Startup // Common Startup
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true); final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
final Set<PS> chunks = new LinkedHashSet<PS>(); final Set<PS> chunks = new LinkedHashSet<>();
chunks.add(chunk); // The center should come first for pretty messages chunks.add(chunk); // The center should come first for pretty messages

View File

@ -54,7 +54,8 @@ public class CmdFactionsStatus extends FactionsCommand
// Pager Create // Pager Create
String title = Txt.parse("<i>Status of %s<i>.", faction.describeTo(msender, true)); String title = Txt.parse("<i>Status of %s<i>.", faction.describeTo(msender, true));
final Pager<MPlayer> pager = new Pager<MPlayer>(this, title, page, mplayers, new Stringifier<MPlayer>(){ final Pager<MPlayer> pager = new Pager<>(this, title, page, mplayers, new Stringifier<MPlayer>()
{
@Override @Override
public String toString(MPlayer mplayer, int index) public String toString(MPlayer mplayer, int index)
{ {

View File

@ -122,7 +122,7 @@ public class CmdFactionsUnstuck extends FactionsCommand
public static List<PS> getChunkSpiral(PS center) public static List<PS> getChunkSpiral(PS center)
{ {
// Create Ret // Create Ret
List<PS> ret = new ArrayList<PS>(); List<PS> ret = new ArrayList<>();
// Fill Ret // Fill Ret
center = center.getChunk(true); center = center.getChunk(true);

View File

@ -79,7 +79,7 @@ public class TypeFaction extends TypeAbstract<Faction>
public Collection<String> getTabList(CommandSender sender, String arg) public Collection<String> getTabList(CommandSender sender, String arg)
{ {
// Create // Create
Set<String> ret = new TreeSet<String>(ComparatorCaseInsensitive.get()); Set<String> ret = new TreeSet<>(ComparatorCaseInsensitive.get());
// Fill // Fill
for (Faction faction : FactionColl.get().getAll()) for (Faction faction : FactionColl.get().getAll())

View File

@ -18,14 +18,14 @@ public class TypeRank extends TypeEnum<Rel>
// CONSTANTS // CONSTANTS
// -------------------------------------------- // // -------------------------------------------- //
public static final Set<String> NAMES_PROMOTE = new MassiveSet<String>( public static final Set<String> NAMES_PROMOTE = new MassiveSet<>(
"Promote", "Promote",
"+", "+",
"Plus", "Plus",
"Up" "Up"
); );
public static final Set<String> NAMES_DEMOTE = new MassiveSet<String>( public static final Set<String> NAMES_DEMOTE = new MassiveSet<>(
"Demote", "Demote",
"-", "-",
"Minus", "Minus",
@ -101,7 +101,7 @@ public class TypeRank extends TypeEnum<Rel>
public Set<String> getNamesInner(Rel value) public Set<String> getNamesInner(Rel value)
{ {
// Create // Create
Set<String> ret = new MassiveSet<String>(); Set<String> ret = new MassiveSet<>();
// Fill Exact // Fill Exact
ret.addAll(value.getNames()); ret.addAll(value.getNames());

View File

@ -12,6 +12,5 @@ public enum DisallowCause
OWN_TERRITORY OWN_TERRITORY
// END OF LIST // END OF LIST
;
} }

View File

@ -118,7 +118,7 @@ public class EngineEcon extends Engine
public void payForAction(EventFactionsChunksChange event) public void payForAction(EventFactionsChunksChange event)
{ {
double cost = 0; double cost = 0;
List<String> typeNames = new ArrayList<String>(); List<String> typeNames = new ArrayList<>();
for (Entry<EventFactionsChunkChangeType, Set<PS>> typeChunks : event.getTypeChunks().entrySet()) for (Entry<EventFactionsChunkChangeType, Set<PS>> typeChunks : event.getTypeChunks().entrySet())
{ {

View File

@ -114,7 +114,7 @@ public class EngineExploit extends Engine
if (!center.isLiquid()) return; if (!center.isLiquid()) return;
// a single surrounding block in all 6 directions is broken if the material is weak enough // a single surrounding block in all 6 directions is broken if the material is weak enough
List<Block> targets = new ArrayList<Block>(); List<Block> targets = new ArrayList<>();
targets.add(center.getRelative(0, 0, 1)); targets.add(center.getRelative(0, 0, 1));
targets.add(center.getRelative(0, 0, -1)); targets.add(center.getRelative(0, 0, -1));
targets.add(center.getRelative(0, 1, 0)); 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_RADIUS_CHECK = 5;
private static final int NETHER_TRAP_RESET_RADIUS_SQUARED = 9; private static final int NETHER_TRAP_RESET_RADIUS_SQUARED = 9;
private HashMap<UUID, List<Block>> portalTraps = new HashMap<UUID, List<Block>>(); private HashMap<UUID, List<Block>> portalTraps = new HashMap<>();
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void portalTrapRemoveAnimation(PlayerTeleportEvent event) public void portalTrapRemoveAnimation(PlayerTeleportEvent event)

View File

@ -79,7 +79,7 @@ public class EngineFlagExplosion extends Engine
// Current allowed // Current allowed
Boolean allowed = true; Boolean allowed = true;
// Caching to speed things up. // Caching to speed things up.
Map<Faction, Boolean> faction2allowed = new HashMap<Faction, Boolean>(); Map<Faction, Boolean> faction2allowed = new HashMap<>();
// If an explosion occurs at a location ... // If an explosion occurs at a location ...
Location location = event.getLocation(); Location location = event.getLocation();

View File

@ -112,7 +112,7 @@ public class EngineSeeChunk extends Engine
if (step >= steps) throw new InvalidParameterException("step must be less than steps"); if (step >= steps) throw new InvalidParameterException("step must be less than steps");
// Create Ret // Create Ret
List<Location> ret = new ArrayList<Location>(); List<Location> ret = new ArrayList<>();
final Location location = player.getLocation(); final Location location = player.getLocation();
final World world = location.getWorld(); final World world = location.getWorld();

View File

@ -72,7 +72,7 @@ public class EngineShow extends Engine
// FLAGS // FLAGS
// We display all editable and non default ones. The rest we skip. // We display all editable and non default ones. The rest we skip.
List<String> flagDescs = new LinkedList<String>(); List<String> flagDescs = new LinkedList<>();
for (Entry<MFlag, Boolean> entry : faction.getFlags().entrySet()) for (Entry<MFlag, Boolean> entry : faction.getFlags().entrySet())
{ {
final MFlag mflag = entry.getKey(); final MFlag mflag = entry.getKey();
@ -103,7 +103,7 @@ public class EngineShow extends Engine
if (Econ.isEnabled()) if (Econ.isEnabled())
{ {
// LANDVALUES // LANDVALUES
List<String> landvalueLines = new LinkedList<String>(); List<String> landvalueLines = new LinkedList<>();
long landCount = faction.getLandCount(); long landCount = faction.getLandCount();
for (EventFactionsChunkChangeType type : EventFactionsChunkChangeType.values()) for (EventFactionsChunkChangeType type : EventFactionsChunkChangeType.values())
{ {
@ -137,10 +137,10 @@ public class EngineShow extends Engine
} }
// FOLLOWERS // FOLLOWERS
List<String> followerLines = new ArrayList<String>(); List<String> followerLines = new ArrayList<>();
List<String> followerNamesOnline = new ArrayList<String>(); List<String> followerNamesOnline = new ArrayList<>();
List<String> followerNamesOffline = new ArrayList<String>(); List<String> followerNamesOffline = new ArrayList<>();
List<MPlayer> followers = faction.getMPlayers(); List<MPlayer> followers = faction.getMPlayers();
Collections.sort(followers, PlayerRoleComparator.get()); Collections.sort(followers, PlayerRoleComparator.get());
@ -201,7 +201,7 @@ public class EngineShow extends Engine
public static List<String> table(List<String> strings, int cols) public static List<String> table(List<String> strings, int cols)
{ {
List<String> ret = new ArrayList<String>(); List<String> ret = new ArrayList<>();
StringBuilder row = new StringBuilder(); StringBuilder row = new StringBuilder();
int count = 0; int count = 0;

View File

@ -72,12 +72,12 @@ public class Board extends Entity<Board> implements BoardInterface
public Board() public Board()
{ {
this.map = new ConcurrentSkipListMap<PS, TerritoryAccess>(); this.map = new ConcurrentSkipListMap<>();
} }
public Board(Map<PS, TerritoryAccess> map) public Board(Map<PS, TerritoryAccess> map)
{ {
this.map = new ConcurrentSkipListMap<PS, TerritoryAccess>(map); this.map = new ConcurrentSkipListMap<>(map);
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -186,7 +186,7 @@ public class Board extends Entity<Board> implements BoardInterface
@Override @Override
public Set<PS> getChunks(String factionId) public Set<PS> getChunks(String factionId)
{ {
Set<PS> ret = new HashSet<PS>(); Set<PS> ret = new HashSet<>();
for (Entry<PS, TerritoryAccess> entry : this.map.entrySet()) for (Entry<PS, TerritoryAccess> entry : this.map.entrySet())
{ {
TerritoryAccess ta = entry.getValue(); TerritoryAccess ta = entry.getValue();
@ -202,7 +202,7 @@ public class Board extends Entity<Board> implements BoardInterface
@Override @Override
public Map<Faction, Set<PS>> getFactionToChunks() public Map<Faction, Set<PS>> getFactionToChunks()
{ {
Map<Faction, Set<PS>> ret = new MassiveMap<Faction, Set<PS>>(); Map<Faction, Set<PS>> ret = new MassiveMap<>();
for (Entry<PS, TerritoryAccess> entry : this.map.entrySet()) for (Entry<PS, TerritoryAccess> entry : this.map.entrySet())
{ {
@ -215,7 +215,7 @@ public class Board extends Entity<Board> implements BoardInterface
Set<PS> chunks = ret.get(faction); Set<PS> chunks = ret.get(faction);
if (chunks == null) if (chunks == null)
{ {
chunks = new MassiveSet<PS>(); chunks = new MassiveSet<>();
ret.put(faction, chunks); ret.put(faction, chunks);
} }
@ -251,7 +251,7 @@ public class Board extends Entity<Board> implements BoardInterface
@Override @Override
public Map<Faction, Integer> getFactionToCount() public Map<Faction, Integer> getFactionToCount()
{ {
Map<Faction, Integer> ret = new MassiveMap<Faction, Integer>(); Map<Faction, Integer> ret = new MassiveMap<>();
for (Entry<PS, TerritoryAccess> entry : this.map.entrySet()) for (Entry<PS, TerritoryAccess> entry : this.map.entrySet())
{ {
@ -388,7 +388,7 @@ public class Board extends Entity<Board> implements BoardInterface
// Make room for the list of names // Make room for the list of names
height--; height--;
Map<Faction, Character> fList = new HashMap<Faction, Character>(); Map<Faction, Character> fList = new HashMap<>();
int chrIdx = 0; int chrIdx = 0;
boolean overflown = false; boolean overflown = false;

View File

@ -132,7 +132,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
public Set<PS> getChunks(Faction faction) public Set<PS> getChunks(Faction faction)
{ {
// Create // Create
Set<PS> ret = new HashSet<PS>(); Set<PS> ret = new HashSet<>();
// Fill // Fill
for (Board board : this.getAll()) for (Board board : this.getAll())
@ -148,7 +148,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
public Set<PS> getChunks(String factionId) public Set<PS> getChunks(String factionId)
{ {
// Create // Create
Set<PS> ret = new HashSet<PS>(); Set<PS> ret = new HashSet<>();
// Fill // Fill
for (Board board : this.getAll()) for (Board board : this.getAll())
@ -194,7 +194,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
} }
// Enforce create // Enforce create
if (ret == null) ret = new MassiveMap<Faction, Set<PS>>(); if (ret == null) ret = new MassiveMap<>();
// Return // Return
return ret; return ret;
@ -249,7 +249,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
} }
} }
if (ret == null) ret = new MassiveMap<Faction, Integer>(); if (ret == null) ret = new MassiveMap<>();
return ret; return ret;
} }
@ -360,7 +360,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
psChunk = psChunk.getChunk(true); psChunk = psChunk.getChunk(true);
// Create // Create
Set<PS> ret = new LinkedHashSet<PS>(); Set<PS> ret = new LinkedHashSet<>();
if (distance < 0) return ret; if (distance < 0) return ret;
// Fill // Fill
@ -391,7 +391,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
if (chunks == null) throw new NullPointerException("chunks"); if (chunks == null) throw new NullPointerException("chunks");
// Create // Create
Set<PS> ret = new LinkedHashSet<PS>(); Set<PS> ret = new LinkedHashSet<>();
if (distance < 0) return ret; if (distance < 0) return ret;
@ -411,7 +411,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
if (chunks == null) throw new NullPointerException("chunks"); if (chunks == null) throw new NullPointerException("chunks");
// Create // Create
Set<Faction> ret = new LinkedHashSet<Faction>(); Set<Faction> ret = new LinkedHashSet<>();
// Fill // Fill
for (PS chunk : chunks) for (PS chunk : chunks)
@ -428,7 +428,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
public static Map<PS, Faction> getChunkFaction(Collection<PS> chunks) public static Map<PS, Faction> getChunkFaction(Collection<PS> chunks)
{ {
// Create // Create
Map<PS, Faction> ret = new LinkedHashMap<PS, Faction>(); Map<PS, Faction> ret = new LinkedHashMap<>();
// Fill // Fill
Faction none = FactionColl.get().getNone(); Faction none = FactionColl.get().getNone();

View File

@ -11,40 +11,40 @@ import java.util.Set;
public interface BoardInterface public interface BoardInterface
{ {
// GET // GET
public TerritoryAccess getTerritoryAccessAt(PS ps); TerritoryAccess getTerritoryAccessAt(PS ps);
public Faction getFactionAt(PS ps); Faction getFactionAt(PS ps);
// SET // SET
public void setTerritoryAccessAt(PS ps, TerritoryAccess territoryAccess); void setTerritoryAccessAt(PS ps, TerritoryAccess territoryAccess);
public void setFactionAt(PS ps, Faction faction); void setFactionAt(PS ps, Faction faction);
// REMOVE // REMOVE
public void removeAt(PS ps); void removeAt(PS ps);
public void removeAll(Faction faction); void removeAll(Faction faction);
public void clean(); void clean();
// CHUNKS // CHUNKS
public Set<PS> getChunks(Faction faction); Set<PS> getChunks(Faction faction);
public Set<PS> getChunks(String factionId); Set<PS> getChunks(String factionId);
public Map<Faction, Set<PS>> getFactionToChunks(); Map<Faction, Set<PS>> getFactionToChunks();
// COUNT // COUNT
public int getCount(Faction faction); int getCount(Faction faction);
public int getCount(String factionId); int getCount(String factionId);
public Map<Faction, Integer> getFactionToCount(); Map<Faction, Integer> getFactionToCount();
// CLAIMED // CLAIMED
public boolean hasClaimed(Faction faction); boolean hasClaimed(Faction faction);
public boolean hasClaimed(String factionId); boolean hasClaimed(String factionId);
// NEARBY DETECTION // NEARBY DETECTION
public boolean isBorderPs(PS ps); boolean isBorderPs(PS ps);
public boolean isAnyBorderPs(Set<PS> pss); boolean isAnyBorderPs(Set<PS> pss);
public boolean isConnectedPs(PS ps, Faction faction); boolean isConnectedPs(PS ps, Faction faction);
public boolean isAnyConnectedPs(Set<PS> pss, Faction faction); boolean isAnyConnectedPs(Set<PS> pss, Faction faction);
// MAP // MAP
// TODO: Could the degrees be embedded in centerPs yaw instead? // TODO: Could the degrees be embedded in centerPs yaw instead?
public List<Object> getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height); List<Object> getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height);
} }

View File

@ -140,19 +140,19 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
// This is the ids of the invited players. // This is the ids of the invited players.
// They are actually "senderIds" since you can invite "@console" to your faction. // They are actually "senderIds" since you can invite "@console" to your faction.
// Null means no one is invited // Null means no one is invited
private MassiveTreeSetDef<String, ComparatorCaseInsensitive> invitedPlayerIds = new MassiveTreeSetDef<String, ComparatorCaseInsensitive>(ComparatorCaseInsensitive.get()); private MassiveTreeSetDef<String, ComparatorCaseInsensitive> invitedPlayerIds = new MassiveTreeSetDef<>(ComparatorCaseInsensitive.get());
// The keys in this map are factionIds. // The keys in this map are factionIds.
// Null means no special relation whishes. // Null means no special relation whishes.
private MassiveMapDef<String, Rel> relationWishes = new MassiveMapDef<String, Rel>(); private MassiveMapDef<String, Rel> relationWishes = new MassiveMapDef<>();
// The flag overrides are modifications to the default values. // The flag overrides are modifications to the default values.
// Null means default. // Null means default.
private MassiveMapDef<String, Boolean> flags = new MassiveMapDef<String, Boolean>(); private MassiveMapDef<String, Boolean> flags = new MassiveMapDef<>();
// The perm overrides are modifications to the default values. // The perm overrides are modifications to the default values.
// Null means default. // Null means default.
private MassiveMapDef<String, Set<Rel>> perms = new MassiveMapDef<String, Set<Rel>>(); private MassiveMapDef<String, Set<Rel>> perms = new MassiveMapDef<>();
// -------------------------------------------- // // -------------------------------------------- //
// FIELD: id // FIELD: id
@ -465,7 +465,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public void setInvitedPlayerIds(Collection<String> invitedPlayerIds) public void setInvitedPlayerIds(Collection<String> invitedPlayerIds)
{ {
// Clean input // Clean input
MassiveTreeSetDef<String, ComparatorCaseInsensitive> target = new MassiveTreeSetDef<String, ComparatorCaseInsensitive>(ComparatorCaseInsensitive.get()); MassiveTreeSetDef<String, ComparatorCaseInsensitive> target = new MassiveTreeSetDef<>(ComparatorCaseInsensitive.get());
if (invitedPlayerIds != null) if (invitedPlayerIds != null)
{ {
for (String invitedPlayerId : invitedPlayerIds) for (String invitedPlayerId : invitedPlayerIds)
@ -498,7 +498,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public boolean setInvited(String playerId, boolean invited) public boolean setInvited(String playerId, boolean invited)
{ {
List<String> invitedPlayerIds = new ArrayList<String>(this.getInvitedPlayerIds()); List<String> invitedPlayerIds = new ArrayList<>(this.getInvitedPlayerIds());
boolean ret; boolean ret;
if (invited) if (invited)
{ {
@ -520,7 +520,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public List<MPlayer> getInvitedMPlayers() public List<MPlayer> getInvitedMPlayers()
{ {
List<MPlayer> mplayers = new ArrayList<MPlayer>(); List<MPlayer> mplayers = new ArrayList<>();
for (String id : this.getInvitedPlayerIds()) for (String id : this.getInvitedPlayerIds())
{ {
@ -544,7 +544,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public void setRelationWishes(Map<String, Rel> relationWishes) public void setRelationWishes(Map<String, Rel> relationWishes)
{ {
// Clean input // Clean input
MassiveMapDef<String, Rel> target = new MassiveMapDef<String, Rel>(relationWishes); MassiveMapDef<String, Rel> target = new MassiveMapDef<>(relationWishes);
// Detect Nochange // Detect Nochange
if (MUtil.equals(this.relationWishes, target)) return; if (MUtil.equals(this.relationWishes, target)) return;
@ -598,7 +598,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public Map<MFlag, Boolean> getFlags() public Map<MFlag, Boolean> getFlags()
{ {
// We start with default values ... // We start with default values ...
Map<MFlag, Boolean> ret = new LinkedHashMap<MFlag, Boolean>(); Map<MFlag, Boolean> ret = new LinkedHashMap<>();
for (MFlag mflag : MFlag.getAll()) for (MFlag mflag : MFlag.getAll())
{ {
ret.put(mflag, mflag.isStandard()); ret.put(mflag, mflag.isStandard());
@ -632,7 +632,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public void setFlags(Map<MFlag, Boolean> flags) public void setFlags(Map<MFlag, Boolean> flags)
{ {
Map<String, Boolean> flagIds = new LinkedHashMap<String, Boolean>(); Map<String, Boolean> flagIds = new LinkedHashMap<>();
for (Entry<MFlag, Boolean> entry : flags.entrySet()) for (Entry<MFlag, Boolean> entry : flags.entrySet())
{ {
flagIds.put(entry.getKey().getId(), entry.getValue()); flagIds.put(entry.getKey().getId(), entry.getValue());
@ -643,7 +643,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public void setFlagIds(Map<String, Boolean> flagIds) public void setFlagIds(Map<String, Boolean> flagIds)
{ {
// Clean input // Clean input
MassiveMapDef<String, Boolean> target = new MassiveMapDef<String, Boolean>(); MassiveMapDef<String, Boolean> target = new MassiveMapDef<>();
for (Entry<String, Boolean> entry : flagIds.entrySet()) for (Entry<String, Boolean> entry : flagIds.entrySet())
{ {
String key = entry.getKey(); String key = entry.getKey();
@ -660,7 +660,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
if (MUtil.equals(this.flags, target)) return; if (MUtil.equals(this.flags, target)) return;
// Apply // Apply
this.flags = new MassiveMapDef<String, Boolean>(target); this.flags = new MassiveMapDef<>(target);
// Mark as changed // Mark as changed
this.changed(); this.changed();
@ -724,10 +724,10 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public Map<MPerm, Set<Rel>> getPerms() public Map<MPerm, Set<Rel>> getPerms()
{ {
// We start with default values ... // We start with default values ...
Map<MPerm, Set<Rel>> ret = new LinkedHashMap<MPerm, Set<Rel>>(); Map<MPerm, Set<Rel>> ret = new LinkedHashMap<>();
for (MPerm mperm : MPerm.getAll()) for (MPerm mperm : MPerm.getAll())
{ {
ret.put(mperm, new LinkedHashSet<Rel>(mperm.getStandard())); ret.put(mperm, new LinkedHashSet<>(mperm.getStandard()));
} }
// ... and if anything is explicitly set we use that info ... // ... and if anything is explicitly set we use that info ...
@ -749,7 +749,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
MPerm mperm = MPerm.get(id); MPerm mperm = MPerm.get(id);
if (mperm == null) continue; if (mperm == null) continue;
ret.put(mperm, new LinkedHashSet<Rel>(entry.getValue())); ret.put(mperm, new LinkedHashSet<>(entry.getValue()));
} }
return ret; return ret;
@ -757,7 +757,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public void setPerms(Map<MPerm, Set<Rel>> perms) public void setPerms(Map<MPerm, Set<Rel>> perms)
{ {
Map<String, Set<Rel>> permIds = new LinkedHashMap<String, Set<Rel>>(); Map<String, Set<Rel>> permIds = new LinkedHashMap<>();
for (Entry<MPerm, Set<Rel>> entry : perms.entrySet()) for (Entry<MPerm, Set<Rel>> entry : perms.entrySet())
{ {
permIds.put(entry.getKey().getId(), entry.getValue()); permIds.put(entry.getKey().getId(), entry.getValue());
@ -768,7 +768,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public void setPermIds(Map<String, Set<Rel>> perms) public void setPermIds(Map<String, Set<Rel>> perms)
{ {
// Clean input // Clean input
MassiveMapDef<String, Set<Rel>> target = new MassiveMapDef<String, Set<Rel>>(); MassiveMapDef<String, Set<Rel>> target = new MassiveMapDef<>();
for (Entry<String, Set<Rel>> entry : perms.entrySet()) for (Entry<String, Set<Rel>> entry : perms.entrySet())
{ {
String key = entry.getKey(); String key = entry.getKey();
@ -866,7 +866,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public void setPermittedRelations(MPerm perm, Rel... rels) public void setPermittedRelations(MPerm perm, Rel... rels)
{ {
Set<Rel> temp = new HashSet<Rel>(); Set<Rel> temp = new HashSet<>();
temp.addAll(Arrays.asList(rels)); temp.addAll(Arrays.asList(rels));
this.setPermittedRelations(perm, temp); this.setPermittedRelations(perm, temp);
} }
@ -1008,7 +1008,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
// FOREIGN KEY: MPLAYER // FOREIGN KEY: MPLAYER
// -------------------------------------------- // // -------------------------------------------- //
protected transient Set<MPlayer> mplayers = new MassiveSet<MPlayer>(); protected transient Set<MPlayer> mplayers = new MassiveSet<>();
public void reindexMPlayers() public void reindexMPlayers()
{ {
@ -1045,7 +1045,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public List<MPlayer> getMPlayers() public List<MPlayer> getMPlayers()
{ {
this.checkMPlayerIndex(); this.checkMPlayerIndex();
return new ArrayList<MPlayer>(this.mplayers); return new ArrayList<>(this.mplayers);
} }
public List<MPlayer> getMPlayersWhere(Predicate<? super MPlayer> predicate) public List<MPlayer> getMPlayersWhere(Predicate<? super MPlayer> predicate)
@ -1083,7 +1083,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public List<CommandSender> getOnlineCommandSenders() public List<CommandSender> getOnlineCommandSenders()
{ {
// Create Ret // Create Ret
List<CommandSender> ret = new ArrayList<CommandSender>(); List<CommandSender> ret = new ArrayList<>();
// Fill Ret // Fill Ret
for (CommandSender sender : IdUtil.getLocalSenders()) for (CommandSender sender : IdUtil.getLocalSenders())
@ -1103,7 +1103,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public List<Player> getOnlinePlayers() public List<Player> getOnlinePlayers()
{ {
// Create Ret // Create Ret
List<Player> ret = new ArrayList<Player>(); List<Player> ret = new ArrayList<>();
// Fill Ret // Fill Ret
for (Player player : MUtil.getOnlinePlayers()) for (Player player : MUtil.getOnlinePlayers())

View File

@ -246,7 +246,7 @@ public class FactionColl extends Coll<Faction>
public ArrayList<String> validateName(String str) public ArrayList<String> validateName(String str)
{ {
// Create // Create
ArrayList<String> errors = new ArrayList<String>(); ArrayList<String> errors = new ArrayList<>();
// Fill // Fill
// Check minimum length // Check minimum length
@ -295,7 +295,7 @@ public class FactionColl extends Coll<Faction>
public Map<Rel, List<String>> getRelationNames(Faction faction, Set<Rel> rels) public Map<Rel, List<String>> getRelationNames(Faction faction, Set<Rel> rels)
{ {
// Create // Create
Map<Rel, List<String>> ret = new LinkedHashMap<Rel, List<String>>(); Map<Rel, List<String>> ret = new LinkedHashMap<>();
MFlag flagPeaceful = MFlag.getFlagPeaceful(); MFlag flagPeaceful = MFlag.getFlagPeaceful();
boolean peaceful = faction.getFlag(flagPeaceful); boolean peaceful = faction.getFlag(flagPeaceful);
for (Rel rel : rels) for (Rel rel : rels)

View File

@ -79,7 +79,7 @@ public class MConf extends Entity<MConf>
// Add player names here who should bypass all protections. // Add player names here who should bypass all protections.
// Should /not/ be used for admins. There is "/f adminmode" for that. // 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. // This is for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections.
public Set<String> playersWhoBypassAllProtection = new LinkedHashSet<String>(); public Set<String> playersWhoBypassAllProtection = new LinkedHashSet<>();
// -------------------------------------------- // // -------------------------------------------- //
// TASKS // TASKS
@ -337,7 +337,7 @@ public class MConf extends Entity<MConf>
// A list of commands to block for members of permanent factions. // A list of commands to block for members of permanent factions.
// I don't really understand the user case for this option. // I don't really understand the user case for this option.
public List<String> denyCommandsPermanentFactionMember = new ArrayList<String>(); public List<String> denyCommandsPermanentFactionMember = new ArrayList<>();
// Lists of commands to deny depending on your relation to the current faction territory. // 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. // 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<MConf>
// This way they can be protected in Faction territory. // 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. // Interacting with these materials when they are already placed in the terrain results in an edit.
public BackstringSet<Material> materialsEditOnInteract = new BackstringSet<Material>(Material.class, public BackstringSet<Material> materialsEditOnInteract = new BackstringSet<>(Material.class,
"DIODE_BLOCK_OFF", // Minecraft 1.? "DIODE_BLOCK_OFF", // Minecraft 1.?
"DIODE_BLOCK_ON", // Minecraft 1.? "DIODE_BLOCK_ON", // Minecraft 1.?
"NOTE_BLOCK", // Minecraft 1.? "NOTE_BLOCK", // Minecraft 1.?
@ -551,7 +551,7 @@ public class MConf extends Entity<MConf>
// Interacting with the the terrain holding this item in hand results in an edit. // 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. // There's no need to add all block materials here. Only special items other than blocks.
public BackstringSet<Material> materialsEditTools = new BackstringSet<Material>(Material.class, public BackstringSet<Material> materialsEditTools = new BackstringSet<>(Material.class,
"FIREBALL", // Minecraft 1.? "FIREBALL", // Minecraft 1.?
"FLINT_AND_STEEL", // Minecraft 1.? "FLINT_AND_STEEL", // Minecraft 1.?
"BUCKET", // Minecraft 1.? "BUCKET", // Minecraft 1.?
@ -563,7 +563,7 @@ public class MConf extends Entity<MConf>
// The duplication bug found in Spigot 1.8 protocol patch // The duplication bug found in Spigot 1.8 protocol patch
// https://github.com/MassiveCraft/Factions/issues/693 // https://github.com/MassiveCraft/Factions/issues/693
public BackstringSet<Material> materialsEditToolsDupeBug = new BackstringSet<Material>(Material.class, public BackstringSet<Material> materialsEditToolsDupeBug = new BackstringSet<>(Material.class,
"CHEST", // Minecraft 1.? "CHEST", // Minecraft 1.?
"SIGN_POST", // Minecraft 1.? "SIGN_POST", // Minecraft 1.?
"TRAPPED_CHEST", // Minecraft 1.? "TRAPPED_CHEST", // Minecraft 1.?
@ -573,7 +573,7 @@ public class MConf extends Entity<MConf>
); );
// Interacting with these materials placed in the terrain results in door toggling. // Interacting with these materials placed in the terrain results in door toggling.
public BackstringSet<Material> materialsDoor = new BackstringSet<Material>(Material.class, public BackstringSet<Material> materialsDoor = new BackstringSet<>(Material.class,
"WOODEN_DOOR", // Minecraft 1.? "WOODEN_DOOR", // Minecraft 1.?
"ACACIA_DOOR", // Minecraft 1.8 "ACACIA_DOOR", // Minecraft 1.8
"BIRCH_DOOR", // Minecraft 1.8 "BIRCH_DOOR", // Minecraft 1.8
@ -590,7 +590,7 @@ public class MConf extends Entity<MConf>
); );
// Interacting with these materials placed in the terrain results in opening a container. // Interacting with these materials placed in the terrain results in opening a container.
public BackstringSet<Material> materialsContainer = new BackstringSet<Material>(Material.class, public BackstringSet<Material> materialsContainer = new BackstringSet<>(Material.class,
"DISPENSER", // Minecraft 1.? "DISPENSER", // Minecraft 1.?
"CHEST", // Minecraft 1.? "CHEST", // Minecraft 1.?
"FURNACE", // Minecraft 1.? "FURNACE", // Minecraft 1.?
@ -624,26 +624,26 @@ public class MConf extends Entity<MConf>
); );
// Interacting with these entities results in an edit. // Interacting with these entities results in an edit.
public BackstringSet<EntityType> entityTypesEditOnInteract = new BackstringSet<EntityType>(EntityType.class, public BackstringSet<EntityType> entityTypesEditOnInteract = new BackstringSet<>(EntityType.class,
"ITEM_FRAME", // Minecraft 1.? "ITEM_FRAME", // Minecraft 1.?
"ARMOR_STAND" // Minecraft 1.8 "ARMOR_STAND" // Minecraft 1.8
); );
// Damaging these entities results in an edit. // Damaging these entities results in an edit.
public BackstringSet<EntityType> entityTypesEditOnDamage = new BackstringSet<EntityType>(EntityType.class, public BackstringSet<EntityType> entityTypesEditOnDamage = new BackstringSet<>(EntityType.class,
"ITEM_FRAME", // Minecraft 1.? "ITEM_FRAME", // Minecraft 1.?
"ARMOR_STAND", // Minecraft 1.8 "ARMOR_STAND", // Minecraft 1.8
"ENDER_CRYSTAL" // Minecraft 1.10 "ENDER_CRYSTAL" // Minecraft 1.10
); );
// Interacting with these entities results in opening a container. // Interacting with these entities results in opening a container.
public BackstringSet<EntityType> entityTypesContainer = new BackstringSet<EntityType>(EntityType.class, public BackstringSet<EntityType> entityTypesContainer = new BackstringSet<>(EntityType.class,
"MINECART_CHEST", // Minecraft 1.? "MINECART_CHEST", // Minecraft 1.?
"MINECART_HOPPER" // Minecraft 1.? "MINECART_HOPPER" // Minecraft 1.?
); );
// The complete list of entities considered to be monsters. // The complete list of entities considered to be monsters.
public BackstringSet<EntityType> entityTypesMonsters = new BackstringSet<EntityType>(EntityType.class, public BackstringSet<EntityType> entityTypesMonsters = new BackstringSet<>(EntityType.class,
"BLAZE", // Minecraft 1.? "BLAZE", // Minecraft 1.?
"CAVE_SPIDER", // Minecraft 1.? "CAVE_SPIDER", // Minecraft 1.?
"CREEPER", // Minecraft 1.? "CREEPER", // Minecraft 1.?
@ -675,7 +675,7 @@ public class MConf extends Entity<MConf>
); );
// List of entities considered to be animals. // List of entities considered to be animals.
public BackstringSet<EntityType> entityTypesAnimals = new BackstringSet<EntityType>(EntityType.class, public BackstringSet<EntityType> entityTypesAnimals = new BackstringSet<>(EntityType.class,
"BAT", // Minecraft 1.? "BAT", // Minecraft 1.?
"CHICKEN", // Minecraft 1.? "CHICKEN", // Minecraft 1.?
"COW", // Minecraft 1.? "COW", // Minecraft 1.?
@ -714,7 +714,7 @@ public class MConf extends Entity<MConf>
public boolean herochatFactionIsShortcutAllowed = false; public boolean herochatFactionIsShortcutAllowed = false;
public boolean herochatFactionCrossWorld = true; public boolean herochatFactionCrossWorld = true;
public boolean herochatFactionMuted = false; public boolean herochatFactionMuted = false;
public Set<String> herochatFactionWorlds = new HashSet<String>(); public Set<String> herochatFactionWorlds = new HashSet<>();
// The Allies Channel // The Allies Channel
public String herochatAlliesName = "Allies"; public String herochatAlliesName = "Allies";
@ -725,7 +725,7 @@ public class MConf extends Entity<MConf>
public boolean herochatAlliesIsShortcutAllowed = false; public boolean herochatAlliesIsShortcutAllowed = false;
public boolean herochatAlliesCrossWorld = true; public boolean herochatAlliesCrossWorld = true;
public boolean herochatAlliesMuted = false; public boolean herochatAlliesMuted = false;
public Set<String> herochatAlliesWorlds = new HashSet<String>(); public Set<String> herochatAlliesWorlds = new HashSet<>();
// -------------------------------------------- // // -------------------------------------------- //
// INTEGRATION: LWC // INTEGRATION: LWC

View File

@ -47,7 +47,7 @@ public class MFlagColl extends Coll<MFlag>
public List<MFlag> getAll(boolean registered) public List<MFlag> getAll(boolean registered)
{ {
// Create // Create
List<MFlag> ret = new ArrayList<MFlag>(); List<MFlag> ret = new ArrayList<>();
// Fill // Fill
for (MFlag mflag : this.getAll()) for (MFlag mflag : this.getAll())

View File

@ -231,7 +231,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
// What is the standard (aka default) perm value? // What is the standard (aka default) perm value?
// This value will be set for factions from the beginning. // This value will be set for factions from the beginning.
// Example: ... set of relations ... // Example: ... set of relations ...
private Set<Rel> standard = new LinkedHashSet<Rel>(); private Set<Rel> standard = new LinkedHashSet<>();
public Set<Rel> getStandard() { return this.standard; } public Set<Rel> getStandard() { return this.standard; }
public MPerm setStandard(Set<Rel> standard) { this.standard = standard; this.changed(); return this; } public MPerm setStandard(Set<Rel> standard) { this.standard = standard; this.changed(); return this; }
@ -305,7 +305,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
public String getDesc(boolean withName, boolean withDesc) public String getDesc(boolean withName, boolean withDesc)
{ {
List<String> parts = new ArrayList<String>(); List<String> parts = new ArrayList<>();
if (withName) if (withName)
{ {

View File

@ -47,7 +47,7 @@ public class MPermColl extends Coll<MPerm>
public List<MPerm> getAll(boolean registered) public List<MPerm> getAll(boolean registered)
{ {
// Create // Create
List<MPerm> ret = new ArrayList<MPerm>(); List<MPerm> ret = new ArrayList<>();
// Fill // Fill
for (MPerm mperm : this.getAll()) for (MPerm mperm : this.getAll())

View File

@ -925,7 +925,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements FactionsParticipat
public static Set<MPlayer> getClaimInformees(MPlayer msender, Faction... factions) public static Set<MPlayer> getClaimInformees(MPlayer msender, Faction... factions)
{ {
Set<MPlayer> ret = new HashSet<MPlayer>(); Set<MPlayer> ret = new HashSet<>();
if (msender != null) ret.add(msender); if (msender != null) ret.add(msender);

View File

@ -62,7 +62,7 @@ public class EventFactionsChunksChange extends EventFactionsAbstractSender
MPlayer msender = this.getMPlayer(); MPlayer msender = this.getMPlayer();
Faction self = null; Faction self = null;
if (msender != null) self = msender.getFaction(); if (msender != null) self = msender.getFaction();
Map<PS, EventFactionsChunkChangeType> currentChunkType = new LinkedHashMap<PS, EventFactionsChunkChangeType>(); Map<PS, EventFactionsChunkChangeType> currentChunkType = new LinkedHashMap<>();
for (Entry<PS, Faction> entry : this.oldChunkFaction.entrySet()) for (Entry<PS, Faction> entry : this.oldChunkFaction.entrySet())
{ {
PS chunk = entry.getKey(); PS chunk = entry.getKey();

View File

@ -21,7 +21,7 @@ public class EventFactionsExpansions extends EventFactionsAbstractSender
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
private final MassiveTreeMap<String, Boolean, ComparatorCaseInsensitive> expansions = new MassiveTreeMap<String, Boolean, ComparatorCaseInsensitive>(ComparatorCaseInsensitive.get()); private final MassiveTreeMap<String, Boolean, ComparatorCaseInsensitive> expansions = new MassiveTreeMap<>(ComparatorCaseInsensitive.get());
public Map<String, Boolean> getExpansions() { return this.expansions; } public Map<String, Boolean> getExpansions() { return this.expansions; }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -36,7 +36,7 @@ public class EventFactionsFactionShowAsync extends EventFactionsAbstractSender
{ {
super(true, sender); super(true, sender);
this.faction = faction; this.faction = faction;
this.idPriorityLiness = new HashMap<String, PriorityLines>(); this.idPriorityLiness = new HashMap<>();
} }
} }

View File

@ -72,7 +72,7 @@ public class EventFactionsMembershipChange extends EventFactionsAbstractSender
private final boolean cancellable; private final boolean cancellable;
public boolean isCancellable() { return this.cancellable; } public boolean isCancellable() { return this.cancellable; }
private MembershipChangeReason(boolean cancellable) MembershipChangeReason(boolean cancellable)
{ {
this.cancellable = cancellable; this.cancellable = cancellable;
} }

View File

@ -31,7 +31,7 @@ public class EventFactionsRemovePlayerMillis extends EventMassiveCore
public long getMillis() { return this.millis; } public long getMillis() { return this.millis; }
public void setMillis(long millis) { this.millis = millis; } public void setMillis(long millis) { this.millis = millis; }
private Map<String, Long> causeMillis = new LinkedHashMap<String, Long>(); private Map<String, Long> causeMillis = new LinkedHashMap<>();
public Map<String, Long> getCauseMillis() { return this.causeMillis; } public Map<String, Long> getCauseMillis() { return this.causeMillis; }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -160,7 +160,7 @@ public class Econ
public static Set<MPlayer> getMPlayers(EconomyParticipator ep) public static Set<MPlayer> getMPlayers(EconomyParticipator ep)
{ {
Set<MPlayer> mplayers = new HashSet<MPlayer>(); Set<MPlayer> mplayers = new HashSet<>();
if (ep == null) if (ep == null)
{ {
@ -180,7 +180,7 @@ public class Econ
public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount) public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount)
{ {
Set<MPlayer> recipients = new HashSet<MPlayer>(); Set<MPlayer> recipients = new HashSet<>();
recipients.addAll(getMPlayers(invoker)); recipients.addAll(getMPlayers(invoker));
recipients.addAll(getMPlayers(from)); recipients.addAll(getMPlayers(from));
recipients.addAll(getMPlayers(to)); recipients.addAll(getMPlayers(to));

View File

@ -49,7 +49,7 @@ public class EngineV19 extends Engine
Entity thrower = (Entity)projectileSource; Entity thrower = (Entity)projectileSource;
// ... create a dummy list to avoid ConcurrentModificationException ... // ... create a dummy list to avoid ConcurrentModificationException ...
List<LivingEntity> affectedList = new ArrayList<LivingEntity>(); List<LivingEntity> affectedList = new ArrayList<>();
// ... then scan through affected entities to make sure they're all valid targets ... // ... then scan through affected entities to make sure they're all valid targets ...
for (LivingEntity affectedEntity : event.getAffectedEntities()) for (LivingEntity affectedEntity : event.getAffectedEntities())

View File

@ -97,7 +97,7 @@ public abstract class ChannelFactionsAbstract implements Channel
@Override @Override
public Set<Chatter> getMembers() public Set<Chatter> getMembers()
{ {
Set<Chatter> ret = new HashSet<Chatter>(); Set<Chatter> ret = new HashSet<>();
for (Chatter chatter : Herochat.getChatterManager().getChatters()) for (Chatter chatter : Herochat.getChatterManager().getChatters())
{ {
if(chatter.hasChannel(this)) ret.add(chatter); 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); message = this.applyFormat(this.getFormatSupplier().getEmoteFormat(), "").replace("%2$s", message);
Set<Player> recipients = new HashSet<Player>(); Set<Player> recipients = new HashSet<>();
for (Chatter member : this.getMembers()) for (Chatter member : this.getMembers())
{ {
recipients.add(member.getPlayer()); recipients.add(member.getPlayer());
@ -225,7 +225,7 @@ public abstract class ChannelFactionsAbstract implements Channel
public Set<Player> getRecipients(Player sender) public Set<Player> getRecipients(Player sender)
{ {
Set<Player> ret = new HashSet<Player>(); Set<Player> ret = new HashSet<>();
MPlayer fsender = MPlayer.get(sender); MPlayer fsender = MPlayer.get(sender);
Faction faction = fsender.getFaction(); Faction faction = fsender.getFaction();

View File

@ -28,7 +28,7 @@ public class ChannelFactionsFaction extends ChannelFactionsAbstract
@Override public void setDistance(int distance) { MConf.get().herochatFactionDistance = distance; } @Override public void setDistance(int distance) { MConf.get().herochatFactionDistance = distance; }
@Override public void addWorld(String world) { MConf.get().herochatFactionWorlds.add(world); } @Override public void addWorld(String world) { MConf.get().herochatFactionWorlds.add(world); }
@Override public Set<String> getWorlds() { return new HashSet<String>(MConf.get().herochatFactionWorlds); } @Override public Set<String> getWorlds() { return new HashSet<>(MConf.get().herochatFactionWorlds); }
@Override public void setWorlds(Set<String> worlds) { MConf.get().herochatFactionWorlds = worlds; } @Override public void setWorlds(Set<String> worlds) { MConf.get().herochatFactionWorlds = worlds; }
@Override public boolean isShortcutAllowed() { return MConf.get().herochatFactionIsShortcutAllowed; } @Override public boolean isShortcutAllowed() { return MConf.get().herochatFactionIsShortcutAllowed; }

View File

@ -128,7 +128,7 @@ public class EngineWorldGuard extends Engine
ProtectedCuboidRegion region = new ProtectedCuboidRegion(regionName, minChunk, maxChunk); ProtectedCuboidRegion region = new ProtectedCuboidRegion(regionName, minChunk, maxChunk);
Map<String, ProtectedRegion> regionMap = regionManager.getRegions(); Map<String, ProtectedRegion> regionMap = regionManager.getRegions();
List<ProtectedRegion> regionList = new ArrayList<ProtectedRegion>(regionMap.values()); List<ProtectedRegion> regionList = new ArrayList<>(regionMap.values());
// Let's find what we've overlapped // Let's find what we've overlapped
List<ProtectedRegion> overlapRegions = region.getIntersectingRegions(regionList); List<ProtectedRegion> overlapRegions = region.getIntersectingRegions(regionList);

View File

@ -113,7 +113,7 @@ public class UpdateUtil
public static List<String> getUniverses() public static List<String> getUniverses()
{ {
List<String> ret = new ArrayList<String>(); List<String> ret = new ArrayList<>();
for (String collname : MStore.getDb().getCollnames()) for (String collname : MStore.getDb().getCollnames())
{ {
@ -232,7 +232,7 @@ public class UpdateUtil
// Before and After // Before and After
Set<String> before = entity.factionIds; Set<String> before = entity.factionIds;
if (before == null) return false; if (before == null) return false;
Set<String> after = new LinkedHashSet<String>(); Set<String> after = new LinkedHashSet<>();
for (String id : before) for (String id : before)
{ {
if (id == null) continue; if (id == null) continue;

View File

@ -79,7 +79,7 @@ public enum AsciiCompassDirection
if (degrees < 0) degrees += 360; if (degrees < 0) degrees += 360;
// Get ordinal // Get ordinal
int ordinal = (int) Math.floor(degrees / 45);; int ordinal = (int) Math.floor(degrees / 45);
// Return // Return
return AsciiCompassDirection.values()[ordinal]; return AsciiCompassDirection.values()[ordinal];

View File

@ -24,11 +24,11 @@ public class MiscUtil
return values; return values;
} }
public static HashSet<String> substanceChars = new HashSet<String>(Arrays.asList(new String []{ public static HashSet<String> 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", "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", "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", "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" "s", "t", "u", "v", "w", "x", "y", "z"
})); }));
public static String getComparisonString(String str) public static String getComparisonString(String str)

View File

@ -18,7 +18,7 @@ import java.util.UUID;
public class VisualizeUtil public class VisualizeUtil
{ {
protected static Map<UUID, Set<Location>> playerLocations = new HashMap<UUID, Set<Location>>(); protected static Map<UUID, Set<Location>> playerLocations = new HashMap<>();
public static Set<Location> getPlayerLocations(Player player) public static Set<Location> getPlayerLocations(Player player)
{ {
return getPlayerLocations(player.getUniqueId()); return getPlayerLocations(player.getUniqueId());
@ -28,7 +28,7 @@ public class VisualizeUtil
Set<Location> ret = playerLocations.get(uuid); Set<Location> ret = playerLocations.get(uuid);
if (ret == null) if (ret == null)
{ {
ret = new HashSet<Location>(); ret = new HashSet<>();
playerLocations.put(uuid, ret); playerLocations.put(uuid, ret);
} }
return ret; return ret;