mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Renamed command to SendCommand
This commit is contained in:
@@ -36,11 +36,11 @@ public class Main {
|
||||
String ticTacToeGameId = ticTacToeGame.get();
|
||||
GlobalEventBus.post(new Events.ServerEvents.RunTicTacToeGame(serverId, ticTacToeGameId));
|
||||
|
||||
GlobalEventBus.post(new Events.ServerEvents.Command(
|
||||
GlobalEventBus.post(new Events.ServerEvents.SendCommand(
|
||||
connectionId,
|
||||
"gameid " + ticTacToeGameId, "player J", "MOVE", "0"
|
||||
));
|
||||
GlobalEventBus.post(new Events.ServerEvents.Command(
|
||||
GlobalEventBus.post(new Events.ServerEvents.SendCommand(
|
||||
connectionId,
|
||||
"gameid " + ticTacToeGameId, "player P", "MOVE", "1"
|
||||
));
|
||||
|
||||
@@ -129,7 +129,7 @@ public class Events implements IEvents {
|
||||
/**
|
||||
* Triggers sending a command to a server.
|
||||
*/
|
||||
public record Command(String connectionId, String... args) { }
|
||||
public record SendCommand(String connectionId, String... args) { }
|
||||
|
||||
/**
|
||||
* Triggers when a command is sent to a server.
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ConnectionManager {
|
||||
public ConnectionManager() {
|
||||
GlobalEventBus.subscribeAndRegister(Events.ServerEvents.StartConnectionRequest.class, this::handleStartConnectionRequest);
|
||||
GlobalEventBus.subscribeAndRegister(Events.ServerEvents.StartConnection.class, this::handleStartConnection);
|
||||
GlobalEventBus.subscribeAndRegister(Events.ServerEvents.Command.class, this::handleCommand);
|
||||
GlobalEventBus.subscribeAndRegister(Events.ServerEvents.SendCommand.class, this::handleCommand);
|
||||
GlobalEventBus.subscribeAndRegister(Events.ServerEvents.Reconnect.class, this::handleReconnect);
|
||||
GlobalEventBus.subscribeAndRegister(Events.ServerEvents.ChangeConnection.class, this::handleChangeConnection);
|
||||
GlobalEventBus.subscribeAndRegister(Events.ServerEvents.ForceCloseAllConnections.class, _ -> shutdownAll());
|
||||
@@ -55,7 +55,7 @@ public class ConnectionManager {
|
||||
));
|
||||
}
|
||||
|
||||
private void handleCommand(Events.ServerEvents.Command event) { // TODO: Move this to ServerConnection class, keep it internal.
|
||||
private void handleCommand(Events.ServerEvents.SendCommand event) { // TODO: Move this to ServerConnection class, keep it internal.
|
||||
ServerConnection serverConnection = this.serverConnections.get(event.connectionId());
|
||||
if (serverConnection != null) {
|
||||
serverConnection.sendCommandByString(event.args());
|
||||
|
||||
Reference in New Issue
Block a user