Skip to content

Commit

Permalink
Added: silenced_worlds for when no death messages are required
Browse files Browse the repository at this point in the history
disabled_worlds is now ignored_worlds, vanilla messages will be used
  • Loading branch information
BlaneyXYZ committed Jun 24, 2024
1 parent baf1802 commit 7889235
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class Config {
public static boolean wmShowEmptyWorlds;
public static boolean worldAccessPerm;
public static boolean ymlConvert;
public static boolean interworld;
public static boolean interworldDeathMessages;

//-- ConfigurationSections --//
public static ConfigurationSection commandCooldowns;
Expand Down Expand Up @@ -124,7 +124,8 @@ public class Config {
public static List<String> muteCmds;
public static List<String> onBanActions;
public static List<String> whitelist;
public static List<String> disabledWorlds;
public static List<String> ignoredDeathMessageWorlds;
public static List<String> silencedDeathMessageWorlds;

//-- Longs --//
public static long afkAutoTime;
Expand Down Expand Up @@ -246,7 +247,7 @@ public void reloadConfiguration() {
wmShowEmptyWorlds = c.getBoolean("worldmanager.who.show_empty_worlds", false);
worldAccessPerm = c.getBoolean("teleports.worlds.worldaccess_perm", false);
ymlConvert = c.getBoolean("yml_convert", false);
interworld = c.getBoolean("deathmessages.show_interworld", true);
interworldDeathMessages = c.getBoolean("deathmessages.show_interworld", true);

//-- ConfigurationSections --//

Expand Down Expand Up @@ -293,7 +294,8 @@ public void reloadConfiguration() {
motdFirstJoin = c.getStringList("motd.firstjoin");
muteCmds = c.getStringList("commands.mute_blocked");
onBanActions = c.getStringList("bans.actions");
disabledWorlds = c.getStringList("deathmessages.disabled_worlds");
ignoredDeathMessageWorlds = c.getStringList("deathmessages.ignored_worlds");
silencedDeathMessageWorlds = c.getStringList("deathmessages.silenced_worlds");

//-- Longs --//

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public DeathListener(final RoyalCommands instance) {
}

private void sendDeathMessage(final String message, final World in) {
final boolean interworld = Config.interworld;
final boolean interworld = Config.interworldDeathMessages;
if (interworld) {
this.plugin.getServer().broadcastMessage(message);
return;
Expand All @@ -35,7 +35,11 @@ public void onDeath(final PlayerDeathEvent event) {
if (!Config.useCustomDeath) return;
if (event.getEntity() == null) return;
final World in = event.getEntity().getWorld();
if (Config.disabledWorlds.contains(in.getName())) return;
if (Config.ignoredDeathMessageWorlds.contains(in.getName())) return;
if (Config.silencedDeathMessageWorlds.contains(in.getName())) {
event.setDeathMessage(null);
return;
}
event.setDeathMessage(null);
final Death death = new Death(this.plugin, event);
this.sendDeathMessage(death.getNewDeathMessage(), in);
Expand Down
9 changes: 7 additions & 2 deletions modules/RoyalCommands/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,11 @@ deathmessages:
enabled: true
# Should death messages from other worlds be displayed to players?
show_interworld: true
# List of worlds to disable death messages in
disabled_worlds:
# List of worlds to leave death messages untouched, i.e. use the vanilla death messages
ignored_worlds :
- someworldhere
# List of worlds to never show death messages, neither vanilla nor custom messages will be generated
# Useful for worlds that have death messages generated by other plugins i.e. gamemode plugins
silenced_worlds:
- someworldhere

0 comments on commit 7889235

Please sign in to comment.