Make title message configurable

This commit is contained in:
Daniel Saukel 2016-03-22 21:50:28 +01:00
parent 11a04feb11
commit 4163fc8905
2 changed files with 27 additions and 7 deletions

View File

@ -27,7 +27,7 @@ import org.bukkit.configuration.ConfigurationSection;
*/ */
public class MainConfig extends BRConfig { public class MainConfig extends BRConfig {
public static final int CONFIG_VERSION = 1; public static final int CONFIG_VERSION = 2;
private String language = "en"; private String language = "en";
private boolean enableEconomy = false; private boolean enableEconomy = false;
@ -38,11 +38,13 @@ public class MainConfig extends BRConfig {
private String tutorialStartGroup = "default"; private String tutorialStartGroup = "default";
private String tutorialEndGroup = "player"; private String tutorialEndGroup = "player";
/* Misc */
private boolean sendFloorTitle = true;
private List<String> editCommandWhitelist = new ArrayList<>();
/* Default Dungeon Settings */ /* Default Dungeon Settings */
private WorldConfig defaultWorldConfig; private WorldConfig defaultWorldConfig;
private List<String> editCommandWhitelist = new ArrayList<>();
public MainConfig(File file) { public MainConfig(File file) {
super(file, CONFIG_VERSION); super(file, CONFIG_VERSION);
@ -95,6 +97,13 @@ public class MainConfig extends BRConfig {
return tutorialStartGroup; return tutorialStartGroup;
} }
/**
* @return if the floor title shall be sent
*/
public boolean getSendFloorTitle() {
return sendFloorTitle;
}
/** /**
* @return the tutorialEndGroup * @return the tutorialEndGroup
*/ */
@ -151,6 +160,10 @@ public class MainConfig extends BRConfig {
config.set("tutorial.endgroup", tutorialEndGroup); config.set("tutorial.endgroup", tutorialEndGroup);
} }
if (!config.contains("sendFloorTitle")) {
config.set("sendFloorTitle", sendFloorTitle);
}
if (!config.contains("editCommandWhitelist")) { if (!config.contains("editCommandWhitelist")) {
config.set("editCommandWhitelist", editCommandWhitelist); config.set("editCommandWhitelist", editCommandWhitelist);
} }
@ -190,6 +203,10 @@ public class MainConfig extends BRConfig {
tutorialEndGroup = config.getString("tutorial.endgroup"); tutorialEndGroup = config.getString("tutorial.endgroup");
} }
if (config.contains("sendFloorTitle")) {
sendFloorTitle = config.getBoolean("sendFloorTitle");
}
if (config.contains("editCommandWhitelist")) { if (config.contains("editCommandWhitelist")) {
editCommandWhitelist = config.getStringList("editCommandWhitelist"); editCommandWhitelist = config.getStringList("editCommandWhitelist");
} }

View File

@ -493,11 +493,14 @@ public class DGroup {
for (Player player : getPlayers()) { for (Player player : getPlayers()) {
DPlayer dPlayer = DPlayer.getByPlayer(player); DPlayer dPlayer = DPlayer.getByPlayer(player);
dPlayer.respawn(); dPlayer.respawn();
if (dungeonName != null) {
MessageUtil.sendTitleMessage(player, "&b&l" + dungeonName.replaceAll("_", " "), "&4&l" + mapName.replaceAll("_", " "));
} else { if (plugin.getMainConfig().getSendFloorTitle()) {
MessageUtil.sendTitleMessage(player, "&4&l" + mapName.replaceAll("_", " ")); if (dungeonName != null) {
MessageUtil.sendTitleMessage(player, "&b&l" + dungeonName.replaceAll("_", " "), "&4&l" + mapName.replaceAll("_", " "));
} else {
MessageUtil.sendTitleMessage(player, "&4&l" + mapName.replaceAll("_", " "));
}
} }
WorldConfig config = gameWorld.getConfig(); WorldConfig config = gameWorld.getConfig();