diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java index e30923010bd..c8d95300c5c 100644 --- a/Mage.Server/src/main/java/mage/server/ChatManager.java +++ b/Mage.Server/src/main/java/mage/server/ChatManager.java @@ -122,20 +122,28 @@ public class ChatManager { } } + private static final String COMMANDS_LIST = + "
List of commands:" + + "
\\history or \\h [username] - shows the history of a player" + + "
\\me - shows the history of the current player" + + "
\\list or \\l - Show a list of commands" + + "
\\whisper or \\w [player name] [text] - whisper to the player with the given name"; + private boolean performUserCommand(User user, String message, UUID chatId, boolean doError) { String command = message.substring(1).trim().toUpperCase(Locale.ENGLISH); if (doError) { - message += new StringBuilder("
Invalid User Command '" + message + "'.") - .append("
List of commands:") - .append("
\\history or \\h [username] - shows the history of a player") - .append("
\\list or \\l - Show a list of commands") - .append("
\\whisper or \\w [player name] [text] - whisper to the player with the given name").toString(); + message += new StringBuilder("
Invalid User Command '" + message + "'.").append(COMMANDS_LIST).toString(); chatSessions.get(chatId).broadcastInfoToUser(user, message); return true; } if (command.startsWith("H ") || command.startsWith("HISTORY ")) { - message = UserManager.getInstance().getUserHistory(message.substring(command.startsWith("H ") ? 3 : 9)); + message += "
" + UserManager.getInstance().getUserHistory(message.substring(command.startsWith("H ") ? 3 : 9)); + chatSessions.get(chatId).broadcastInfoToUser(user, message); + return true; + } + if (command.equals("ME")) { + message += "
" + UserManager.getInstance().getUserHistory(user.getName()); chatSessions.get(chatId).broadcastInfoToUser(user, message); return true; } @@ -159,10 +167,7 @@ public class ChatManager { } } if (command.equals("L") || command.equals("LIST")) { - message += new StringBuilder("
List of commands:") - .append("
\\history or \\h [username] - shows the history of a player") - .append("
\\list or \\l - Show a list of commands") - .append("
\\whisper or \\w [player name] [text] - whisper to the player with the given name").toString(); + message += COMMANDS_LIST; chatSessions.get(chatId).broadcastInfoToUser(user, message); return true; }