forked from External/mage
* Server: added /pings chat command to show players and watchers ping info;
This commit is contained in:
parent
17cf3cd129
commit
2079065af3
3 changed files with 48 additions and 3 deletions
|
|
@ -201,7 +201,7 @@ public enum ChatManager {
|
|||
return true;
|
||||
}
|
||||
if (command.startsWith("GAME")) {
|
||||
message += "<br/>" + GameManager.instance.getChatId(chatId);
|
||||
message += "<br/>";
|
||||
ChatSession session = chatSessions.get(chatId);
|
||||
if (session != null && session.getInfo() != null) {
|
||||
String gameId = session.getInfo();
|
||||
|
|
@ -222,7 +222,7 @@ public enum ChatManager {
|
|||
return true;
|
||||
}
|
||||
if (command.startsWith("FIX")) {
|
||||
message += "<br/>" + GameManager.instance.getChatId(chatId);
|
||||
message += "<br/>";
|
||||
ChatSession session = chatSessions.get(chatId);
|
||||
if (session != null && session.getInfo() != null) {
|
||||
String gameId = session.getInfo();
|
||||
|
|
@ -242,6 +242,27 @@ public enum ChatManager {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
if (command.equals("PINGS")) {
|
||||
message += "<br/>";
|
||||
ChatSession session = chatSessions.get(chatId);
|
||||
if (session != null && session.getInfo() != null) {
|
||||
String gameId = session.getInfo();
|
||||
if (gameId.startsWith("Game ")) {
|
||||
UUID id = java.util.UUID.fromString(gameId.substring(5));
|
||||
for (Entry<UUID, GameController> entry : GameManager.instance.getGameController().entrySet()) {
|
||||
if (entry.getKey().equals(id)) {
|
||||
GameController controller = entry.getValue();
|
||||
if (controller != null) {
|
||||
message += controller.getPingsInfo();
|
||||
chatSessions.get(chatId).broadcastInfoToUser(user, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (command.startsWith("CARD ")) {
|
||||
Matcher matchPattern = getCardTextPattern.matcher(message.toLowerCase(Locale.ENGLISH));
|
||||
if (matchPattern.find()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue