Further code cleanup

This commit is contained in:
Magnus Ulf 2019-05-06 11:08:28 +02:00
parent 51135db452
commit a6af3c69c8
11 changed files with 11 additions and 22 deletions

View File

@ -6,12 +6,9 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.Board;
import com.massivecraft.massivecore.ps.PS;
import java.lang.reflect.Type;
import java.util.Map;
public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Board>
{
@ -30,7 +27,7 @@ public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Boa
@Override
public Board deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
return new Board((Map<PS, TerritoryAccess>) context.deserialize(json, Board.MAP_TYPE));
return new Board(context.deserialize(json, Board.MAP_TYPE));
}
@Override

View File

@ -12,7 +12,7 @@ public abstract class ChatTag extends ChatActive
// -------------------------------------------- //
private final static Map<String, ChatTag> idToTag = new MassiveMap<>();
public static ChatTag getTag(String tagId) { return (ChatTag) idToTag.get(tagId); }
public static ChatTag getTag(String tagId) { return idToTag.get(tagId); }
// -------------------------------------------- //
// CONSTRUCT

View File

@ -47,7 +47,7 @@ public class CmdFactionsAccessInspect extends FactionsCommand
String factionId = faction.getId();
// Check if they have access perms, unless they are checking for their own access
if (mpermable != msender && mpermable != msenderFaction && mpermable != msender.getRank());
if (mpermable != msender && mpermable != msenderFaction && mpermable != msender.getRank())
{
if ( ! MPerm.getPermAccess().has(msender, faction, true)) return;
}

View File

@ -13,7 +13,6 @@ import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.cmd.type;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer;
@ -28,8 +27,7 @@ public class TypeFactionNameAbstract extends TypeNameAbstract
public Named getCurrent(CommandSender sender)
{
MPlayer mplayer = MPlayer.get(sender);
Faction faction = mplayer.getFaction();
return faction;
return mplayer.getFaction();
}
@Override

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.cmd.type;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MPerm;

View File

@ -19,7 +19,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;

View File

@ -55,8 +55,7 @@ public class Rank extends EntityInternal<Rank> implements MPerm.MPermable
public Faction getFaction()
{
EntityInternalMap<Rank> internalMap = (EntityInternalMap<Rank>) this.getContainer();
Faction faction = (Faction) internalMap.getEntity();
return faction;
return (Faction) internalMap.getEntity();
}
// -------------------------------------------- //

View File

@ -36,7 +36,6 @@ public class EngineV19 extends Engine
// LISTENER
// -------------------------------------------- //
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(AreaEffectCloudApplyEvent event)
{

View File

@ -209,6 +209,7 @@ public class EnumerationUtil
"WITCH", // Minecraft 1.?
"WITHER", // Minecraft 1.?
"WITHER_SKELETON",
"STRAY", // Minecraft 1.?
"ZOMBIE", // Minecraft 1.?
"ZOMBIE_VILLAGER",
"ILLUSIONER", // Minecraft 1.12

View File

@ -24,16 +24,14 @@ public class MiscUtil
return values;
}
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",
public static HashSet<String> substanceChars = new HashSet<>(Arrays.asList("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"
}));
"s", "t", "u", "v", "w", "x", "y", "z"));
public static String getComparisonString(String str)
{
String ret = "";
StringBuilder ret = new StringBuilder();
str = ChatColor.stripColor(str);
str = str.toLowerCase();
@ -42,10 +40,10 @@ public class MiscUtil
{
if (substanceChars.contains(String.valueOf(c)))
{
ret += c;
ret.append(c);
}
}
return ret.toLowerCase();
return ret.toString().toLowerCase();
}
}