Search in sources :

Example 26 with RemoteName

use of games.strategy.engine.message.RemoteName in project triplea by triplea-game.

the class ModeratorController method getChatLogHeadlessHostBot.

@Override
public String getChatLogHeadlessHostBot(final INode node, final String hashedPassword, final String salt) {
    assertUserIsAdmin();
    if (serverMessenger.getServerNode().equals(node)) {
        throw new IllegalStateException("Cannot do this for server node");
    }
    final INode modNode = MessageContext.getSender();
    final String mac = getNodeMacAddress(node);
    final RemoteName remoteName = RemoteHostUtils.getRemoteHostUtilsName(node);
    final IRemoteHostUtils remoteHostUtils = (IRemoteHostUtils) allMessengers.getRemoteMessenger().getRemote(remoteName);
    final String response = remoteHostUtils.getChatLogHeadlessHostBot(hashedPassword, salt);
    logger.info(String.format(((response == null || response.equals("Invalid password!")) ? "Failed" : "Successful") + " Remote get Chat Log of Headless HostBot. " + "Host: %s IP: %s Mac: %s Mod Username: %s Mod IP: %s Mod Mac: %s", node.getName(), node.getAddress().getHostAddress(), mac, modNode.getName(), modNode.getAddress().getHostAddress(), getNodeMacAddress(modNode)));
    return response;
}
Also used : RemoteName(games.strategy.engine.message.RemoteName) INode(games.strategy.net.INode)

Example 27 with RemoteName

use of games.strategy.engine.message.RemoteName in project triplea by triplea-game.

the class ModeratorController method shutDownHeadlessHostBot.

@Override
public String shutDownHeadlessHostBot(final INode node, final String hashedPassword, final String salt) {
    assertUserIsAdmin();
    if (serverMessenger.getServerNode().equals(node)) {
        throw new IllegalStateException("Cannot shutdown server node");
    }
    final INode modNode = MessageContext.getSender();
    final String mac = getNodeMacAddress(node);
    logger.info(String.format("Started Remote Shutdown of Headless HostBot. Host: %s IP: %s Mac: %s Mod Username: %s Mod IP: %s Mod Mac: %s", node.getName(), node.getAddress().getHostAddress(), mac, modNode.getName(), modNode.getAddress().getHostAddress(), getNodeMacAddress(modNode)));
    final RemoteName remoteName = RemoteHostUtils.getRemoteHostUtilsName(node);
    final IRemoteHostUtils remoteHostUtils = (IRemoteHostUtils) allMessengers.getRemoteMessenger().getRemote(remoteName);
    final String response = remoteHostUtils.shutDownHeadlessHostBot(hashedPassword, salt);
    logger.info(String.format((response == null ? "Successful" : "Failed (" + response + ")") + " Remote Shutdown of Headless HostBot. " + "Username: %s IP: %s Mac: %s Mod Username: %s Mod IP: %s Mod Mac: %s", node.getName(), node.getAddress().getHostAddress(), mac, modNode.getName(), modNode.getAddress().getHostAddress(), getNodeMacAddress(modNode)));
    return response;
}
Also used : RemoteName(games.strategy.engine.message.RemoteName) INode(games.strategy.net.INode)

Example 28 with RemoteName

use of games.strategy.engine.message.RemoteName in project triplea by triplea-game.

the class ModeratorController method banPlayerHeadlessHostBot.

@Override
public String banPlayerHeadlessHostBot(final INode node, final String playerNameToBeBanned, final int hours, final String hashedPassword, final String salt) {
    assertUserIsAdmin();
    if (serverMessenger.getServerNode().equals(node)) {
        throw new IllegalStateException("Cannot do this for server node");
    }
    final INode modNode = MessageContext.getSender();
    final String mac = getNodeMacAddress(node);
    final RemoteName remoteName = RemoteHostUtils.getRemoteHostUtilsName(node);
    final IRemoteHostUtils remoteHostUtils = (IRemoteHostUtils) allMessengers.getRemoteMessenger().getRemote(remoteName);
    final String response = remoteHostUtils.banPlayerHeadlessHostBot(playerNameToBeBanned, hours, hashedPassword, salt);
    logger.info(String.format((response == null ? "Successful" : "Failed (" + response + ")") + " Remote Ban of " + playerNameToBeBanned + " for " + hours + "hours  In Headless HostBot. Host: %s IP: %s Mac: %s Mod Username: %s Mod IP: %s Mod Mac: %s", node.getName(), node.getAddress().getHostAddress(), mac, modNode.getName(), modNode.getAddress().getHostAddress(), getNodeMacAddress(modNode)));
    return response;
}
Also used : RemoteName(games.strategy.engine.message.RemoteName) INode(games.strategy.net.INode)

Aggregations

RemoteName (games.strategy.engine.message.RemoteName)28 Test (org.junit.jupiter.api.Test)14 INode (games.strategy.net.INode)7 ClientMessenger (games.strategy.net.ClientMessenger)5 IChannelSubscribor (games.strategy.engine.message.IChannelSubscribor)4 RemoteMessenger (games.strategy.engine.message.RemoteMessenger)4 RemoteNotFoundException (games.strategy.engine.message.RemoteNotFoundException)4 IServerMessenger (games.strategy.net.IServerMessenger)4 ServerMessenger (games.strategy.net.ServerMessenger)4 ConnectionLostException (games.strategy.engine.message.ConnectionLostException)2 RemoteMethodCall (games.strategy.engine.message.RemoteMethodCall)2 GameOverException (games.strategy.engine.GameOverException)1 PlayerID (games.strategy.engine.data.PlayerID)1 PlayerList (games.strategy.engine.data.PlayerList)1 IDelegate (games.strategy.engine.delegate.IDelegate)1 DefaultPlayerBridge (games.strategy.engine.gamePlayer.DefaultPlayerBridge)1 IGamePlayer (games.strategy.engine.gamePlayer.IGamePlayer)1 IPlayerBridge (games.strategy.engine.gamePlayer.IPlayerBridge)1 ChannelMessenger (games.strategy.engine.message.ChannelMessenger)1 HubInvoke (games.strategy.engine.message.HubInvoke)1