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,
|
MALFUNCTION, ACTIVE,
|
||||||
INACTIVE, GLOBAL;
|
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;
|
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");
|
String name = config.getConfig().getString("attraction." + id + ".name");
|
||||||
Location location = LocationUtils.toLocation(config.getConfig().getString("attraction." + id + ".location"));
|
Location location = LocationUtils.toLocation(config.getConfig().getString("attraction." + id + ".location"));
|
||||||
Type type = Type.getType(config.getConfig().getString("attraction." + id + ".type"));
|
Type type = Type.valueOf(config.getConfig().getString("attraction." + id + ".type"));
|
||||||
Status status = Status.getStatus(config.getConfig().getString("attraction." + id + ".status"));
|
Status status = Status.valueOf(config.getConfig().getString("attraction." + id + ".status"));
|
||||||
if(!type.containsStatus(status)) {
|
if(!type.containsStatus(status)) {
|
||||||
status = type.getDefault();
|
status = type.getDefault();
|
||||||
config.getConfig().set("attraction." + id + ".status", type.getDefault().toString());
|
config.getConfig().set("attraction." + id + ".status", type.getDefault().toString());
|
||||||
|
|
|
@ -308,7 +308,7 @@ public class ThemeParkCommand extends BukkitCommand {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status status = Status.getStatus(args[2]);
|
Status status = Status.valueOf(args[2]);
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
String message = Message.getMessage("status.not");
|
String message = Message.getMessage("status.not");
|
||||||
message = message.replace("{status}", args[2]);
|
message = message.replace("{status}", args[2]);
|
||||||
|
|
Reference in a new issue