mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
spjspj - Fix with error message.
This commit is contained in:
parent
2aceb3fcef
commit
81e5c2b50e
1 changed files with 13 additions and 3 deletions
|
@ -112,8 +112,8 @@ public class ChatManager {
|
||||||
if (message.startsWith("\\") || message.startsWith("/")) {
|
if (message.startsWith("\\") || message.startsWith("/")) {
|
||||||
User user = UserManager.getInstance().getUserByName(userName);
|
User user = UserManager.getInstance().getUserByName(userName);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
if (!performUserCommand(user, message, chatId)) {
|
if (!performUserCommand(user, message, chatId, false)) {
|
||||||
performUserCommand(user, "/LIST", chatId);
|
performUserCommand(user, message, chatId, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -122,8 +122,18 @@ public class ChatManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean performUserCommand(User user, String message, UUID chatId) {
|
private boolean performUserCommand(User user, String message, UUID chatId, boolean doError) {
|
||||||
String command = message.substring(1).trim().toUpperCase(Locale.ENGLISH);
|
String command = message.substring(1).trim().toUpperCase(Locale.ENGLISH);
|
||||||
|
if (doError) {
|
||||||
|
message += new StringBuilder("<br/>Invalid User Command '" + message + "'.")
|
||||||
|
.append("<br/>List of commands:")
|
||||||
|
.append("<br/>\\history or \\h [username] - shows the history of a player")
|
||||||
|
.append("<br/>\\list or \\l - Show a list of commands")
|
||||||
|
.append("<br/>\\whisper or \\w [player name] [text] - whisper to the player with the given name").toString();
|
||||||
|
chatSessions.get(chatId).broadcastInfoToUser(user, message);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (command.startsWith("H ") || command.startsWith("HISTORY ")) {
|
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);
|
chatSessions.get(chatId).broadcastInfoToUser(user, message);
|
||||||
|
|
Loading…
Reference in a new issue