Fix for getUsedOrCommandException

This commit is contained in:
BuildTools 2016-01-08 16:30:00 +01:00 committed by Olof Larsson
parent 6746824e34
commit 246d9c1a44

View File

@ -99,16 +99,24 @@ public class EditSettings<O>
// No nice constructors for TreeSet :( // No nice constructors for TreeSet :(
public static final Set<String> ALIASES_USED = MUtil.treeset("used", "selected", "chosen"); public static final Set<String> ALIASES_USED = MUtil.treeset("used", "selected", "chosen");
public O getUsedOrCommandException(CommandSender sender, String arg) throws MassiveException public O getUsedOrCommandException(String arg, CommandSender sender) throws MassiveException
{ {
if (arg == null || ALIASES_USED.contains(arg)) if (arg == null)
{ {
O ret = this.getUsed(sender); O ret = this.getUsed(sender);
if (ret != null) return ret; if (ret != null) return ret;
}
String noun = this.getObjectType().getTypeName(); String noun = this.getObjectType().getTypeName();
String aan = Txt.aan(noun); String aan = Txt.aan(noun);
throw new MassiveException().addMsg("<b>You must select %s %s for use to skip the optional argument.", aan, noun); throw new MassiveException().addMsg("<b>You must select %s %s for use to skip the optional argument.", aan, noun);
} }
if (ALIASES_USED.contains(arg))
{
O ret = this.getUsed(sender);
if (ret == null) throw new MassiveException().addMsg("<b>You have no selected %s.", this.getObjectType().getTypeName() );
return ret;
}
return null;
}
} }