Make MassiveCommandToggle more overrideable.

This commit is contained in:
Olof Larsson 2016-08-22 11:42:55 +02:00
parent b0c74b0dd4
commit 25f127e099
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474

View File

@ -33,23 +33,32 @@ public abstract class MassiveCommandToggle extends MassiveCommand
} }
// -------------------------------------------- // // -------------------------------------------- //
// ABSTRACT // VALUE
// -------------------------------------------- // // -------------------------------------------- //
public abstract boolean getValue(); public abstract boolean getValue() throws MassiveException;
public abstract void setValue(boolean value); public abstract void setValue(boolean value) throws MassiveException;
// -------------------------------------------- // // -------------------------------------------- //
// GET NAME // NAME
// -------------------------------------------- // // -------------------------------------------- //
public String getName() public String getName() throws MassiveException
{ {
List<String> aliases = this.getAliases(); List<String> aliases = this.getAliases();
return Txt.upperCaseFirst(aliases.get(aliases.size() - 1)); return Txt.upperCaseFirst(aliases.get(aliases.size() - 1));
} }
// -------------------------------------------- //
// TARGET
// -------------------------------------------- //
public boolean readTarget(boolean before) throws MassiveException
{
return this.readArg(!before);
}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
// -------------------------------------------- // // -------------------------------------------- //
@ -59,7 +68,7 @@ public abstract class MassiveCommandToggle extends MassiveCommand
{ {
// Args // Args
boolean before = this.getValue(); boolean before = this.getValue();
boolean after = this.readArg( ! before); boolean after = this.readTarget(before);
String afterDesc = TypeBooleanOn.get().getVisual(after, sender); String afterDesc = TypeBooleanOn.get().getVisual(after, sender);
// NoChange // NoChange