diff --git a/AreaShop/src/main/java/nl/evolutioncoding/areashop/AreaShop.java b/AreaShop/src/main/java/nl/evolutioncoding/areashop/AreaShop.java index 1eec3a2..057bf52 100644 --- a/AreaShop/src/main/java/nl/evolutioncoding/areashop/AreaShop.java +++ b/AreaShop/src/main/java/nl/evolutioncoding/areashop/AreaShop.java @@ -692,6 +692,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface { identifiers.addAll(this.getConfig().getStringList("minutes")); identifiers.addAll(this.getConfig().getStringList("hours")); identifiers.addAll(this.getConfig().getStringList("days")); + identifiers.addAll(this.getConfig().getStringList("weeks")); identifiers.addAll(this.getConfig().getStringList("months")); identifiers.addAll(this.getConfig().getStringList("years")); if(!identifiers.contains(suffix)) { @@ -723,6 +724,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface { ArrayList minutes = new ArrayList(this.getConfig().getStringList("minutes")); ArrayList hours = new ArrayList(this.getConfig().getStringList("hours")); ArrayList days = new ArrayList(this.getConfig().getStringList("days")); + ArrayList weeks = new ArrayList(this.getConfig().getStringList("weeks")); ArrayList months = new ArrayList(this.getConfig().getStringList("months")); ArrayList years = new ArrayList(this.getConfig().getStringList("years")); @@ -740,6 +742,8 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface { calendar.add(Calendar.HOUR, durationInt); } else if(days.contains(durationString)) { calendar.add(Calendar.DAY_OF_MONTH, durationInt); + } else if(weeks.contains(durationString)) { + calendar.add(Calendar.DAY_OF_MONTH, durationInt*7); } else if(months.contains(durationString)) { calendar.add(Calendar.MONTH, durationInt); } else if(years.contains(durationString)) { diff --git a/AreaShop/src/main/java/nl/evolutioncoding/areashop/managers/FileManager.java b/AreaShop/src/main/java/nl/evolutioncoding/areashop/managers/FileManager.java index af18eb9..099f4d2 100644 --- a/AreaShop/src/main/java/nl/evolutioncoding/areashop/managers/FileManager.java +++ b/AreaShop/src/main/java/nl/evolutioncoding/areashop/managers/FileManager.java @@ -1022,6 +1022,7 @@ public class FileManager { public void run() { List noWorld = new ArrayList(); List noRegion = new ArrayList(); + List incorrectDuration = new ArrayList(); for(GeneralRegion region : AreaShop.getInstance().getFileManager().getRegions()) { // Add broken regions to a list if(region != null) { @@ -1031,6 +1032,9 @@ public class FileManager { if(region.getRegion() == null) { noRegion.add(region); } + if(region.isRentRegion() && !plugin.checkTimeFormat(((RentRegion)region).getDurationString())) { + incorrectDuration.add(region); + } } } // All files are loaded, print possible problems to the console @@ -1062,6 +1066,13 @@ public class FileManager { if(noWorldRegions) { plugin.getLogger().warning("Remove these regions from AreaShop with '/as del' or load the world(s) on the server again."); } + if(!incorrectDuration.isEmpty()) { + List incorrectDurationNames = new ArrayList(); + for(GeneralRegion region : incorrectDuration) { + incorrectDurationNames.add(region.getName()); + } + plugin.getLogger().warning("The following regions have an incorrect time format as duration: "+Utils.createCommaSeparatedList(incorrectDurationNames)); + } } }.runTask(plugin); }