diff --git a/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java b/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java index 53811b8b..17e5a622 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java @@ -176,7 +176,7 @@ public class DungeonsXL extends BRPlugin { loadAll(); // Tasks - startAnnouncerTask(200L); + startAnnouncerTask(mainConfig.getAnnouncmentInterval()); startWorldUnloadTask(1200L); startLazyUpdateTask(20L); startUpdateTask(20L); diff --git a/src/main/java/io/github/dre2n/dungeonsxl/config/MainConfig.java b/src/main/java/io/github/dre2n/dungeonsxl/config/MainConfig.java index 0d13f2c5..d70e607b 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/config/MainConfig.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/config/MainConfig.java @@ -30,7 +30,7 @@ import org.bukkit.configuration.ConfigurationSection; */ public class MainConfig extends BRConfig { - public static final int CONFIG_VERSION = 8; + public static final int CONFIG_VERSION = 9; private String language = "english"; private boolean enableEconomy = false; @@ -41,10 +41,22 @@ public class MainConfig extends BRConfig { private String tutorialStartGroup = "default"; private String tutorialEndGroup = "player"; + /* Announcers */ + private List groupColorPriority = new ArrayList<>(Arrays.asList( + (short) 11, + (short) 14, + (short) 4, + (short) 5, + (short) 10, + (short) 1, + (short) 0, + (short) 15 + )); + private double announcementInterval = 30; + /* Misc */ private boolean sendFloorTitle = true; private Map externalMobProviders = new HashMap<>(); - private List groupColorPriority = new ArrayList<>(Arrays.asList((short) 11, (short) 14, (short) 4, (short) 5, (short) 10, (short) 1, (short) 0, (short) 15)); private int maxInstances = 10; /* Secure Mode */ @@ -137,8 +149,6 @@ public class MainConfig extends BRConfig { } /** - * <<<<<<< HEAD - * * @param group * the group the player gets when he plays the tutorial */ @@ -161,6 +171,36 @@ public class MainConfig extends BRConfig { tutorialEndGroup = group; } + /** + * @return the group colors + */ + public List getGroupColorPriority() { + return groupColorPriority; + } + + /** + * @param dataValues + * wool data values + */ + public void setGroupColorPriority(List dataValues) { + groupColorPriority = dataValues; + } + + /** + * @return the announcement interval + */ + public long getAnnouncmentInterval() { + return (long) (announcementInterval * 20); + } + + /** + * @param interval + * the interval to set + */ + public void setAnnouncementInterval(double interval) { + announcementInterval = interval; + } + /** * @return if the floor title shall be sent */ @@ -183,21 +223,6 @@ public class MainConfig extends BRConfig { return externalMobProviders; } - /** - * @return the group colors - */ - public List getGroupColorPriority() { - return groupColorPriority; - } - - /** - * @param dataValues - * wool data values - */ - public void setGroupColorPriority(List dataValues) { - groupColorPriority = dataValues; - } - /** * @return the maximum amount of worlds to instantiate at once */ @@ -321,6 +346,14 @@ public class MainConfig extends BRConfig { config.set("tutorial.endgroup", tutorialEndGroup); } + if (!config.contains("groupColorPriority")) { + config.set("groupColorPriority", groupColorPriority); + } + + if (!config.contains("announcementInterval")) { + config.set("announcementInterval", announcementInterval); + } + if (!config.contains("sendFloorTitle")) { config.set("sendFloorTitle", sendFloorTitle); } @@ -329,10 +362,6 @@ public class MainConfig extends BRConfig { config.createSection("externalMobProviders"); } - if (!config.contains("groupColorPriority")) { - config.set("groupColorPriority", groupColorPriority); - } - if (!config.contains("maxInstances")) { config.set("maxInstances", maxInstances); } @@ -396,6 +425,14 @@ public class MainConfig extends BRConfig { tutorialEndGroup = config.getString("tutorial.endgroup"); } + if (config.contains("groupColorPriority")) { + groupColorPriority = config.getShortList("groupColorPriority"); + } + + if (config.contains("announcementInterval")) { + announcementInterval = config.getDouble("announcementInterval"); + } + if (config.contains("sendFloorTitle")) { sendFloorTitle = config.getBoolean("sendFloorTitle"); } @@ -404,10 +441,6 @@ public class MainConfig extends BRConfig { externalMobProviders = config.getConfigurationSection("externalMobProviders").getValues(false); } - if (config.contains("groupColorPriority")) { - groupColorPriority = config.getShortList("groupColorPriority"); - } - if (config.contains("maxInstances")) { maxInstances = config.getInt("maxInstances"); }