From 943549a3231d81faea13306f665f0bd96cd9cb74 Mon Sep 17 00:00:00 2001 From: Eva <66324759+saxnbt@users.noreply.github.com> Date: Wed, 23 Mar 2022 23:10:48 +0000 Subject: [PATCH] Add preview when setting login message --- .../commands/Command_myadmin.java | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/main/java/me/StevenLawson/TotalFreedomMod/commands/Command_myadmin.java b/src/main/java/me/StevenLawson/TotalFreedomMod/commands/Command_myadmin.java index 951aea8..9870bd1 100644 --- a/src/main/java/me/StevenLawson/TotalFreedomMod/commands/Command_myadmin.java +++ b/src/main/java/me/StevenLawson/TotalFreedomMod/commands/Command_myadmin.java @@ -16,31 +16,30 @@ public class Command_myadmin extends FreedomCommand { public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { final UUID uuid = sender_p.getUniqueId(); // Get the sender's uuid as a variable. if(args.length == 1) { - if ("clearloginmsg".equalsIgnoreCase(args[0])) { - playerMsg(ChatColor.GRAY + "Cleared your custom login message."); // Notify player that the login message has been set. + if ("clearloginmsg".equalsIgnoreCase(args[0])) { + playerMsg(ChatColor.GRAY + "Cleared your custom login message."); // Notify player that the login message has been set. - AdminList.getEntry(uuid).setCustomLoginMessage(""); // Set the custom login message to the value. - AdminList.save(AdminList.getEntry(uuid)); // Save the modified value to the super admin configuration. - - AdminList.updateIndexLists(); // Update and refresh configuration. - return true; - } else { - return false; - } - } else if (args.length >= 2) { - if ("setlogin".equalsIgnoreCase(args[0])) { - final String inputMessage = StringUtils.join(args, " ", 1, args.length); // Parse the input provided. - - playerMsg(ChatColor.GRAY + "Set your custom login message."); // Notify player that the login message has been set. - - AdminList.getEntry(uuid).setCustomLoginMessage(inputMessage); // Set the custom login message to the value. + AdminList.getEntry(uuid).setCustomLoginMessage(""); // Set the custom login message to the value. AdminList.save(AdminList.getEntry(uuid)); // Save the modified value to the super admin configuration. AdminList.updateIndexLists(); // Update and refresh configuration. return true; } else { - return false; - } + return false; + } + } else if (args.length >= 2) { + if ("setlogin".equalsIgnoreCase(args[0])) { + final String inputMessage = StringUtils.join(args, " ", 1, args.length); // Parse the input provided. + playerMsg(ChatColor.GRAY + "Set your custom login message."); // Notify player that the login message has been set. + playerMsg(ChatColor.GRAY + "Your login message will show up as: \n" + ChatColor.AQUA + sender_p.getPlayer().getName() + " is " + inputMessage); + AdminList.getEntry(uuid).setCustomLoginMessage(inputMessage); // Set the custom login message to the value. + AdminList.save(AdminList.getEntry(uuid)); // Save the modified value to the super admin configuration. + + AdminList.updateIndexLists(); // Update and refresh configuration. + return true; + } else { + return false; + } } else { return false; }