diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/pom.xml b/pom.xml index f2f4cae..949e7b1 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ me.paradoxpixel themepark - 1.2.7 + 1.3 diff --git a/src/main/java/me/paradoxpixel/themepark/api/attraction/component/Status.java b/src/main/java/me/paradoxpixel/themepark/api/attraction/component/Status.java index 71277f5..62683fb 100644 --- a/src/main/java/me/paradoxpixel/themepark/api/attraction/component/Status.java +++ b/src/main/java/me/paradoxpixel/themepark/api/attraction/component/Status.java @@ -7,4 +7,29 @@ public enum Status { MALFUNCTION, ACTIVE, INACTIVE, GLOBAL; + public static Status getStatus(String str) { + if(str == null || str.isEmpty()) + return null; + + str = str.toUpperCase(); + switch(str) { + case "CONSTRUCTION": + return CONSTRUCTION; + case "OPEN": + return OPEN; + case "CLOSED": + return CLOSED; + case "MAINTENANCE": + return MAINTENANCE; + case "ACTIVE": + return ACTIVE; + case "INACTIVE": + return INACTIVE; + case "GLOBAL": + return GLOBAL; + default: + return null; + } + } + } diff --git a/src/main/java/me/paradoxpixel/themepark/api/attraction/component/Type.java b/src/main/java/me/paradoxpixel/themepark/api/attraction/component/Type.java index 7bf3101..e0a0465 100644 --- a/src/main/java/me/paradoxpixel/themepark/api/attraction/component/Type.java +++ b/src/main/java/me/paradoxpixel/themepark/api/attraction/component/Type.java @@ -38,4 +38,21 @@ public enum Type { return false; } + public static Type getType(String str) { + if(str == null || str.isEmpty()) + return null; + + str = str.toUpperCase(); + switch (str) { + case "RIDE": + return RIDE; + case "SHOW": + return SHOW; + case "GLOBAL": + return GLOBAL; + default: + return null; + } + } + } diff --git a/src/main/java/me/paradoxpixel/themepark/attraction/AttractionMenu.java b/src/main/java/me/paradoxpixel/themepark/attraction/AttractionMenu.java index c332129..b40808f 100644 --- a/src/main/java/me/paradoxpixel/themepark/attraction/AttractionMenu.java +++ b/src/main/java/me/paradoxpixel/themepark/attraction/AttractionMenu.java @@ -118,6 +118,9 @@ public class AttractionMenu { HashMap attractions = API.getAttractions(); for(String id : section.getKeys(false)) { String region_id = config.getConfig().getString("attraction." + id + ".region_id"); + if(region_id == null || region_id.isEmpty()) + continue; + if(!region_id.toLowerCase().equals(region_id)) { region_id = region_id.toLowerCase(); config.getConfig().set("attraction." + id + ".region_id", region_id); @@ -131,8 +134,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.valueOf(config.getConfig().getString("attraction." + id + ".type")); - Status status = Status.valueOf(config.getConfig().getString("attraction." + id + ".status")); + Type type = Type.getType(config.getConfig().getString("attraction." + id + ".type")); + Status status = Status.getStatus(config.getConfig().getString("attraction." + id + ".status")); if(!type.containsStatus(status)) { status = type.getDefault(); config.getConfig().set("attraction." + id + ".status", type.getDefault().toString()); diff --git a/src/main/java/me/paradoxpixel/themepark/attraction/sign/StatusSign.java b/src/main/java/me/paradoxpixel/themepark/attraction/sign/StatusSign.java index ce86094..c40a629 100644 --- a/src/main/java/me/paradoxpixel/themepark/attraction/sign/StatusSign.java +++ b/src/main/java/me/paradoxpixel/themepark/attraction/sign/StatusSign.java @@ -28,6 +28,9 @@ public class StatusSign { public void update() { Status status = attraction.getStatus(); + if(!location.getChunk().isLoaded()) + location.getChunk().load(); + Sign sign = (Sign) location.getBlock().getState(); sign.setLine(2, Utils.color(StatusManager.getName(status))); sign.update(); diff --git a/src/main/java/me/paradoxpixel/themepark/command/ThemeParkCommand.java b/src/main/java/me/paradoxpixel/themepark/command/ThemeParkCommand.java index 76e2c49..49077f7 100644 --- a/src/main/java/me/paradoxpixel/themepark/command/ThemeParkCommand.java +++ b/src/main/java/me/paradoxpixel/themepark/command/ThemeParkCommand.java @@ -240,7 +240,7 @@ public class ThemeParkCommand extends BukkitCommand { String string = args[2]; if(!isInteger(string)) { - sender.sendMessage(Message.getMessage("nonumber").replace("{number}", string)); + sender.sendMessage(Utils.color(Message.getMessage("nonumber").replace("{number}", string))); return true; } @@ -308,7 +308,7 @@ public class ThemeParkCommand extends BukkitCommand { return true; } - Status status = Status.valueOf(args[2]); + Status status = Status.getStatus(args[2]); if (status == null) { String message = Message.getMessage("status.not"); message = message.replace("{status}", args[2]); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e1d04a8..f5cef00 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ThemePark -version: 1.2.7 +version: 1.3 main: me.paradoxpixel.themepark.ThemeParkPlugin author: ParadoxPixel softdepend: [PlaceholderAPI]