mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Some more changes to Server Console and Admin server handling.
This commit is contained in:
parent
e697cae98d
commit
c03dc6c2b5
13 changed files with 113 additions and 60 deletions
|
|
@ -69,33 +69,39 @@ public class ChatSession {
|
|||
}
|
||||
}
|
||||
|
||||
public void kill(UUID userId, DisconnectReason reason) {
|
||||
public void kill(UUID userId, DisconnectReason reason) {
|
||||
|
||||
try {
|
||||
if (reason == null) {
|
||||
logger.fatal("User kill without disconnect reason userId: " + userId) ;
|
||||
logger.fatal("User kill without disconnect reason userId: " + userId);
|
||||
reason = DisconnectReason.Undefined;
|
||||
}
|
||||
if (reason != null && userId != null && clients.containsKey(userId)) {
|
||||
String userName = clients.get(userId);
|
||||
clients.remove(userId);
|
||||
logger.debug(userName + "(" + reason.toString() +")" + " removed from chatId " + chatId) ;
|
||||
logger.debug(userName + "(" + reason.toString() + ")" + " removed from chatId " + chatId);
|
||||
String message;
|
||||
switch (reason) {
|
||||
case Disconnected:
|
||||
message = " has left XMage";
|
||||
break;
|
||||
case LostConnection:
|
||||
case LostConnection:
|
||||
message = " has lost connection";
|
||||
break;
|
||||
default:
|
||||
message = " left (" + reason.toString() +")";
|
||||
case SessionExpired:
|
||||
message = " session expired";
|
||||
break;
|
||||
case CleaningUp:
|
||||
message = null;
|
||||
break;
|
||||
default:
|
||||
message = " left (" + reason.toString() + ")";
|
||||
}
|
||||
if (message != null) {
|
||||
broadcast(null, new StringBuilder(userName).append(message).toString(), MessageColor.BLUE, true, MessageType.STATUS);
|
||||
broadcast(null, userName + message, MessageColor.BLUE, true, MessageType.STATUS);
|
||||
}
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
logger.fatal("exception: " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -967,7 +967,7 @@ public class MageServerImpl implements MageServer {
|
|||
public List<UserView> execute() throws MageException {
|
||||
List<UserView> users = new ArrayList<>();
|
||||
for (User user : UserManager.getInstance().getUsers()) {
|
||||
users.add(new UserView(user.getName(), "", user.getSessionId(), user.getConnectionTime()));
|
||||
users.add(new UserView(user.getName(), user.getHost(), user.getSessionId(), user.getConnectionTime()));
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import mage.server.util.ThreadExecutor;
|
||||
import mage.view.ChatMessage;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue