Simple null check

This commit is contained in:
CocoTheOwner 2021-08-19 09:54:21 +02:00
parent 5a236e3bea
commit 11d0274a1b

View File

@ -136,23 +136,14 @@ public class DecIris implements DecreeExecutor {
@Decree(description = "Toggle debug") @Decree(description = "Toggle debug")
public void debug( public void debug(
@Param(name = "on", description = "Whether or not debug should be on", defaultValue = "toggle") @Param(description = "Whether or not debug should be on", defaultValue = "toggle")
String on Boolean on
) { ) {
Boolean val; if (on == null){
if (on.equals("toggle") || on.equals("t")) { on = !IrisSettings.get().getGeneral().isDebug();
val = !IrisSettings.get().getGeneral().isDebug();
} else {
try {
val = (Boolean) DecreeSystem.getHandler(boolean.class).parse(on);
} catch (Throwable e){
sender().sendMessage(C.RED + "Failed to convert input: " + on + " to a true or false value");
Iris.reportError(e);
return;
}
} }
sender().sendMessage(C.GREEN + "Set debug to " +val); sender().sendMessage(C.GREEN + "Set debug to " + on);
IrisSettings.get().getGeneral().setDebug(val); IrisSettings.get().getGeneral().setDebug(on);
} }
@Decree(description = "Download a project.", aliases = "dl") @Decree(description = "Download a project.", aliases = "dl")