Further code cleanup
This commit is contained in:
parent
51135db452
commit
a6af3c69c8
@ -6,12 +6,9 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.JsonSerializationContext;
|
import com.google.gson.JsonSerializationContext;
|
||||||
import com.google.gson.JsonSerializer;
|
import com.google.gson.JsonSerializer;
|
||||||
import com.massivecraft.factions.TerritoryAccess;
|
|
||||||
import com.massivecraft.factions.entity.Board;
|
import com.massivecraft.factions.entity.Board;
|
||||||
import com.massivecraft.massivecore.ps.PS;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Board>
|
public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Board>
|
||||||
{
|
{
|
||||||
@ -30,7 +27,7 @@ public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Boa
|
|||||||
@Override
|
@Override
|
||||||
public Board deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
|
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
|
@Override
|
||||||
|
@ -12,7 +12,7 @@ public abstract class ChatTag extends ChatActive
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private final static Map<String, ChatTag> idToTag = new MassiveMap<>();
|
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
|
// CONSTRUCT
|
||||||
|
@ -47,7 +47,7 @@ public class CmdFactionsAccessInspect extends FactionsCommand
|
|||||||
String factionId = faction.getId();
|
String factionId = faction.getId();
|
||||||
|
|
||||||
// Check if they have access perms, unless they are checking for their own access
|
// 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;
|
if ( ! MPerm.getPermAccess().has(msender, faction, true)) return;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import com.massivecraft.massivecore.util.TimeDiffUtil;
|
|||||||
import com.massivecraft.massivecore.util.TimeUnit;
|
import com.massivecraft.massivecore.util.TimeUnit;
|
||||||
import com.massivecraft.massivecore.util.Txt;
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.massivecraft.factions.cmd.type;
|
package com.massivecraft.factions.cmd.type;
|
||||||
|
|
||||||
import com.massivecraft.factions.entity.Faction;
|
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColl;
|
||||||
import com.massivecraft.factions.entity.MConf;
|
import com.massivecraft.factions.entity.MConf;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
@ -28,8 +27,7 @@ public class TypeFactionNameAbstract extends TypeNameAbstract
|
|||||||
public Named getCurrent(CommandSender sender)
|
public Named getCurrent(CommandSender sender)
|
||||||
{
|
{
|
||||||
MPlayer mplayer = MPlayer.get(sender);
|
MPlayer mplayer = MPlayer.get(sender);
|
||||||
Faction faction = mplayer.getFaction();
|
return mplayer.getFaction();
|
||||||
return faction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.massivecraft.factions.cmd.type;
|
package com.massivecraft.factions.cmd.type;
|
||||||
|
|
||||||
import com.massivecraft.factions.Rel;
|
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColl;
|
||||||
import com.massivecraft.factions.entity.MPerm;
|
import com.massivecraft.factions.entity.MPerm;
|
||||||
|
@ -19,7 +19,6 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -55,8 +55,7 @@ public class Rank extends EntityInternal<Rank> implements MPerm.MPermable
|
|||||||
public Faction getFaction()
|
public Faction getFaction()
|
||||||
{
|
{
|
||||||
EntityInternalMap<Rank> internalMap = (EntityInternalMap<Rank>) this.getContainer();
|
EntityInternalMap<Rank> internalMap = (EntityInternalMap<Rank>) this.getContainer();
|
||||||
Faction faction = (Faction) internalMap.getEntity();
|
return (Faction) internalMap.getEntity();
|
||||||
return faction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -36,7 +36,6 @@ public class EngineV19 extends Engine
|
|||||||
// LISTENER
|
// LISTENER
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void canCombatDamageHappen(AreaEffectCloudApplyEvent event)
|
public void canCombatDamageHappen(AreaEffectCloudApplyEvent event)
|
||||||
{
|
{
|
||||||
|
@ -209,6 +209,7 @@ public class EnumerationUtil
|
|||||||
"WITCH", // Minecraft 1.?
|
"WITCH", // Minecraft 1.?
|
||||||
"WITHER", // Minecraft 1.?
|
"WITHER", // Minecraft 1.?
|
||||||
"WITHER_SKELETON",
|
"WITHER_SKELETON",
|
||||||
|
"STRAY", // Minecraft 1.?
|
||||||
"ZOMBIE", // Minecraft 1.?
|
"ZOMBIE", // Minecraft 1.?
|
||||||
"ZOMBIE_VILLAGER",
|
"ZOMBIE_VILLAGER",
|
||||||
"ILLUSIONER", // Minecraft 1.12
|
"ILLUSIONER", // Minecraft 1.12
|
||||||
|
@ -24,16 +24,14 @@ public class MiscUtil
|
|||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashSet<String> substanceChars = new HashSet<>(Arrays.asList(new String[]{
|
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",
|
||||||
"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)
|
||||||
{
|
{
|
||||||
String ret = "";
|
StringBuilder ret = new StringBuilder();
|
||||||
|
|
||||||
str = ChatColor.stripColor(str);
|
str = ChatColor.stripColor(str);
|
||||||
str = str.toLowerCase();
|
str = str.toLowerCase();
|
||||||
@ -42,10 +40,10 @@ public class MiscUtil
|
|||||||
{
|
{
|
||||||
if (substanceChars.contains(String.valueOf(c)))
|
if (substanceChars.contains(String.valueOf(c)))
|
||||||
{
|
{
|
||||||
ret += c;
|
ret.append(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret.toLowerCase();
|
return ret.toString().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user