Update CommandIrisStructureCreate.java

Fuck switch statements
This commit is contained in:
BuildTools 2020-10-23 00:09:13 +02:00
parent c191060b73
commit 61d8f2e1d4

View File

@ -37,46 +37,36 @@ public class CommandIrisStructureCreate extends MortarCommand
int height; int height;
switch (args.length) { if (args.length == 0){
case 0: {
sender.sendMessage("Please specify the name of the object you wish to create"); sender.sendMessage("Please specify the name of the object you wish to create");
return true; return true;
} } else if (args.length == 1){
case 1: {
sender.sendMessage("Please specify the name of the dimension you are in"); sender.sendMessage("Please specify the name of the dimension you are in");
return true; return true;
} } else if (args.length == 2){
case 2: {
sender.sendMessage("No width and height specified. Taking defaults (5 and 5)"); sender.sendMessage("No width and height specified. Taking defaults (5 and 5)");
return true; width = 5;
} height = 5;
case 3: { } else if (args.length == 3){
sender.sendMessage("No height specified, taking width as height"); sender.sendMessage("No height specified, taking width as height");
width = Integer.parseInt(args[2]); width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[2]); height = Integer.parseInt(args[2]);
} } else if (args.length == 4){
case 4: { width = Integer.parseInt(args[2]);
if (!args[3].equalsIgnoreCase("-3d")) { if (!args[3].equalsIgnoreCase("-3d")) {
sender.sendMessage("No height specified, taking width as height"); sender.sendMessage("No height specified, taking width as height");
width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[2]); height = Integer.parseInt(args[2]);
return true;
} else { } else {
width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[3]); height = Integer.parseInt(args[3]);
break;
} }
} } else if (args[3].equalsIgnoreCase("-3d")){
case 5: {
width = Integer.parseInt(args[2]); width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[3]); height = Integer.parseInt(args[3]);
d3 = true; d3 = true;
} } else {
default: {
width = Integer.parseInt(args[2]); width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[3]); height = Integer.parseInt(args[3]);
break;
}
} }
sender.sendMessage("Creating new Structure"); sender.sendMessage("Creating new Structure");