Skip to content

Commit

Permalink
Add flag to enable/disable the Admin MOTD
Browse files Browse the repository at this point in the history
  • Loading branch information
BlaneyXYZ committed Jun 12, 2024
1 parent 108af37 commit 1e6a7de
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class Config {
public static boolean timeBroadcast;
public static boolean updateCheck;
public static boolean updateOldUserdata;
public static boolean useAdminMotd;
public static boolean useFirstJoinMotd;
public static boolean useProtocolLib;
public static boolean useVNP;
Expand Down Expand Up @@ -224,7 +225,8 @@ public void reloadConfiguration() {
timeBroadcast = c.getBoolean("messages.options.broadcast_time_changes", false);
updateCheck = c.getBoolean("updates.update_check", false);
updateOldUserdata = c.getBoolean("userdata.update_old", true);
useFirstJoinMotd = c.getBoolean("motd.options.use_first_join", true);
useAdminMotd = c.getBoolean("motd.options.use_first_join_motd", true);
useFirstJoinMotd = c.getBoolean("motd.options.use_first_join_motd", true);
useProtocolLib = c.getBoolean("items.spawn.tag.plugins.protocollib", true);
useVNP = c.getBoolean("plugins.use_vanish", true);
useWelcome = c.getBoolean("messages.options.enable_welcome_message", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ public void showMotd(PlayerJoinEvent e) {
List<String> motdConfig;
if (Config.useFirstJoinMotd && !p.hasPlayedBefore()) {
motdConfig = Config.motdFirstJoin;
} else if (plugin.ah.isAuthorized(p, "rcmds.messageoftheday.admin")) {
} else if (Config.useAdminMotd && plugin.ah.isAuthorized(p, "rcmds.messageoftheday.admin")) {
motdConfig = Config.motdAdmin;
} else {
motdConfig = Config.motdGeneral;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static void showMotd(CommandSender cs, List<String> config) {
@Override
public boolean runCommand(final CommandSender cs, final Command cmd, final String label, final String[] args, CommandArguments ca) {
List<String> config;
if (ah.isAuthorized(cs, "rcmds.messageoftheday.admin")) {
if (Config.useAdminMotd && ah.isAuthorized(cs, "rcmds.messageoftheday.admin")) {
config = Config.motdAdmin;
} else {
config = Config.motdGeneral;
Expand Down
4 changes: 3 additions & 1 deletion modules/RoyalCommands/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ motd:
# Show /motd on login?
display_on_login: true
# Show different motd on first join
use_first_join: true
use_first_join_motd: true
# Show different motd for admin
use_admin_motd: true
# The message of the day
general:
- "&dWelcome to {servername}, {dispname}!"
Expand Down

0 comments on commit 1e6a7de

Please sign in to comment.