diff --git a/pom.xml b/pom.xml
index 38c6f85..f2f4cae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
me.paradoxpixel
themepark
- 1.2.6
+ 1.2.7
diff --git a/src/main/java/me/paradoxpixel/themepark/attraction/AttractionMenu.java b/src/main/java/me/paradoxpixel/themepark/attraction/AttractionMenu.java
index 2a82f4e..78efab5 100644
--- a/src/main/java/me/paradoxpixel/themepark/attraction/AttractionMenu.java
+++ b/src/main/java/me/paradoxpixel/themepark/attraction/AttractionMenu.java
@@ -71,16 +71,17 @@ public class AttractionMenu {
return;
HashMap regions = API.getRegions();
+ HashMap size = new HashMap<>();
for(String id : section.getKeys(false)) {
- if(API.getRegions().size() >= 6) {
+ if(size.size() >= 6) {
config.getConfig().set("regions." + id, null);
- config.save();
continue;
}
String name = config.getConfig().getString("region." + id + ".name");
List lore = config.getConfig().getStringList("region." + id + ".lore");
+ size.put(id.toLowerCase(), 0);
regions.remove(id);
if(API.isRegion(id)) {
API.getRegion(id).setName(name);
@@ -90,8 +91,17 @@ public class AttractionMenu {
Region region = new Region(id, name, lore);
API.addRegion(region);
+
+ if(!id.toLowerCase().equals(id)) {
+ config.getConfig().set("region." + id, null);
+ id = id.toLowerCase();
+ config.getConfig().set("region." + id + ".name", name);
+ config.getConfig().set("region." + id + ".lore", lore);
+ }
}
+ config.save();
+
for(String string : regions.keySet())
API.removeRegion(string);
@@ -108,18 +118,28 @@ 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.toLowerCase().equals(region_id)) {
+ region_id = region_id.toLowerCase();
+ config.getConfig().set("attraction." + id + ".region_id", region_id);
+ }
+
if(!API.isRegion(region_id))
continue;
- if(API.isRegionFull(region_id))
+ if(size.get(region_id.toLowerCase()) >= 8)
continue;
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"));
+ if(!type.containsStatus(status)) {
+ status = type.getDefault();
+ config.getConfig().set("attraction." + id + ".status", type.getDefault().toString());
+ }
- attractions.remove(id);
+ attractions.remove(id.toLowerCase());
+ size.put(region_id.toLowerCase(), size.get(region_id.toLowerCase()) + 1);
if(API.isAttraction(id)) {
Attraction attraction = API.getAttraction(id);
attraction.setName(name);
@@ -127,17 +147,24 @@ public class AttractionMenu {
attraction.setLocation(location);
attraction.setType(type);
attraction.setStatus(status, null);
- if(!type.containsStatus(status)) {
- config.getConfig().set("attraction." + id + ".status", type.getDefault().toString());
- config.save();
- }
continue;
}
Attraction attraction = new Attraction(id, name, region_id, location, type, status);
API.addAttraction(attraction);
+
+ if(!id.toLowerCase().equals(id)) {
+ config.getConfig().set("attraction." + id, null);
+ id = id.toLowerCase();
+ config.getConfig().set("attraction." + id + ".name", name);
+ config.getConfig().set("attraction." + id + ".location", LocationUtils.toString(location));
+ config.getConfig().set("attraction." + id + ".type", type.toString());
+ config.getConfig().set("attraction." + id + ".status", status.toString());
+ }
}
+ config.save();
+
for(String string : attractions.keySet())
API.removeAttraction(string);
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 59ec34f..e1d04a8 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,5 +1,5 @@
name: ThemePark
-version: 1.2.6
+version: 1.2.7
main: me.paradoxpixel.themepark.ThemeParkPlugin
author: ParadoxPixel
softdepend: [PlaceholderAPI]