Small code Cleanup
This commit is contained in:
parent
332945095e
commit
bb38cea1bb
4 changed files with 3 additions and 46 deletions
|
@ -7,29 +7,4 @@ public enum Status {
|
|||
MALFUNCTION, ACTIVE,
|
||||
INACTIVE, GLOBAL;
|
||||
|
||||
public static Status getStatus(String string) {
|
||||
if(string == null)
|
||||
return null;
|
||||
|
||||
string = string.toUpperCase();
|
||||
switch(string) {
|
||||
case "CONSTRUCTION":
|
||||
return Status.CONSTRUCTION;
|
||||
case "OPEN":
|
||||
return Status.OPEN;
|
||||
case "CLOSED":
|
||||
return Status.CLOSED;
|
||||
case "MAINTENANCE":
|
||||
return Status.MAINTENANCE;
|
||||
case "MALFUNCTION":
|
||||
return Status.MALFUNCTION;
|
||||
case "ACTIVE":
|
||||
return Status.ACTIVE;
|
||||
case "INACTIVE":
|
||||
return Status.INACTIVE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,22 +38,4 @@ public enum Type {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static Type getType(String string) {
|
||||
if(string == null)
|
||||
return null;
|
||||
|
||||
string = string.toUpperCase();
|
||||
switch(string) {
|
||||
case "RIDE":
|
||||
return Type.RIDE;
|
||||
case "SHOW":
|
||||
return Type.SHOW;
|
||||
case "GLOBAL":
|
||||
return Type.GLOBAL;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -131,8 +131,8 @@ public class AttractionMenu {
|
|||
|
||||
String name = config.getConfig().getString("attraction." + id + ".name");
|
||||
Location location = LocationUtils.toLocation(config.getConfig().getString("attraction." + id + ".location"));
|
||||
Type type = Type.getType(config.getConfig().getString("attraction." + id + ".type"));
|
||||
Status status = Status.getStatus(config.getConfig().getString("attraction." + id + ".status"));
|
||||
Type type = Type.valueOf(config.getConfig().getString("attraction." + id + ".type"));
|
||||
Status status = Status.valueOf(config.getConfig().getString("attraction." + id + ".status"));
|
||||
if(!type.containsStatus(status)) {
|
||||
status = type.getDefault();
|
||||
config.getConfig().set("attraction." + id + ".status", type.getDefault().toString());
|
||||
|
|
|
@ -308,7 +308,7 @@ public class ThemeParkCommand extends BukkitCommand {
|
|||
return true;
|
||||
}
|
||||
|
||||
Status status = Status.getStatus(args[2]);
|
||||
Status status = Status.valueOf(args[2]);
|
||||
if (status == null) {
|
||||
String message = Message.getMessage("status.not");
|
||||
message = message.replace("{status}", args[2]);
|
||||
|
|
Reference in a new issue