Add preview when setting login message

This commit is contained in:
Eva 2022-03-23 23:10:48 +00:00 committed by GitHub
parent de44f0a564
commit 943549a323
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}