Make announcement interval configurable

This commit is contained in:
Daniel Saukel 2016-06-09 23:27:42 +02:00
parent 1851be10cb
commit eaa198493b
2 changed files with 61 additions and 28 deletions

View File

@ -176,7 +176,7 @@ public class DungeonsXL extends BRPlugin {
loadAll(); loadAll();
// Tasks // Tasks
startAnnouncerTask(200L); startAnnouncerTask(mainConfig.getAnnouncmentInterval());
startWorldUnloadTask(1200L); startWorldUnloadTask(1200L);
startLazyUpdateTask(20L); startLazyUpdateTask(20L);
startUpdateTask(20L); startUpdateTask(20L);

View File

@ -30,7 +30,7 @@ import org.bukkit.configuration.ConfigurationSection;
*/ */
public class MainConfig extends BRConfig { public class MainConfig extends BRConfig {
public static final int CONFIG_VERSION = 8; public static final int CONFIG_VERSION = 9;
private String language = "english"; private String language = "english";
private boolean enableEconomy = false; private boolean enableEconomy = false;
@ -41,10 +41,22 @@ public class MainConfig extends BRConfig {
private String tutorialStartGroup = "default"; private String tutorialStartGroup = "default";
private String tutorialEndGroup = "player"; private String tutorialEndGroup = "player";
/* Announcers */
private List<Short> 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 */ /* Misc */
private boolean sendFloorTitle = true; private boolean sendFloorTitle = true;
private Map<String, Object> externalMobProviders = new HashMap<>(); private Map<String, Object> externalMobProviders = new HashMap<>();
private List<Short> 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; private int maxInstances = 10;
/* Secure Mode */ /* Secure Mode */
@ -137,8 +149,6 @@ public class MainConfig extends BRConfig {
} }
/** /**
* <<<<<<< HEAD
*
* @param group * @param group
* the group the player gets when he plays the tutorial * the group the player gets when he plays the tutorial
*/ */
@ -161,6 +171,36 @@ public class MainConfig extends BRConfig {
tutorialEndGroup = group; tutorialEndGroup = group;
} }
/**
* @return the group colors
*/
public List<Short> getGroupColorPriority() {
return groupColorPriority;
}
/**
* @param dataValues
* wool data values
*/
public void setGroupColorPriority(List<Short> 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 * @return if the floor title shall be sent
*/ */
@ -183,21 +223,6 @@ public class MainConfig extends BRConfig {
return externalMobProviders; return externalMobProviders;
} }
/**
* @return the group colors
*/
public List<Short> getGroupColorPriority() {
return groupColorPriority;
}
/**
* @param dataValues
* wool data values
*/
public void setGroupColorPriority(List<Short> dataValues) {
groupColorPriority = dataValues;
}
/** /**
* @return the maximum amount of worlds to instantiate at once * @return the maximum amount of worlds to instantiate at once
*/ */
@ -321,6 +346,14 @@ public class MainConfig extends BRConfig {
config.set("tutorial.endgroup", tutorialEndGroup); 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")) { if (!config.contains("sendFloorTitle")) {
config.set("sendFloorTitle", sendFloorTitle); config.set("sendFloorTitle", sendFloorTitle);
} }
@ -329,10 +362,6 @@ public class MainConfig extends BRConfig {
config.createSection("externalMobProviders"); config.createSection("externalMobProviders");
} }
if (!config.contains("groupColorPriority")) {
config.set("groupColorPriority", groupColorPriority);
}
if (!config.contains("maxInstances")) { if (!config.contains("maxInstances")) {
config.set("maxInstances", maxInstances); config.set("maxInstances", maxInstances);
} }
@ -396,6 +425,14 @@ public class MainConfig extends BRConfig {
tutorialEndGroup = config.getString("tutorial.endgroup"); 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")) { if (config.contains("sendFloorTitle")) {
sendFloorTitle = config.getBoolean("sendFloorTitle"); sendFloorTitle = config.getBoolean("sendFloorTitle");
} }
@ -404,10 +441,6 @@ public class MainConfig extends BRConfig {
externalMobProviders = config.getConfigurationSection("externalMobProviders").getValues(false); externalMobProviders = config.getConfigurationSection("externalMobProviders").getValues(false);
} }
if (config.contains("groupColorPriority")) {
groupColorPriority = config.getShortList("groupColorPriority");
}
if (config.contains("maxInstances")) { if (config.contains("maxInstances")) {
maxInstances = config.getInt("maxInstances"); maxInstances = config.getInt("maxInstances");
} }