Add local echo of mail being sent on /mail send.

This commit is contained in:
KHobbits 2014-06-05 00:07:27 +01:00
parent 5a2fd19bcf
commit 9d9af25c7f
24 changed files with 58 additions and 8 deletions

View File

@ -1,6 +1,7 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n.tl;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil;
import com.earth2me.essentials.utils.StringUtil;
@ -8,7 +9,6 @@ import org.bukkit.Server;
import java.util.List;
import static com.earth2me.essentials.I18n.tl;
import java.util.UUID;
@ -58,13 +58,15 @@ public class Commandmail extends EssentialsCommand
{
throw new Exception(tl("playerNeverOnServer", args[1]));
}
final String mail = user.getName() + ": " + StringUtil.sanitizeString(FormatUtil.stripFormat(getFinalArg(args, 2)));
if (mail.length() > 1000)
{
throw new Exception(tl("mailTooLong"));
}
if (!u.isIgnoredPlayer(user))
{
final String mail = user.getName() + ": " + StringUtil.sanitizeString(FormatUtil.stripFormat(getFinalArg(args, 2)));
if (mail.length() > 1000)
{
throw new Exception(tl("mailTooLong"));
}
if (Math.abs(System.currentTimeMillis() - timestamp) > 60000)
{
timestamp = System.currentTimeMillis();
@ -75,9 +77,11 @@ public class Commandmail extends EssentialsCommand
{
throw new Exception(tl("mailDelay", ess.getSettings().getMailsPerMinute()));
}
u.addMail(mail);
u.addMail(tl("mailMessage", mail));
}
user.sendMessage(tl("mailSent"));
user.sendMessage(tl("mailSentTo", u.getDisplayName(), u.getName()));
user.sendMessage(mail);
return;
}
if (args.length > 1 && "sendall".equalsIgnoreCase(args[0]))

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}

View File

@ -551,3 +551,5 @@ unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable
itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail:
mailMessage={0}