From 4e49924d75818148b2fa1ea67b05dd6f17b6c052 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 1 Apr 2022 17:44:14 -0700 Subject: [PATCH 1/7] Added commands clearall and clear [player] to Mail command. Added their messages to messages.properties. --- .../essentials/commands/Commandmail.java | 59 +++++++++++++++++-- .../src/main/resources/messages.properties | 24 +++++--- 2 files changed, 70 insertions(+), 13 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java index a40f4ade9d7..8f542913ef1 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java @@ -168,7 +168,7 @@ public void run(final Server server, final User user, final String commandLabel, user.sendMessage(tl("mailSent")); return; } - if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) { + if (args.length == 1 && "clear".equalsIgnoreCase(args[0]) || (args.length >= 1 && "clear".equalsIgnoreCase(args[0]) && NumberUtil.isPositiveInt(args[1]))) { final ArrayList mails = user.getMailMessages(); if (mails == null || mails.size() == 0) { user.sendMessage(tl("noMail")); @@ -194,6 +194,30 @@ public void run(final Server server, final User user, final String commandLabel, user.sendMessage(tl("mailCleared")); return; } + if (args.length >= 2 && "clear".equalsIgnoreCase(args[0])) { + final User u; + if (!user.isAuthorized("essentials.mail.clear.others")){ + throw new Exception(tl("noPerm", "essentials.mail.clear.others")); + } + try { + u = getPlayer(server, args[1], true, true); + } catch (final PlayerNotFoundException e) { + throw new Exception(tl("playerNeverOnServer", args[1])); + } + u.setMailList(null); + user.sendMessage(tl("mailClearedPlayer", u.getDisplayName())); + return; + } + if (args.length >= 1 && "clearall".equalsIgnoreCase(args[0])){ + if (!user.isAuthorized("essentials.mail.clearall")) { + throw new Exception(tl("noPerm", "essentials.mail.clearall")); + } + + ess.runTaskAsynchronously(new ClearAll()); + user.sendMessage(tl("mailClearedAll")); + return; + + } throw new NotEnoughArgumentsException(); } @@ -201,8 +225,22 @@ public void run(final Server server, final User user, final String commandLabel, protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length >= 1 && "read".equalsIgnoreCase(args[0])) { throw new Exception(tl("onlyPlayers", commandLabel + " read")); - } else if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) { + } else if (args.length == 1 && "clear".equalsIgnoreCase(args[0])) { throw new Exception(tl("onlyPlayers", commandLabel + " clear")); + } else if (args.length >= 1 && "clearall".equalsIgnoreCase(args[0])){ + ess.runTaskAsynchronously(new ClearAll()); + sender.sendMessage(tl("mailClearedAll")); + return; + } else if (args.length >= 2 && "clear".equalsIgnoreCase(args[0])) { + final User u; + try { + u = getPlayer(server, args[1], true, true); + } catch (final PlayerNotFoundException e) { + throw new Exception(tl("playerNeverOnServer", args[1])); + } + u.setMailList(null); + sender.sendMessage(tl("mailClearedPlayer", u.getDisplayName())); + return; } else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { final User u; try { @@ -314,9 +352,9 @@ protected List getTabCompleteOptions(final Server server, final User use @Override protected List getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) { if (args.length == 1) { - return Lists.newArrayList("send", "sendall", "sendtemp", "sendtempall"); + return Lists.newArrayList("send", "sendall", "sendtemp", "sendtempall", "clearall", "clear"); } else if (args.length == 2) { - if (args[0].equalsIgnoreCase("send") || args[0].equalsIgnoreCase("sendtemp")) { + if (args[0].equalsIgnoreCase("send") || args[0].equalsIgnoreCase("sendtemp") || args[0].equalsIgnoreCase("clear")) { return getPlayers(server, sender); } else if (args[0].equalsIgnoreCase("sendtempall")) { return COMMON_DATE_DIFFS; @@ -326,4 +364,17 @@ protected List getTabCompleteOptions(final Server server, final CommandS } return Collections.emptyList(); } + private class ClearAll implements Runnable { + @Override + public void run() { + for (UUID userid : ess.getUserMap().getAllUniqueUsers()) { + final User user = ess.getUserMap().getUser(userid); + if (user != null) { + user.setMailList(null); + } + } + } + } } + + diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index 9d7d24357d5..c40279e4229 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -675,21 +675,27 @@ loomCommandDescription=Opens up a loom. loomCommandUsage=/ mailClear=\u00a76To clear your mail, type\u00a7c /mail clear\u00a76. mailCleared=\u00a76Mail cleared\! +mailClearedPlayer=\u00a76Mail of {0} cleared!\! +mailClearedAll=\u00a76All players' mail cleared!\! mailClearIndex=\u00a74You must specify a number between 1-{0}. mailCommandDescription=Manages inter-player, intra-server mail. -mailCommandUsage=/ [read|clear|clear [number]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]] +mailCommandUsage=/ [read|clear|clear [number]|clear [player]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]|clearall] mailCommandUsage1=/ read [page] mailCommandUsage1Description=Reads the first (or specified) page of your mail mailCommandUsage2=/ clear [number] mailCommandUsage2Description=Clears either all or the specified mail(s) -mailCommandUsage3=/ send -mailCommandUsage3Description=Sends the specified player the given message -mailCommandUsage4=/ sendall -mailCommandUsage4Description=Sends all players the given message -mailCommandUsage5=/ sendtemp -mailCommandUsage5Description=Sends the specified player the given message which will expire in the specified time -mailCommandUsage6=/ sendtempall -mailCommandUsage6Description=Sends all players the given message which will expire in the specified time +mailCommandUsage3=/ clear [player] +mailCommandUsage3Description=Clears the mail of the specified player. +mailCommandUsage4=/ send +mailCommandUsage4Description=Sends the specified player the given message +mailCommandUsage5=/ sendall +mailCommandUsage5Description=Sends all players the given message +mailCommandUsage6=/ sendtemp +mailCommandUsage6Description=Sends the specified player the given message which will expire in the specified time +mailCommandUsage7=/ sendtempall +mailCommandUsage7Description=Sends all players the given message which will expire in the specified time +mailCommandUsage8=/ clearall +mailCommandUsage8Description=Clears the mail of all players mailDelay=Too many mails have been sent within the last minute. Maximum\: {0} mailFormatNew=\u00a76[\u00a7r{0}\u00a76] \u00a76[\u00a7r{1}\u00a76] \u00a7r{2} mailFormatNewTimed=\u00a76[\u00a7e\u26a0\u00a76] \u00a76[\u00a7r{0}\u00a76] \u00a76[\u00a7r{1}\u00a76] \u00a7r{2} From cefff956f185b927c01c5e7100b2cf3900d5cffc Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 1 Apr 2022 18:26:35 -0700 Subject: [PATCH 2/7] bugfixed clearall and clear, updated messages_en.properties --- .../essentials/commands/Commandmail.java | 6 ++++- .../src/main/resources/messages.properties | 4 ++-- .../src/main/resources/messages_en.properties | 23 +++++++++++-------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java index 8f542913ef1..8824729e8a9 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java @@ -324,9 +324,12 @@ protected List getTabCompleteOptions(final Server server, final User use if (user.isAuthorized("essentials.mail.sendtempall")) { options.add("sendtempall"); } + if (user.isAuthorized("essentials.mail.clearall")){ + options.add("clearall"); + } return options; } else if (args.length == 2) { - if ((args[0].equalsIgnoreCase("send") && user.isAuthorized("essentials.mail.send")) || (args[0].equalsIgnoreCase("sendtemp") && user.isAuthorized("essentials.mail.sendtemp"))) { + if ((args[0].equalsIgnoreCase("send") && user.isAuthorized("essentials.mail.send")) || (args[0].equalsIgnoreCase("sendtemp") && user.isAuthorized("essentials.mail.sendtemp")) || (args[0].equalsIgnoreCase("clear"))) { return getPlayers(server, user); } else if (args[0].equalsIgnoreCase("sendtempall") && user.isAuthorized("essentials.mail.sendtempall")) { return COMMON_DATE_DIFFS; @@ -364,6 +367,7 @@ protected List getTabCompleteOptions(final Server server, final CommandS } return Collections.emptyList(); } + private class ClearAll implements Runnable { @Override public void run() { diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index c40279e4229..f557ea180db 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -675,8 +675,8 @@ loomCommandDescription=Opens up a loom. loomCommandUsage=/ mailClear=\u00a76To clear your mail, type\u00a7c /mail clear\u00a76. mailCleared=\u00a76Mail cleared\! -mailClearedPlayer=\u00a76Mail of {0} cleared!\! -mailClearedAll=\u00a76All players' mail cleared!\! +mailClearedPlayer=\u00a76Mail of {0} cleared!\ +mailClearedAll=\u00a76All players' mail cleared!\ mailClearIndex=\u00a74You must specify a number between 1-{0}. mailCommandDescription=Manages inter-player, intra-server mail. mailCommandUsage=/ [read|clear|clear [number]|clear [player]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]|clearall] diff --git a/Essentials/src/main/resources/messages_en.properties b/Essentials/src/main/resources/messages_en.properties index 4ab5600eca2..f2c165b3457 100644 --- a/Essentials/src/main/resources/messages_en.properties +++ b/Essentials/src/main/resources/messages_en.properties @@ -675,20 +675,25 @@ loomCommandUsage=/ mailClear=§6To clear your mail, type§c /mail clear§6. mailCleared=§6Mail cleared\! mailClearIndex=§4You must specify a number between 1-{0}. +mailClearedAll=§6All players' mail cleared! mailCommandDescription=Manages inter-player, intra-server mail. -mailCommandUsage=/ [read|clear|clear [number]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]] +mailCommandUsage=/ [read|clear|clear [number]|clear [player]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]|clearall] mailCommandUsage1=/ read [page] mailCommandUsage1Description=Reads the first (or specified) page of your mail mailCommandUsage2=/ clear [number] mailCommandUsage2Description=Clears either all or the specified mail(s) -mailCommandUsage3=/ send -mailCommandUsage3Description=Sends the specified player the given message -mailCommandUsage4=/ sendall -mailCommandUsage4Description=Sends all players the given message -mailCommandUsage5=/ sendtemp -mailCommandUsage5Description=Sends the specified player the given message which will expire in the specified time -mailCommandUsage6=/ sendtempall -mailCommandUsage6Description=Sends all players the given message which will expire in the specified time +mailCommandUsage3=/ clear [player] +mailCommandUsage3Description=Clears the mail of the specified player. +mailCommandUsage4=/ send +mailCommandUsage4Description=Sends the specified player the given message +mailCommandUsage5=/ sendall +mailCommandUsage5Description=Sends all players the given message +mailCommandUsage6=/ sendtemp +mailCommandUsage6Description=Sends the specified player the given message which will expire in the specified time +mailCommandUsage7=/ sendtempall +mailCommandUsage7Description=Sends all players the given message which will expire in the specified time +mailCommandUsage8=/ clearall +mailCommandUsage8Description=Clears the mail of all players mailDelay=Too many mails have been sent within the last minute. Maximum\: {0} mailFormatNew=§6[§r{0}§6] §6[§r{1}§6] §r{2} mailFormatNewTimed=§6[§e⚠§6] §6[§r{0}§6] §6[§r{1}§6] §r{2} From fb5a4d9b57e160ccaf8cc532544333a095324afe Mon Sep 17 00:00:00 2001 From: Division7 Date: Mon, 26 Sep 2022 13:37:55 -0700 Subject: [PATCH 3/7] added requested changes. new clearMail function returns user used on to make it easier to send the return message back to the correct source. --- .../essentials/commands/Commandmail.java | 32 +++++++++---------- .../src/main/resources/messages.properties | 4 +-- .../src/main/resources/messages_en.properties | 4 --- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java index 8824729e8a9..07ccefbd4af 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java @@ -195,17 +195,10 @@ public void run(final Server server, final User user, final String commandLabel, return; } if (args.length >= 2 && "clear".equalsIgnoreCase(args[0])) { - final User u; if (!user.isAuthorized("essentials.mail.clear.others")){ throw new Exception(tl("noPerm", "essentials.mail.clear.others")); } - try { - u = getPlayer(server, args[1], true, true); - } catch (final PlayerNotFoundException e) { - throw new Exception(tl("playerNeverOnServer", args[1])); - } - u.setMailList(null); - user.sendMessage(tl("mailClearedPlayer", u.getDisplayName())); + user.sendMessage(tl("mailClearedPlayer", clearMail(server, args).getDisplayName())); return; } if (args.length >= 1 && "clearall".equalsIgnoreCase(args[0])){ @@ -232,14 +225,7 @@ protected void run(final Server server, final CommandSource sender, final String sender.sendMessage(tl("mailClearedAll")); return; } else if (args.length >= 2 && "clear".equalsIgnoreCase(args[0])) { - final User u; - try { - u = getPlayer(server, args[1], true, true); - } catch (final PlayerNotFoundException e) { - throw new Exception(tl("playerNeverOnServer", args[1])); - } - u.setMailList(null); - sender.sendMessage(tl("mailClearedPlayer", u.getDisplayName())); + sender.sendMessage(tl("mailClearedPlayer", clearMail(server, args).getDisplayName())); return; } else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { final User u; @@ -286,6 +272,18 @@ protected void run(final Server server, final CommandSource sender, final String throw new NotEnoughArgumentsException(); } + protected User clearMail(final Server server, final String[] args) throws Exception { + final User u; + try { + u = getPlayer(server, args[1], true, true); + } catch (final PlayerNotFoundException e) { + throw new Exception(tl("playerNeverOnServer", args[1])); + } + u.setMailList(null); + + return u; + } + private class SendAll implements Runnable { private final IMessageRecipient messageRecipient; private final String message; @@ -329,7 +327,7 @@ protected List getTabCompleteOptions(final Server server, final User use } return options; } else if (args.length == 2) { - if ((args[0].equalsIgnoreCase("send") && user.isAuthorized("essentials.mail.send")) || (args[0].equalsIgnoreCase("sendtemp") && user.isAuthorized("essentials.mail.sendtemp")) || (args[0].equalsIgnoreCase("clear"))) { + if ((args[0].equalsIgnoreCase("send") && user.isAuthorized("essentials.mail.send")) || (args[0].equalsIgnoreCase("sendtemp") && user.isAuthorized("essentials.mail.sendtemp")) || ((args[0].equalsIgnoreCase("clear"))&& user.isAuthorized("essentials.mail.clear.others"))) { return getPlayers(server, user); } else if (args[0].equalsIgnoreCase("sendtempall") && user.isAuthorized("essentials.mail.sendtempall")) { return COMMON_DATE_DIFFS; diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index 85b54e8207b..7507a497c64 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -684,8 +684,6 @@ mailCommandDescription=Manages inter-player, intra-server mail. mailCommandUsage=/ [read|clear|clear [number]|clear [player]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]|clearall] mailCommandUsage1=/ read [page] mailCommandUsage1Description=Reads the first (or specified) page of your mail -mailCommandUsage2=/ clear [number] -mailCommandUsage2Description=Clears either all or the specified mail(s) mailCommandUsage3=/ clear [player] mailCommandUsage3Description=Clears the mail of the specified player. mailCommandUsage4=/ send @@ -696,6 +694,8 @@ mailCommandUsage6=/ sendtemp mailCommandUsage6Description=Sends the specified player the given message which will expire in the specified time mailCommandUsage7=/ sendtempall mailCommandUsage7Description=Sends all players the given message which will expire in the specified time +mailCommandUsage2=/ clear [number] +mailCommandUsage2Description=Clears either all or the specified mail(s) mailCommandUsage8=/ clearall mailCommandUsage8Description=Clears the mail of all players mailDelay=Too many mails have been sent within the last minute. Maximum\: {0} diff --git a/Essentials/src/main/resources/messages_en.properties b/Essentials/src/main/resources/messages_en.properties index 5a2a0dccea4..1fe60838ac1 100644 --- a/Essentials/src/main/resources/messages_en.properties +++ b/Essentials/src/main/resources/messages_en.properties @@ -682,10 +682,6 @@ mailCommandUsage1=/ read [page] mailCommandUsage1Description=Reads the first (or specified) page of your mail mailCommandUsage2=/ clear [number] mailCommandUsage2Description=Clears either all or the specified mail(s) -mailCommandUsage3=/ clear [player] -mailCommandUsage3Description=Clears the mail of the specified player. -mailCommandUsage4=/ send -mailCommandUsage4Description=Sends the specified player the given message mailCommandUsage5=/ sendall mailCommandUsage5Description=Sends all players the given message mailCommandUsage6=/ sendtemp From c38bbdb945ab3d31a96288972d3edadea34302ac Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:45:04 -0400 Subject: [PATCH 4/7] Some changes --- .../essentials/commands/Commandmail.java | 87 ++++++++++--------- .../src/main/resources/messages.properties | 5 +- 2 files changed, 50 insertions(+), 42 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java index 0ec01d9cc69..21090a98858 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java @@ -168,39 +168,41 @@ public void run(final Server server, final User user, final String commandLabel, user.sendMessage(tl("mailSent")); return; } - if (args.length == 1 && "clear".equalsIgnoreCase(args[0]) || (args.length >= 1 && "clear".equalsIgnoreCase(args[0]) && NumberUtil.isPositiveInt(args[1]))) { - final ArrayList mails = user.getMailMessages(); - if (mails == null || mails.size() == 0) { - user.sendMessage(tl("noMail")); - throw new NoChargeException(); - } - + if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) { + User mailUser = user; + int toRemove = -1; if (args.length > 1) { - if (!NumberUtil.isPositiveInt(args[1])) { - throw new NotEnoughArgumentsException(); + if (NumberUtil.isPositiveInt(args[1])) { + toRemove = Integer.parseInt(args[1]); + } else if (!user.isAuthorized("essentials.mail.clear.others")) { + throw new Exception(tl("noPerm", "essentials.mail.clear.others")); + } else { + mailUser = getPlayer(ess.getServer(), user, args, 1, true); + if (args.length > 2 && NumberUtil.isPositiveInt(args[2])) { + toRemove = Integer.parseInt(args[2]); + } } + } - final int toRemove = Integer.parseInt(args[1]); + final ArrayList mails = mailUser.getMailMessages(); + if (mails == null || mails.isEmpty()) { + user.sendMessage(tl(mailUser == user ? "noMail" : "noMailOther", mailUser.getDisplayName())); + throw new NoChargeException(); + } + + if (toRemove > 0) { if (toRemove > mails.size()) { user.sendMessage(tl("mailClearIndex", mails.size())); - return; + throw new NoChargeException(); } mails.remove(toRemove - 1); - user.setMailList(mails); + mailUser.setMailList(mails); } else { - user.setMailList(null); + mailUser.setMailList(null); } - user.sendMessage(tl("mailCleared")); return; } - if (args.length >= 2 && "clear".equalsIgnoreCase(args[0])) { - if (!user.isAuthorized("essentials.mail.clear.others")){ - throw new Exception(tl("noPerm", "essentials.mail.clear.others")); - } - user.sendMessage(tl("mailClearedPlayer", clearMail(server, args).getDisplayName())); - return; - } if (args.length >= 1 && "clearall".equalsIgnoreCase(args[0])){ if (!user.isAuthorized("essentials.mail.clearall")) { throw new Exception(tl("noPerm", "essentials.mail.clearall")); @@ -218,15 +220,32 @@ public void run(final Server server, final User user, final String commandLabel, protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length >= 1 && "read".equalsIgnoreCase(args[0])) { throw new Exception(tl("onlyPlayers", commandLabel + " read")); - } else if (args.length == 1 && "clear".equalsIgnoreCase(args[0])) { - throw new Exception(tl("onlyPlayers", commandLabel + " clear")); + } else if (args.length > 1 && "clear".equalsIgnoreCase(args[0])) { + final User mailUser = getPlayer(server, args[1], true, true); + final int toRemove = args.length > 2 ? NumberUtil.isPositiveInt(args[2]) ? Integer.parseInt(args[2]) : -1 : -1; + + final ArrayList mails = mailUser.getMailMessages(); + if (mails == null || mails.isEmpty()) { + sender.sendMessage(tl("noMailOther", mailUser.getDisplayName())); + throw new NoChargeException(); + } + + if (toRemove > 0) { + if (toRemove > mails.size()) { + sender.sendMessage(tl("mailClearIndex", mails.size())); + throw new NoChargeException(); + } + mails.remove(toRemove - 1); + mailUser.setMailList(mails); + } else { + mailUser.setMailList(null); + } + sender.sendMessage(tl("mailCleared")); + return; } else if (args.length >= 1 && "clearall".equalsIgnoreCase(args[0])){ ess.runTaskAsynchronously(new ClearAll()); sender.sendMessage(tl("mailClearedAll")); return; - } else if (args.length >= 2 && "clear".equalsIgnoreCase(args[0])) { - sender.sendMessage(tl("mailClearedPlayer", clearMail(server, args).getDisplayName())); - return; } else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { final User u; try { @@ -272,18 +291,6 @@ protected void run(final Server server, final CommandSource sender, final String throw new NotEnoughArgumentsException(); } - protected User clearMail(final Server server, final String[] args) throws Exception { - final User u; - try { - u = getPlayer(server, args[1], true, true); - } catch (final PlayerNotFoundException e) { - throw new Exception(tl("playerNeverOnServer", args[1])); - } - u.setMailList(null); - - return u; - } - private class SendAll implements Runnable { private final IMessageRecipient messageRecipient; private final String message; @@ -381,8 +388,8 @@ protected List getTabCompleteOptions(final Server server, final CommandS private class ClearAll implements Runnable { @Override public void run() { - for (UUID userid : ess.getUserMap().getAllUniqueUsers()) { - final User user = ess.getUserMap().getUser(userid); + for (UUID u : ess.getUsers().getAllUserUUIDs()) { + final User user = ess.getUsers().loadUncachedUser(u); if (user != null) { user.setMailList(null); } diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index db8fd9495ef..aa21da18087 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -711,8 +711,8 @@ loomCommandDescription=Opens up a loom. loomCommandUsage=/ mailClear=\u00a76To clear your mail, type\u00a7c /mail clear\u00a76. mailCleared=\u00a76Mail cleared\! -mailClearedPlayer=\u00a76Mail of {0} cleared!\ -mailClearedAll=\u00a76All players' mail cleared!\ +mailClearedPlayer=\u00a76Mail of {0} cleared! +mailClearedAll=\u00a76All players' mail cleared! mailClearIndex=\u00a74You must specify a number between 1-{0}. mailCommandDescription=Manages inter-player, intra-server mail. mailCommandUsage=/ [read|clear|clear [number]|clear [player]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]|clearall] @@ -859,6 +859,7 @@ noKitPermission=\u00a74You need the \u00a7c{0}\u00a74 permission to use that kit noKits=\u00a76There are no kits available yet. noLocationFound=\u00a74No valid location found. noMail=\u00a76You do not have any mail. +noMailOther=\u00a7c{0} \u00a76does not have any mail. noMatchingPlayers=\u00a76No matching players found. noMetaFirework=\u00a74You do not have permission to apply firework meta. noMetaJson=JSON Metadata is not supported in this version of Bukkit. From d7df7ae1cda8457389adbc5e75c652e7511513b2 Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:48:55 -0400 Subject: [PATCH 5/7] Discard changes to Essentials/src/main/resources/messages_en.properties --- .../src/main/resources/messages_en.properties | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Essentials/src/main/resources/messages_en.properties b/Essentials/src/main/resources/messages_en.properties index 6e06b65237e..01f54669e24 100644 --- a/Essentials/src/main/resources/messages_en.properties +++ b/Essentials/src/main/resources/messages_en.properties @@ -680,21 +680,20 @@ loomCommandUsage=/ mailClear=§6To clear your mail, type§c /mail clear§6. mailCleared=§6Mail cleared\! mailClearIndex=§4You must specify a number between 1-{0}. -mailClearedAll=§6All players' mail cleared! mailCommandDescription=Manages inter-player, intra-server mail. -mailCommandUsage=/ [read|clear|clear [number]|clear [player]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]|clearall] +mailCommandUsage=/ [read|clear|clear [number]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]] mailCommandUsage1=/ read [page] mailCommandUsage1Description=Reads the first (or specified) page of your mail mailCommandUsage2=/ clear [number] mailCommandUsage2Description=Clears either all or the specified mail(s) -mailCommandUsage5=/ sendall -mailCommandUsage5Description=Sends all players the given message -mailCommandUsage6=/ sendtemp -mailCommandUsage6Description=Sends the specified player the given message which will expire in the specified time -mailCommandUsage7=/ sendtempall -mailCommandUsage7Description=Sends all players the given message which will expire in the specified time -mailCommandUsage8=/ clearall -mailCommandUsage8Description=Clears the mail of all players +mailCommandUsage3=/ send +mailCommandUsage3Description=Sends the specified player the given message +mailCommandUsage4=/ sendall +mailCommandUsage4Description=Sends all players the given message +mailCommandUsage5=/ sendtemp +mailCommandUsage5Description=Sends the specified player the given message which will expire in the specified time +mailCommandUsage6=/ sendtempall +mailCommandUsage6Description=Sends all players the given message which will expire in the specified time mailDelay=Too many mails have been sent within the last minute. Maximum\: {0} mailFormatNew=§6[§r{0}§6] §6[§r{1}§6] §r{2} mailFormatNewTimed=§6[§e⚠§6] §6[§r{0}§6] §6[§r{1}§6] §r{2} From 06bb091a6b43100aba2f515fda2ac88725c3e048 Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:59:40 -0400 Subject: [PATCH 6/7] Some changes 2 --- .../src/main/resources/messages.properties | 29 +++++++++---------- Essentials/src/main/resources/plugin.yml | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index aa21da18087..0892fbbaa2c 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -711,27 +711,26 @@ loomCommandDescription=Opens up a loom. loomCommandUsage=/ mailClear=\u00a76To clear your mail, type\u00a7c /mail clear\u00a76. mailCleared=\u00a76Mail cleared\! -mailClearedPlayer=\u00a76Mail of {0} cleared! -mailClearedAll=\u00a76All players' mail cleared! +mailClearedAll=\u00a76Mail cleared for all players\! mailClearIndex=\u00a74You must specify a number between 1-{0}. mailCommandDescription=Manages inter-player, intra-server mail. -mailCommandUsage=/ [read|clear|clear [number]|clear [player]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]|clearall] +mailCommandUsage=/ [read|clear|clear [number]|clear [number]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]] mailCommandUsage1=/ read [page] mailCommandUsage1Description=Reads the first (or specified) page of your mail -mailCommandUsage3=/ clear [player] -mailCommandUsage3Description=Clears the mail of the specified player. -mailCommandUsage4=/ send -mailCommandUsage4Description=Sends the specified player the given message -mailCommandUsage5=/ sendall -mailCommandUsage5Description=Sends all players the given message -mailCommandUsage6=/ sendtemp -mailCommandUsage6Description=Sends the specified player the given message which will expire in the specified time -mailCommandUsage7=/ sendtempall -mailCommandUsage7Description=Sends all players the given message which will expire in the specified time mailCommandUsage2=/ clear [number] mailCommandUsage2Description=Clears either all or the specified mail(s) -mailCommandUsage8=/ clearall -mailCommandUsage8Description=Clears the mail of all players +mailCommandUsage3=/ clear [number] +mailCommandUsage3Description=Clears either all or the specified mail(s) for the given player +mailCommandUsage4=/ clearall +mailCommandUsage4Description=Clears all mail for the all players +mailCommandUsage5=/ send +mailCommandUsage5Description=Sends the specified player the given message +mailCommandUsage6=/ sendall +mailCommandUsage6Description=Sends all players the given message +mailCommandUsage7=/ sendtemp +mailCommandUsage7Description=Sends the specified player the given message which will expire in the specified time +mailCommandUsage8=/ sendtempall +mailCommandUsage8Description=Sends all players the given message which will expire in the specified time mailDelay=Too many mails have been sent within the last minute. Maximum\: {0} mailFormatNew=\u00a76[\u00a7r{0}\u00a76] \u00a76[\u00a7r{1}\u00a76] \u00a7r{2} mailFormatNewTimed=\u00a76[\u00a7e\u26a0\u00a76] \u00a76[\u00a7r{0}\u00a76] \u00a76[\u00a7r{1}\u00a76] \u00a7r{2} diff --git a/Essentials/src/main/resources/plugin.yml b/Essentials/src/main/resources/plugin.yml index 0ec11754b2a..f9a8c44d741 100644 --- a/Essentials/src/main/resources/plugin.yml +++ b/Essentials/src/main/resources/plugin.yml @@ -290,7 +290,7 @@ commands: aliases: [eloom] mail: description: Manages inter-player, intra-server mail. - usage: / [read|clear|clear [number]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]] + usage: / [read|clear|clear [number]|clear [number]|send [to] [message]|sendtemp [to] [expire time] [message]|sendall [message]] aliases: [email,eemail,memo,ememo] me: description: Describes an action in the context of the player. From fe3a6c85dd5952b45680624a8b6075286d71d67b Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Tue, 8 Aug 2023 14:00:41 -0400 Subject: [PATCH 7/7] MMMM --- .../main/java/com/earth2me/essentials/commands/Commandmail.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java index 21090a98858..762a3cc142e 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandmail.java @@ -397,5 +397,3 @@ public void run() { } } } - -