Some small fixes
This commit is contained in:
parent
bb38cea1bb
commit
41784cb4e8
8 changed files with 56 additions and 6 deletions
2
.idea/.gitignore
vendored
Normal file
2
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Default ignored files
|
||||
/workspace.xml
|
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
|||
|
||||
<groupId>me.paradoxpixel</groupId>
|
||||
<artifactId>themepark</artifactId>
|
||||
<version>1.2.7</version>
|
||||
<version>1.3</version>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -118,6 +118,9 @@ public class AttractionMenu {
|
|||
HashMap<String, Attraction> 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());
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: ThemePark
|
||||
version: 1.2.7
|
||||
version: 1.3
|
||||
main: me.paradoxpixel.themepark.ThemeParkPlugin
|
||||
author: ParadoxPixel
|
||||
softdepend: [PlaceholderAPI]
|
||||
|
|
Reference in a new issue