Add option to disable global death messages

This commit is contained in:
Daniel Saukel 2018-04-27 14:06:53 +02:00
parent a3a99ecc97
commit d2a2adcacb
2 changed files with 31 additions and 1 deletions

View File

@ -47,7 +47,7 @@ public class MainConfig extends DREConfig {
NEVER
}
public static final int CONFIG_VERSION = 14;
public static final int CONFIG_VERSION = 15;
private String language = "english";
private boolean enableEconomy = false;
@ -86,6 +86,7 @@ public class MainConfig extends DREConfig {
/* Misc */
private boolean sendFloorTitle = true;
private boolean globalDeathMessagesDisabled = true;
private Map<String, Object> externalMobProviders = new HashMap<>();
private Map<String, Object> resourcePacks = new HashMap<>();
@ -300,6 +301,23 @@ public class MainConfig extends DREConfig {
announcementInterval = interval;
}
/**
* @return
* false if death messages shall be sent to players who are not in the dungeon,
* true if not
*/
public boolean areGlobalDeathMessagesDisabled() {
return globalDeathMessagesDisabled;
}
/**
* @param disabled
* set if death messages shall be sent to players who are not in the dungeon
*/
public void setGlobalDeathMessagesDisabled(boolean disabled) {
globalDeathMessagesDisabled = false;
}
/**
* @return if the floor title shall be sent
*/
@ -514,6 +532,10 @@ public class MainConfig extends DREConfig {
config.set("sendFloorTitle", sendFloorTitle);
}
if (!config.contains("globalDeathMessagesDisabled")) {
config.set("globalDeathMessagesDisabled", globalDeathMessagesDisabled);
}
if (!config.contains("externalMobProviders")) {
config.createSection("externalMobProviders");
}
@ -643,6 +665,10 @@ public class MainConfig extends DREConfig {
sendFloorTitle = config.getBoolean("sendFloorTitle");
}
if (config.contains("globalDeathMessagesDisabled")) {
globalDeathMessagesDisabled = config.getBoolean("globalDeathMessagesDisabled");
}
if (config.contains("externalMobProviders")) {
externalMobProviders = config.getConfigurationSection("externalMobProviders").getValues(false);
}

View File

@ -851,6 +851,10 @@ public class DGamePlayer extends DInstancePlayer {
return;
}
if (config.areGlobalDeathMessagesDisabled()) {
event.setDeathMessage(null);
}
if (game.getRules().getKeepInventoryOnDeath()) {
setRespawnInventory(event.getEntity().getInventory().getContents());
setRespawnArmor(event.getEntity().getInventory().getArmorContents());