Fix for getUsedOrCommandException
This commit is contained in:
parent
6746824e34
commit
246d9c1a44
@ -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 aan = Txt.aan(noun);
|
||||||
|
throw new MassiveException().addMsg("<b>You must select %s %s for use to skip the optional argument.", aan, noun);
|
||||||
}
|
}
|
||||||
String noun = this.getObjectType().getTypeName();
|
if (ALIASES_USED.contains(arg))
|
||||||
String aan = Txt.aan(noun);
|
{
|
||||||
throw new MassiveException().addMsg("<b>You must select %s %s for use to skip the optional argument.", aan, noun);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user