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){
} sender.sendMessage("Please specify the name of the dimension you are in");
case 1: { return true;
sender.sendMessage("Please specify the name of the dimension you are in"); } else if (args.length == 2){
return true; sender.sendMessage("No width and height specified. Taking defaults (5 and 5)");
} width = 5;
case 2: { height = 5;
sender.sendMessage("No width and height specified. Taking defaults (5 and 5)"); } else if (args.length == 3){
return true; sender.sendMessage("No height specified, taking width as height");
} width = Integer.parseInt(args[2]);
case 3: { height = Integer.parseInt(args[2]);
} else if (args.length == 4){
width = Integer.parseInt(args[2]);
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]);
} } else {
case 4: {
if (!args[3].equalsIgnoreCase("-3d")) {
sender.sendMessage("No height specified, taking width as height");
width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[2]);
return true;
} else {
width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[3]);
break;
}
}
case 5: {
width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[3]); height = Integer.parseInt(args[3]);
d3 = true;
}
default: {
width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[3]);
break;
} }
} else if (args[3].equalsIgnoreCase("-3d")){
width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[3]);
d3 = true;
} else {
width = Integer.parseInt(args[2]);
height = Integer.parseInt(args[3]);
} }
sender.sendMessage("Creating new Structure"); sender.sendMessage("Creating new Structure");