IntelliJ Inspection Based Cleanup
This commit is contained in:
parent
60b4472735
commit
bdbc1c79a2
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<String>(names));
|
||||
this.names = Collections.unmodifiableSet(new MassiveSet<>(names));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class TerritoryAccess
|
||||
return valueOf(hostFactionId, with, factionIds, playerIds);
|
||||
}
|
||||
|
||||
Set<String> factionIds = new HashSet<String>(this.getFactionIds());
|
||||
Set<String> 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<String> playerIds = new HashSet<String>(this.getPlayerIds());
|
||||
Set<String> playerIds = new HashSet<>(this.getPlayerIds());
|
||||
if (with)
|
||||
{
|
||||
playerIds.add(playerId);
|
||||
@ -102,7 +102,7 @@ public class TerritoryAccess
|
||||
|
||||
public LinkedHashSet<MPlayer> getGrantedMPlayers()
|
||||
{
|
||||
LinkedHashSet<MPlayer> ret = new LinkedHashSet<MPlayer>();
|
||||
LinkedHashSet<MPlayer> ret = new LinkedHashSet<>();
|
||||
for (String playerId : this.getPlayerIds())
|
||||
{
|
||||
ret.add(MPlayer.get(playerId));
|
||||
@ -112,7 +112,7 @@ public class TerritoryAccess
|
||||
|
||||
public LinkedHashSet<Faction> getGrantedFactions()
|
||||
{
|
||||
LinkedHashSet<Faction> ret = new LinkedHashSet<Faction>();
|
||||
LinkedHashSet<Faction> 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<String> factionIdsInner = new TreeSet<String>();
|
||||
Set<String> factionIdsInner = new TreeSet<>();
|
||||
if (factionIds != null)
|
||||
{
|
||||
factionIdsInner.addAll(factionIds);
|
||||
@ -140,7 +140,7 @@ public class TerritoryAccess
|
||||
}
|
||||
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)
|
||||
{
|
||||
for (String playerId : playerIds)
|
||||
|
@ -31,7 +31,7 @@ public class BoardMapAdapter implements JsonDeserializer<Map<PS, TerritoryAccess
|
||||
@Override
|
||||
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();
|
||||
|
||||
|
@ -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<String> modifierIds = new ArrayList<String>(Arrays.asList(parts));
|
||||
List<String> modifierIds = new ArrayList<>(Arrays.asList(parts));
|
||||
String tagId = modifierIds.remove(0);
|
||||
|
||||
// Fetch tag for the id
|
||||
|
@ -66,7 +66,7 @@ public abstract class CmdFactionsAccessAbstract extends FactionsCommand
|
||||
public static String describeRelationParticipators(Collection<? extends RelationParticipator> relationParticipators, RelationParticipator observer)
|
||||
{
|
||||
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)
|
||||
{
|
||||
descriptions.add(relationParticipator.describeTo(observer));
|
||||
|
@ -53,7 +53,7 @@ public class CmdFactionsFaction extends FactionsCommand
|
||||
MixinMessage.get().messageOne(sender, Txt.titleize("Faction " + faction.getName(msender)));
|
||||
|
||||
// Lines
|
||||
TreeSet<PriorityLines> priorityLiness = new TreeSet<PriorityLines>(event.getIdPriorityLiness().values());
|
||||
TreeSet<PriorityLines> priorityLiness = new TreeSet<>(event.getIdPriorityLiness().values());
|
||||
for (PriorityLines priorityLines : priorityLiness)
|
||||
{
|
||||
MixinMessage.get().messageOne(sender, priorityLines.getLines());
|
||||
|
@ -46,7 +46,8 @@ public class CmdFactionsInviteList extends FactionsCommand
|
||||
|
||||
// Pager Create
|
||||
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)
|
||||
{
|
||||
// TODO: Madus would like to implement this in MPlayer
|
||||
|
@ -33,7 +33,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
|
||||
@Override
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
Set<MPlayer> mplayers = new HashSet<MPlayer>();
|
||||
Set<MPlayer> mplayers = new HashSet<>();
|
||||
boolean all = false;
|
||||
|
||||
// Args
|
||||
@ -123,7 +123,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
|
||||
// Inform Faction if all
|
||||
if (all)
|
||||
{
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<String> names = new ArrayList<>();
|
||||
for (MPlayer mplayer : mplayers)
|
||||
{
|
||||
names.add(mplayer.describeTo(msender, true));
|
||||
|
@ -45,7 +45,7 @@ public class CmdFactionsName extends FactionsCommand
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
ArrayList<String> errors = new ArrayList<>();
|
||||
errors.addAll(FactionColl.get().validateName(newName));
|
||||
if (errors.size() > 0)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public class CmdFactionsPermList extends FactionsCommand
|
||||
int page = this.readArg();
|
||||
|
||||
// Create messages
|
||||
List<String> messages = new ArrayList<String>();
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
for (MPerm perm : MPerm.getAll())
|
||||
{
|
||||
|
@ -284,7 +284,7 @@ public class CmdFactionsRank extends FactionsCommand
|
||||
endFaction.setInvited(target, false);
|
||||
|
||||
// Create recipients
|
||||
Set<MPlayer> recipients = new HashSet<MPlayer>();
|
||||
Set<MPlayer> 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<MPlayer> recipients = new HashSet<MPlayer>();
|
||||
Set<MPlayer> recipients = new HashSet<>();
|
||||
recipients.addAll(targetFaction.getMPlayers());
|
||||
recipients.add(msender);
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class CmdFactionsRelationList extends FactionsCommand
|
||||
// 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>: ");
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -54,7 +54,7 @@ public class CmdFactionsRelationList extends FactionsCommand
|
||||
final Set<Rel> relations = this.readArg(RELEVANT_RELATIONS);
|
||||
|
||||
// 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
|
||||
public String toString(String item, int index)
|
||||
|
@ -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("<i>This will have no effect while your faction is peaceful.");
|
||||
|
@ -43,7 +43,7 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius
|
||||
{
|
||||
// Common Startup
|
||||
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
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple
|
||||
{
|
||||
// Common Startup
|
||||
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?
|
||||
// NOTE: Wilderness/None is valid.
|
||||
@ -81,7 +81,7 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple
|
||||
if (color == null) throw new NullPointerException("color");
|
||||
|
||||
// Expand
|
||||
Set<PS> expansion = new LinkedHashSet<PS>();
|
||||
Set<PS> expansion = new LinkedHashSet<>();
|
||||
for (PS chunk : set)
|
||||
{
|
||||
Set<PS> neighbours = MUtil.set(
|
||||
|
@ -43,7 +43,7 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius
|
||||
{
|
||||
// Common Startup
|
||||
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
|
||||
|
||||
|
@ -54,7 +54,8 @@ public class CmdFactionsStatus extends FactionsCommand
|
||||
|
||||
// Pager Create
|
||||
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
|
||||
public String toString(MPlayer mplayer, int index)
|
||||
{
|
||||
@ -86,7 +87,7 @@ public class CmdFactionsStatus extends FactionsCommand
|
||||
{
|
||||
color = "<red>";
|
||||
}
|
||||
|
||||
|
||||
String power = Txt.parse("<art>Power: %s%.0f<gray>/<green>%.0f", Txt.parse(color), currentPower, maxPower);
|
||||
|
||||
// Time
|
||||
|
@ -122,7 +122,7 @@ public class CmdFactionsUnstuck extends FactionsCommand
|
||||
public static List<PS> getChunkSpiral(PS center)
|
||||
{
|
||||
// Create Ret
|
||||
List<PS> ret = new ArrayList<PS>();
|
||||
List<PS> ret = new ArrayList<>();
|
||||
|
||||
// Fill Ret
|
||||
center = center.getChunk(true);
|
||||
|
@ -79,7 +79,7 @@ public class TypeFaction extends TypeAbstract<Faction>
|
||||
public Collection<String> getTabList(CommandSender sender, String arg)
|
||||
{
|
||||
// Create
|
||||
Set<String> ret = new TreeSet<String>(ComparatorCaseInsensitive.get());
|
||||
Set<String> ret = new TreeSet<>(ComparatorCaseInsensitive.get());
|
||||
|
||||
// Fill
|
||||
for (Faction faction : FactionColl.get().getAll())
|
||||
|
@ -18,14 +18,14 @@ public class TypeRank extends TypeEnum<Rel>
|
||||
// CONSTANTS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static final Set<String> NAMES_PROMOTE = new MassiveSet<String>(
|
||||
public static final Set<String> NAMES_PROMOTE = new MassiveSet<>(
|
||||
"Promote",
|
||||
"+",
|
||||
"Plus",
|
||||
"Up"
|
||||
);
|
||||
|
||||
public static final Set<String> NAMES_DEMOTE = new MassiveSet<String>(
|
||||
public static final Set<String> NAMES_DEMOTE = new MassiveSet<>(
|
||||
"Demote",
|
||||
"-",
|
||||
"Minus",
|
||||
@ -101,7 +101,7 @@ public class TypeRank extends TypeEnum<Rel>
|
||||
public Set<String> getNamesInner(Rel value)
|
||||
{
|
||||
// Create
|
||||
Set<String> ret = new MassiveSet<String>();
|
||||
Set<String> ret = new MassiveSet<>();
|
||||
|
||||
// Fill Exact
|
||||
ret.addAll(value.getNames());
|
||||
|
@ -12,6 +12,5 @@ public enum DisallowCause
|
||||
OWN_TERRITORY
|
||||
|
||||
// END OF LIST
|
||||
;
|
||||
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class EngineEcon extends Engine
|
||||
public void payForAction(EventFactionsChunksChange event)
|
||||
{
|
||||
double cost = 0;
|
||||
List<String> typeNames = new ArrayList<String>();
|
||||
List<String> typeNames = new ArrayList<>();
|
||||
|
||||
for (Entry<EventFactionsChunkChangeType, Set<PS>> typeChunks : event.getTypeChunks().entrySet())
|
||||
{
|
||||
|
@ -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<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, 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<UUID, List<Block>> portalTraps = new HashMap<UUID, List<Block>>();
|
||||
private HashMap<UUID, List<Block>> portalTraps = new HashMap<>();
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void portalTrapRemoveAnimation(PlayerTeleportEvent event)
|
||||
|
@ -79,7 +79,7 @@ public class EngineFlagExplosion extends Engine
|
||||
// Current allowed
|
||||
Boolean allowed = true;
|
||||
// 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 ...
|
||||
Location location = event.getLocation();
|
||||
|
@ -112,7 +112,7 @@ public class EngineSeeChunk extends Engine
|
||||
if (step >= steps) throw new InvalidParameterException("step must be less than steps");
|
||||
|
||||
// Create Ret
|
||||
List<Location> ret = new ArrayList<Location>();
|
||||
List<Location> ret = new ArrayList<>();
|
||||
|
||||
final Location location = player.getLocation();
|
||||
final World world = location.getWorld();
|
||||
|
@ -72,7 +72,7 @@ public class EngineShow extends Engine
|
||||
|
||||
// FLAGS
|
||||
// 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())
|
||||
{
|
||||
final MFlag mflag = entry.getKey();
|
||||
@ -103,7 +103,7 @@ public class EngineShow extends Engine
|
||||
if (Econ.isEnabled())
|
||||
{
|
||||
// LANDVALUES
|
||||
List<String> landvalueLines = new LinkedList<String>();
|
||||
List<String> landvalueLines = new LinkedList<>();
|
||||
long landCount = faction.getLandCount();
|
||||
for (EventFactionsChunkChangeType type : EventFactionsChunkChangeType.values())
|
||||
{
|
||||
@ -137,10 +137,10 @@ public class EngineShow extends Engine
|
||||
}
|
||||
|
||||
// FOLLOWERS
|
||||
List<String> followerLines = new ArrayList<String>();
|
||||
List<String> followerLines = new ArrayList<>();
|
||||
|
||||
List<String> followerNamesOnline = new ArrayList<String>();
|
||||
List<String> followerNamesOffline = new ArrayList<String>();
|
||||
List<String> followerNamesOnline = new ArrayList<>();
|
||||
List<String> followerNamesOffline = new ArrayList<>();
|
||||
|
||||
List<MPlayer> followers = faction.getMPlayers();
|
||||
Collections.sort(followers, PlayerRoleComparator.get());
|
||||
@ -201,7 +201,7 @@ public class EngineShow extends Engine
|
||||
|
||||
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();
|
||||
int count = 0;
|
||||
|
@ -72,12 +72,12 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
|
||||
public Board()
|
||||
{
|
||||
this.map = new ConcurrentSkipListMap<PS, TerritoryAccess>();
|
||||
this.map = new ConcurrentSkipListMap<>();
|
||||
}
|
||||
|
||||
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
|
||||
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())
|
||||
{
|
||||
TerritoryAccess ta = entry.getValue();
|
||||
@ -202,7 +202,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
@Override
|
||||
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())
|
||||
{
|
||||
@ -215,7 +215,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
Set<PS> chunks = ret.get(faction);
|
||||
if (chunks == null)
|
||||
{
|
||||
chunks = new MassiveSet<PS>();
|
||||
chunks = new MassiveSet<>();
|
||||
ret.put(faction, chunks);
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
@Override
|
||||
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())
|
||||
{
|
||||
@ -388,7 +388,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
// Make room for the list of names
|
||||
height--;
|
||||
|
||||
Map<Faction, Character> fList = new HashMap<Faction, Character>();
|
||||
Map<Faction, Character> fList = new HashMap<>();
|
||||
int chrIdx = 0;
|
||||
boolean overflown = false;
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
|
||||
public Set<PS> getChunks(Faction faction)
|
||||
{
|
||||
// Create
|
||||
Set<PS> ret = new HashSet<PS>();
|
||||
Set<PS> ret = new HashSet<>();
|
||||
|
||||
// Fill
|
||||
for (Board board : this.getAll())
|
||||
@ -148,7 +148,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
|
||||
public Set<PS> getChunks(String factionId)
|
||||
{
|
||||
// Create
|
||||
Set<PS> ret = new HashSet<PS>();
|
||||
Set<PS> ret = new HashSet<>();
|
||||
|
||||
// Fill
|
||||
for (Board board : this.getAll())
|
||||
@ -194,7 +194,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
|
||||
}
|
||||
|
||||
// Enforce create
|
||||
if (ret == null) ret = new MassiveMap<Faction, Set<PS>>();
|
||||
if (ret == null) ret = new MassiveMap<>();
|
||||
|
||||
// Return
|
||||
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;
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
|
||||
psChunk = psChunk.getChunk(true);
|
||||
|
||||
// Create
|
||||
Set<PS> ret = new LinkedHashSet<PS>();
|
||||
Set<PS> ret = new LinkedHashSet<>();
|
||||
if (distance < 0) return ret;
|
||||
|
||||
// Fill
|
||||
@ -391,7 +391,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
|
||||
if (chunks == null) throw new NullPointerException("chunks");
|
||||
|
||||
// Create
|
||||
Set<PS> ret = new LinkedHashSet<PS>();
|
||||
Set<PS> ret = new LinkedHashSet<>();
|
||||
|
||||
if (distance < 0) return ret;
|
||||
|
||||
@ -411,7 +411,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
|
||||
if (chunks == null) throw new NullPointerException("chunks");
|
||||
|
||||
// Create
|
||||
Set<Faction> ret = new LinkedHashSet<Faction>();
|
||||
Set<Faction> ret = new LinkedHashSet<>();
|
||||
|
||||
// Fill
|
||||
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)
|
||||
{
|
||||
// Create
|
||||
Map<PS, Faction> ret = new LinkedHashMap<PS, Faction>();
|
||||
Map<PS, Faction> ret = new LinkedHashMap<>();
|
||||
|
||||
// Fill
|
||||
Faction none = FactionColl.get().getNone();
|
||||
|
@ -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<PS> getChunks(Faction faction);
|
||||
public Set<PS> getChunks(String factionId);
|
||||
public Map<Faction, Set<PS>> getFactionToChunks();
|
||||
Set<PS> getChunks(Faction faction);
|
||||
Set<PS> getChunks(String factionId);
|
||||
Map<Faction, Set<PS>> getFactionToChunks();
|
||||
|
||||
// COUNT
|
||||
public int getCount(Faction faction);
|
||||
public int getCount(String factionId);
|
||||
public Map<Faction, Integer> getFactionToCount();
|
||||
int getCount(Faction faction);
|
||||
int getCount(String factionId);
|
||||
Map<Faction, Integer> 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<PS> pss);
|
||||
public boolean isConnectedPs(PS ps, Faction faction);
|
||||
public boolean isAnyConnectedPs(Set<PS> pss, Faction faction);
|
||||
boolean isBorderPs(PS ps);
|
||||
boolean isAnyBorderPs(Set<PS> pss);
|
||||
boolean isConnectedPs(PS ps, Faction faction);
|
||||
boolean isAnyConnectedPs(Set<PS> pss, Faction faction);
|
||||
|
||||
// MAP
|
||||
// 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);
|
||||
|
||||
}
|
||||
|
@ -140,19 +140,19 @@ public class Faction extends Entity<Faction> 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<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.
|
||||
// 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.
|
||||
// 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.
|
||||
// Null means default.
|
||||
private MassiveMapDef<String, Set<Rel>> perms = new MassiveMapDef<String, Set<Rel>>();
|
||||
private MassiveMapDef<String, Set<Rel>> perms = new MassiveMapDef<>();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELD: id
|
||||
@ -465,7 +465,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
public void setInvitedPlayerIds(Collection<String> invitedPlayerIds)
|
||||
{
|
||||
// Clean input
|
||||
MassiveTreeSetDef<String, ComparatorCaseInsensitive> target = new MassiveTreeSetDef<String, ComparatorCaseInsensitive>(ComparatorCaseInsensitive.get());
|
||||
MassiveTreeSetDef<String, ComparatorCaseInsensitive> target = new MassiveTreeSetDef<>(ComparatorCaseInsensitive.get());
|
||||
if (invitedPlayerIds != null)
|
||||
{
|
||||
for (String invitedPlayerId : invitedPlayerIds)
|
||||
@ -498,7 +498,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
|
||||
public boolean setInvited(String playerId, boolean invited)
|
||||
{
|
||||
List<String> invitedPlayerIds = new ArrayList<String>(this.getInvitedPlayerIds());
|
||||
List<String> invitedPlayerIds = new ArrayList<>(this.getInvitedPlayerIds());
|
||||
boolean ret;
|
||||
if (invited)
|
||||
{
|
||||
@ -520,7 +520,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
|
||||
public List<MPlayer> getInvitedMPlayers()
|
||||
{
|
||||
List<MPlayer> mplayers = new ArrayList<MPlayer>();
|
||||
List<MPlayer> mplayers = new ArrayList<>();
|
||||
|
||||
for (String id : this.getInvitedPlayerIds())
|
||||
{
|
||||
@ -544,7 +544,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
public void setRelationWishes(Map<String, Rel> relationWishes)
|
||||
{
|
||||
// Clean input
|
||||
MassiveMapDef<String, Rel> target = new MassiveMapDef<String, Rel>(relationWishes);
|
||||
MassiveMapDef<String, Rel> target = new MassiveMapDef<>(relationWishes);
|
||||
|
||||
// Detect Nochange
|
||||
if (MUtil.equals(this.relationWishes, target)) return;
|
||||
@ -598,7 +598,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
public Map<MFlag, Boolean> getFlags()
|
||||
{
|
||||
// We start with default values ...
|
||||
Map<MFlag, Boolean> ret = new LinkedHashMap<MFlag, Boolean>();
|
||||
Map<MFlag, Boolean> ret = new LinkedHashMap<>();
|
||||
for (MFlag mflag : MFlag.getAll())
|
||||
{
|
||||
ret.put(mflag, mflag.isStandard());
|
||||
@ -632,7 +632,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
|
||||
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())
|
||||
{
|
||||
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)
|
||||
{
|
||||
// Clean input
|
||||
MassiveMapDef<String, Boolean> target = new MassiveMapDef<String, Boolean>();
|
||||
MassiveMapDef<String, Boolean> target = new MassiveMapDef<>();
|
||||
for (Entry<String, Boolean> entry : flagIds.entrySet())
|
||||
{
|
||||
String key = entry.getKey();
|
||||
@ -660,7 +660,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
if (MUtil.equals(this.flags, target)) return;
|
||||
|
||||
// Apply
|
||||
this.flags = new MassiveMapDef<String, Boolean>(target);
|
||||
this.flags = new MassiveMapDef<>(target);
|
||||
|
||||
// Mark as changed
|
||||
this.changed();
|
||||
@ -724,10 +724,10 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
public Map<MPerm, Set<Rel>> getPerms()
|
||||
{
|
||||
// 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())
|
||||
{
|
||||
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 ...
|
||||
@ -749,7 +749,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
MPerm mperm = MPerm.get(id);
|
||||
if (mperm == null) continue;
|
||||
|
||||
ret.put(mperm, new LinkedHashSet<Rel>(entry.getValue()));
|
||||
ret.put(mperm, new LinkedHashSet<>(entry.getValue()));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -757,7 +757,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
|
||||
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())
|
||||
{
|
||||
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)
|
||||
{
|
||||
// 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())
|
||||
{
|
||||
String key = entry.getKey();
|
||||
@ -866,7 +866,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
|
||||
public void setPermittedRelations(MPerm perm, Rel... rels)
|
||||
{
|
||||
Set<Rel> temp = new HashSet<Rel>();
|
||||
Set<Rel> temp = new HashSet<>();
|
||||
temp.addAll(Arrays.asList(rels));
|
||||
this.setPermittedRelations(perm, temp);
|
||||
}
|
||||
@ -1008,7 +1008,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
// FOREIGN KEY: MPLAYER
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected transient Set<MPlayer> mplayers = new MassiveSet<MPlayer>();
|
||||
protected transient Set<MPlayer> mplayers = new MassiveSet<>();
|
||||
|
||||
public void reindexMPlayers()
|
||||
{
|
||||
@ -1045,7 +1045,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
public List<MPlayer> getMPlayers()
|
||||
{
|
||||
this.checkMPlayerIndex();
|
||||
return new ArrayList<MPlayer>(this.mplayers);
|
||||
return new ArrayList<>(this.mplayers);
|
||||
}
|
||||
|
||||
public List<MPlayer> getMPlayersWhere(Predicate<? super MPlayer> predicate)
|
||||
@ -1083,7 +1083,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
public List<CommandSender> getOnlineCommandSenders()
|
||||
{
|
||||
// Create Ret
|
||||
List<CommandSender> ret = new ArrayList<CommandSender>();
|
||||
List<CommandSender> ret = new ArrayList<>();
|
||||
|
||||
// Fill Ret
|
||||
for (CommandSender sender : IdUtil.getLocalSenders())
|
||||
@ -1103,7 +1103,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
|
||||
public List<Player> getOnlinePlayers()
|
||||
{
|
||||
// Create Ret
|
||||
List<Player> ret = new ArrayList<Player>();
|
||||
List<Player> ret = new ArrayList<>();
|
||||
|
||||
// Fill Ret
|
||||
for (Player player : MUtil.getOnlinePlayers())
|
||||
|
@ -246,7 +246,7 @@ public class FactionColl extends Coll<Faction>
|
||||
public ArrayList<String> validateName(String str)
|
||||
{
|
||||
// Create
|
||||
ArrayList<String> errors = new ArrayList<String>();
|
||||
ArrayList<String> errors = new ArrayList<>();
|
||||
|
||||
// Fill
|
||||
// Check minimum length
|
||||
@ -295,7 +295,7 @@ public class FactionColl extends Coll<Faction>
|
||||
public Map<Rel, List<String>> getRelationNames(Faction faction, Set<Rel> rels)
|
||||
{
|
||||
// Create
|
||||
Map<Rel, List<String>> ret = new LinkedHashMap<Rel, List<String>>();
|
||||
Map<Rel, List<String>> ret = new LinkedHashMap<>();
|
||||
MFlag flagPeaceful = MFlag.getFlagPeaceful();
|
||||
boolean peaceful = faction.getFlag(flagPeaceful);
|
||||
for (Rel rel : rels)
|
||||
|
@ -79,7 +79,7 @@ public class MConf extends Entity<MConf>
|
||||
// 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<String> playersWhoBypassAllProtection = new LinkedHashSet<String>();
|
||||
public Set<String> playersWhoBypassAllProtection = new LinkedHashSet<>();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// TASKS
|
||||
@ -337,7 +337,7 @@ public class MConf extends Entity<MConf>
|
||||
|
||||
// A list of commands to block for members of permanent factions.
|
||||
// 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.
|
||||
// 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.
|
||||
|
||||
// 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_ON", // 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.
|
||||
// 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.?
|
||||
"FLINT_AND_STEEL", // 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
|
||||
// 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.?
|
||||
"SIGN_POST", // 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.
|
||||
public BackstringSet<Material> materialsDoor = new BackstringSet<Material>(Material.class,
|
||||
public BackstringSet<Material> 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<MConf>
|
||||
);
|
||||
|
||||
// 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.?
|
||||
"CHEST", // Minecraft 1.?
|
||||
"FURNACE", // Minecraft 1.?
|
||||
@ -624,26 +624,26 @@ public class MConf extends Entity<MConf>
|
||||
);
|
||||
|
||||
// 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.?
|
||||
"ARMOR_STAND" // Minecraft 1.8
|
||||
);
|
||||
|
||||
// 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.?
|
||||
"ARMOR_STAND", // Minecraft 1.8
|
||||
"ENDER_CRYSTAL" // Minecraft 1.10
|
||||
);
|
||||
|
||||
// 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_HOPPER" // Minecraft 1.?
|
||||
);
|
||||
|
||||
// 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.?
|
||||
"CAVE_SPIDER", // Minecraft 1.?
|
||||
"CREEPER", // Minecraft 1.?
|
||||
@ -675,7 +675,7 @@ public class MConf extends Entity<MConf>
|
||||
);
|
||||
|
||||
// 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.?
|
||||
"CHICKEN", // Minecraft 1.?
|
||||
"COW", // Minecraft 1.?
|
||||
@ -714,7 +714,7 @@ public class MConf extends Entity<MConf>
|
||||
public boolean herochatFactionIsShortcutAllowed = false;
|
||||
public boolean herochatFactionCrossWorld = true;
|
||||
public boolean herochatFactionMuted = false;
|
||||
public Set<String> herochatFactionWorlds = new HashSet<String>();
|
||||
public Set<String> herochatFactionWorlds = new HashSet<>();
|
||||
|
||||
// The Allies Channel
|
||||
public String herochatAlliesName = "Allies";
|
||||
@ -725,7 +725,7 @@ public class MConf extends Entity<MConf>
|
||||
public boolean herochatAlliesIsShortcutAllowed = false;
|
||||
public boolean herochatAlliesCrossWorld = true;
|
||||
public boolean herochatAlliesMuted = false;
|
||||
public Set<String> herochatAlliesWorlds = new HashSet<String>();
|
||||
public Set<String> herochatAlliesWorlds = new HashSet<>();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: LWC
|
||||
|
@ -47,7 +47,7 @@ public class MFlagColl extends Coll<MFlag>
|
||||
public List<MFlag> getAll(boolean registered)
|
||||
{
|
||||
// Create
|
||||
List<MFlag> ret = new ArrayList<MFlag>();
|
||||
List<MFlag> ret = new ArrayList<>();
|
||||
|
||||
// Fill
|
||||
for (MFlag mflag : this.getAll())
|
||||
|
@ -231,7 +231,7 @@ public class MPerm extends Entity<MPerm> 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<Rel> standard = new LinkedHashSet<Rel>();
|
||||
private Set<Rel> standard = new LinkedHashSet<>();
|
||||
public Set<Rel> getStandard() { return this.standard; }
|
||||
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)
|
||||
{
|
||||
List<String> parts = new ArrayList<String>();
|
||||
List<String> parts = new ArrayList<>();
|
||||
|
||||
if (withName)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ public class MPermColl extends Coll<MPerm>
|
||||
public List<MPerm> getAll(boolean registered)
|
||||
{
|
||||
// Create
|
||||
List<MPerm> ret = new ArrayList<MPerm>();
|
||||
List<MPerm> ret = new ArrayList<>();
|
||||
|
||||
// Fill
|
||||
for (MPerm mperm : this.getAll())
|
||||
|
@ -925,7 +925,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements FactionsParticipat
|
||||
|
||||
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);
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class EventFactionsChunksChange extends EventFactionsAbstractSender
|
||||
MPlayer msender = this.getMPlayer();
|
||||
Faction self = null;
|
||||
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())
|
||||
{
|
||||
PS chunk = entry.getKey();
|
||||
|
@ -21,7 +21,7 @@ public class EventFactionsExpansions extends EventFactionsAbstractSender
|
||||
// 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; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -36,7 +36,7 @@ public class EventFactionsFactionShowAsync extends EventFactionsAbstractSender
|
||||
{
|
||||
super(true, sender);
|
||||
this.faction = faction;
|
||||
this.idPriorityLiness = new HashMap<String, PriorityLines>();
|
||||
this.idPriorityLiness = new HashMap<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<String, Long> causeMillis = new LinkedHashMap<String, Long>();
|
||||
private Map<String, Long> causeMillis = new LinkedHashMap<>();
|
||||
public Map<String, Long> getCauseMillis() { return this.causeMillis; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -160,7 +160,7 @@ public class Econ
|
||||
|
||||
public static Set<MPlayer> getMPlayers(EconomyParticipator ep)
|
||||
{
|
||||
Set<MPlayer> mplayers = new HashSet<MPlayer>();
|
||||
Set<MPlayer> 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<MPlayer> recipients = new HashSet<MPlayer>();
|
||||
Set<MPlayer> recipients = new HashSet<>();
|
||||
recipients.addAll(getMPlayers(invoker));
|
||||
recipients.addAll(getMPlayers(from));
|
||||
recipients.addAll(getMPlayers(to));
|
||||
|
@ -49,7 +49,7 @@ public class EngineV19 extends Engine
|
||||
Entity thrower = (Entity)projectileSource;
|
||||
|
||||
// ... 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 ...
|
||||
for (LivingEntity affectedEntity : event.getAffectedEntities())
|
||||
|
@ -97,7 +97,7 @@ public abstract class ChannelFactionsAbstract implements Channel
|
||||
@Override
|
||||
public Set<Chatter> getMembers()
|
||||
{
|
||||
Set<Chatter> ret = new HashSet<Chatter>();
|
||||
Set<Chatter> 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<Player> recipients = new HashSet<Player>();
|
||||
Set<Player> recipients = new HashSet<>();
|
||||
for (Chatter member : this.getMembers())
|
||||
{
|
||||
recipients.add(member.getPlayer());
|
||||
@ -225,7 +225,7 @@ public abstract class ChannelFactionsAbstract implements Channel
|
||||
|
||||
public Set<Player> getRecipients(Player sender)
|
||||
{
|
||||
Set<Player> ret = new HashSet<Player>();
|
||||
Set<Player> ret = new HashSet<>();
|
||||
|
||||
MPlayer fsender = MPlayer.get(sender);
|
||||
Faction faction = fsender.getFaction();
|
||||
|
@ -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<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 boolean isShortcutAllowed() { return MConf.get().herochatFactionIsShortcutAllowed; }
|
||||
|
@ -128,7 +128,7 @@ public class EngineWorldGuard extends Engine
|
||||
ProtectedCuboidRegion region = new ProtectedCuboidRegion(regionName, minChunk, maxChunk);
|
||||
|
||||
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
|
||||
List<ProtectedRegion> overlapRegions = region.getIntersectingRegions(regionList);
|
||||
|
@ -113,7 +113,7 @@ public class UpdateUtil
|
||||
|
||||
public static List<String> getUniverses()
|
||||
{
|
||||
List<String> ret = new ArrayList<String>();
|
||||
List<String> ret = new ArrayList<>();
|
||||
|
||||
for (String collname : MStore.getDb().getCollnames())
|
||||
{
|
||||
@ -232,7 +232,7 @@ public class UpdateUtil
|
||||
// Before and After
|
||||
Set<String> before = entity.factionIds;
|
||||
if (before == null) return false;
|
||||
Set<String> after = new LinkedHashSet<String>();
|
||||
Set<String> after = new LinkedHashSet<>();
|
||||
for (String id : before)
|
||||
{
|
||||
if (id == null) continue;
|
||||
|
@ -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];
|
||||
|
@ -24,11 +24,11 @@ public class MiscUtil
|
||||
return values;
|
||||
}
|
||||
|
||||
public static HashSet<String> substanceChars = new HashSet<String>(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<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",
|
||||
"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)
|
||||
|
@ -18,7 +18,7 @@ import java.util.UUID;
|
||||
|
||||
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)
|
||||
{
|
||||
return getPlayerLocations(player.getUniqueId());
|
||||
@ -28,7 +28,7 @@ public class VisualizeUtil
|
||||
Set<Location> ret = playerLocations.get(uuid);
|
||||
if (ret == null)
|
||||
{
|
||||
ret = new HashSet<Location>();
|
||||
ret = new HashSet<>();
|
||||
playerLocations.put(uuid, ret);
|
||||
}
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user