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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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