Rework the ARFaction. No best match. Matching is slow and dangerous.
This commit is contained in:
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
@ -50,7 +51,7 @@ public class CmdFactionsMotd extends FactionsCommand
|
||||
target = Txt.parse(target);
|
||||
|
||||
// Removal
|
||||
if (target != null && MUtil.set("", "r", "remove", "d", "delete", "del", "e", "erase", "none", "null", "nothing").contains(target))
|
||||
if (target != null && MassiveCore.NOTHING_REMOVE.contains(target))
|
||||
{
|
||||
target = null;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.cmd.arg.ArgReaderAbstract;
|
||||
import com.massivecraft.massivecore.cmd.arg.ArgResult;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
@ -28,12 +29,22 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
||||
{
|
||||
ArgResult<Faction> result = new ArgResult<Faction>();
|
||||
|
||||
// Faction Name Exact
|
||||
result.setResult(FactionColl.get().getByName(str));
|
||||
if (result.hasResult()) return result;
|
||||
// Nothing/Remove targets Wilderness
|
||||
if (MassiveCore.NOTHING_REMOVE.contains(str))
|
||||
{
|
||||
result.setResult(FactionColl.get().getNone());
|
||||
return result;
|
||||
}
|
||||
|
||||
// Faction Name Match
|
||||
result.setResult(FactionColl.get().getBestNameMatch(str));
|
||||
// Faction Id Exact
|
||||
if (FactionColl.get().containsId(str))
|
||||
{
|
||||
result.setResult(FactionColl.get().get(str));
|
||||
if (result.hasResult()) return result;
|
||||
}
|
||||
|
||||
// Faction Name Exact
|
||||
result.setResult(FactionColl.get().getByName(str));
|
||||
if (result.hasResult()) return result;
|
||||
|
||||
// MPlayer Name Exact
|
||||
|
Reference in New Issue
Block a user