🎉 Add Network Packets
Dieser Commit ist enthalten in:
Ursprung
9022c62281
Commit
80344df9b0
28
src/de/steamwar/network/packets/NetworkHandler.java
Normale Datei
28
src/de/steamwar/network/packets/NetworkHandler.java
Normale Datei
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets;
|
||||
|
||||
import de.steamwar.network.packets.common.FightInfoPacket;
|
||||
import de.steamwar.network.packets.common.FightEndsPacket;
|
||||
|
||||
public interface NetworkHandler {
|
||||
void handle(FightEndsPacket packet);
|
||||
void handle(FightInfoPacket packet);
|
||||
}
|
43
src/de/steamwar/network/packets/NetworkPacket.java
Normale Datei
43
src/de/steamwar/network/packets/NetworkPacket.java
Normale Datei
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public abstract class NetworkPacket implements Serializable {
|
||||
|
||||
private final Sender sender;
|
||||
|
||||
public NetworkPacket(Sender sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public Sender getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public abstract void handle(NetworkHandler handler);
|
||||
|
||||
public enum Sender {
|
||||
SERVER,
|
||||
CLIENT,
|
||||
BOTH
|
||||
}
|
||||
}
|
30
src/de/steamwar/network/packets/client/ClientNetworkHandler.java
Normale Datei
30
src/de/steamwar/network/packets/client/ClientNetworkHandler.java
Normale Datei
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.client;
|
||||
|
||||
import de.steamwar.network.packets.server.*;
|
||||
|
||||
public interface ClientNetworkHandler {
|
||||
void handle(BaumemberUpdatePacket packet);
|
||||
void handle(CloseInventoryPacket packet);
|
||||
void handle(InventoryPacket packet);
|
||||
void handle(PingPacket packet);
|
||||
void handle(StartingServerPacket packet);
|
||||
}
|
37
src/de/steamwar/network/packets/client/ClientPacket.java
Normale Datei
37
src/de/steamwar/network/packets/client/ClientPacket.java
Normale Datei
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.client;
|
||||
|
||||
import de.steamwar.network.packets.NetworkHandler;
|
||||
import de.steamwar.network.packets.NetworkPacket;
|
||||
import de.steamwar.network.packets.server.ServerNetworkHandler;
|
||||
|
||||
public abstract class ClientPacket extends NetworkPacket {
|
||||
public ClientPacket() {
|
||||
super(Sender.CLIENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(NetworkHandler handler) {
|
||||
handle((ServerNetworkHandler) handler);
|
||||
}
|
||||
|
||||
public abstract void handle(ServerNetworkHandler handler);
|
||||
}
|
36
src/de/steamwar/network/packets/client/ExecuteCommandPacket.java
Normale Datei
36
src/de/steamwar/network/packets/client/ExecuteCommandPacket.java
Normale Datei
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.client;
|
||||
|
||||
import de.steamwar.network.packets.server.ServerNetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExecuteCommandPacket extends ClientPacket {
|
||||
|
||||
private static final long serialVersionUID = 6283457297487602016L;
|
||||
private int playerId;
|
||||
private String command;
|
||||
|
||||
@Override
|
||||
public void handle(ServerNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
33
src/de/steamwar/network/packets/client/ImALobbyPacket.java
Normale Datei
33
src/de/steamwar/network/packets/client/ImALobbyPacket.java
Normale Datei
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.client;
|
||||
|
||||
import de.steamwar.network.packets.server.ServerNetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ImALobbyPacket extends ClientPacket {
|
||||
private static final long serialVersionUID = 8110246509205246654L;
|
||||
|
||||
@Override
|
||||
public void handle(ServerNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
87
src/de/steamwar/network/packets/client/InventoryCallbackPacket.java
Normale Datei
87
src/de/steamwar/network/packets/client/InventoryCallbackPacket.java
Normale Datei
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.client;
|
||||
|
||||
import de.steamwar.network.packets.server.ServerNetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InventoryCallbackPacket extends ClientPacket {
|
||||
private static final long serialVersionUID = -261823209186008718L;
|
||||
private int position;
|
||||
private int owner;
|
||||
private CallbackType type;
|
||||
private ClickType clickType;
|
||||
|
||||
@Override
|
||||
public void handle(ServerNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
|
||||
public enum CallbackType {
|
||||
CLICK,
|
||||
CLOSE,
|
||||
}
|
||||
|
||||
public enum ClickType {
|
||||
LEFT,
|
||||
SHIFT_LEFT,
|
||||
RIGHT,
|
||||
SHIFT_RIGHT,
|
||||
WINDOW_BORDER_LEFT,
|
||||
WINDOW_BORDER_RIGHT,
|
||||
MIDDLE,
|
||||
NUMBER_KEY,
|
||||
DOUBLE_CLICK,
|
||||
DROP,
|
||||
CONTROL_DROP,
|
||||
CREATIVE,
|
||||
UNKNOWN;
|
||||
|
||||
public boolean isKeyboardClick() {
|
||||
return this == NUMBER_KEY || this == DROP || this == CONTROL_DROP;
|
||||
}
|
||||
|
||||
public boolean isCreativeAction() {
|
||||
return this == MIDDLE || this == CREATIVE;
|
||||
}
|
||||
|
||||
public boolean isRightClick() {
|
||||
return this == RIGHT || this == SHIFT_RIGHT;
|
||||
}
|
||||
|
||||
public boolean isLeftClick() {
|
||||
return this == LEFT || this == SHIFT_LEFT || this == DOUBLE_CLICK || this == CREATIVE;
|
||||
}
|
||||
|
||||
public boolean isShiftClick() {
|
||||
return this == SHIFT_LEFT || this == SHIFT_RIGHT || this == CONTROL_DROP;
|
||||
}
|
||||
|
||||
public static ClickType getByName(String name) {
|
||||
for (ClickType type : values()) {
|
||||
if (type.name().equalsIgnoreCase(name)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
37
src/de/steamwar/network/packets/client/PrepareSchemPacket.java
Normale Datei
37
src/de/steamwar/network/packets/client/PrepareSchemPacket.java
Normale Datei
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.client;
|
||||
|
||||
import de.steamwar.network.packets.server.ServerNetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PrepareSchemPacket extends ClientPacket {
|
||||
|
||||
private static final long serialVersionUID = -4798561188105813349L;
|
||||
private int player;
|
||||
private int schem;
|
||||
private int schemType;
|
||||
|
||||
@Override
|
||||
public void handle(ServerNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
36
src/de/steamwar/network/packets/client/TablistNamePacket.java
Normale Datei
36
src/de/steamwar/network/packets/client/TablistNamePacket.java
Normale Datei
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.client;
|
||||
|
||||
import de.steamwar.network.packets.server.ServerNetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TablistNamePacket extends ClientPacket {
|
||||
|
||||
private static final long serialVersionUID = -1709089784235478752L;
|
||||
private int player;
|
||||
private String tablistName;
|
||||
|
||||
@Override
|
||||
public void handle(ServerNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
28
src/de/steamwar/network/packets/common/CommonPacket.java
Normale Datei
28
src/de/steamwar/network/packets/common/CommonPacket.java
Normale Datei
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.common;
|
||||
|
||||
import de.steamwar.network.packets.NetworkPacket;
|
||||
|
||||
public abstract class CommonPacket extends NetworkPacket {
|
||||
public CommonPacket() {
|
||||
super(Sender.BOTH);
|
||||
}
|
||||
}
|
42
src/de/steamwar/network/packets/common/FightEndsPacket.java
Normale Datei
42
src/de/steamwar/network/packets/common/FightEndsPacket.java
Normale Datei
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.common;
|
||||
|
||||
import de.steamwar.network.packets.NetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FightEndsPacket extends CommonPacket {
|
||||
|
||||
private static final long serialVersionUID = 1279352415549011332L;
|
||||
private byte win;
|
||||
private int blueSchem;
|
||||
private int redSchem;
|
||||
private List<Integer> bluePlayers;
|
||||
private List<Integer> redPlayers;
|
||||
private String gameMode;
|
||||
|
||||
@Override
|
||||
public void handle(NetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
50
src/de/steamwar/network/packets/common/FightInfoPacket.java
Normale Datei
50
src/de/steamwar/network/packets/common/FightInfoPacket.java
Normale Datei
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.common;
|
||||
|
||||
import de.steamwar.network.packets.NetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FightInfoPacket extends CommonPacket{
|
||||
|
||||
private static final long serialVersionUID = 7448644597856605853L;
|
||||
private String serverName; // Name of the Server
|
||||
private String gameMode; // GameMode aka Schematictype (if known, else "")
|
||||
private String arena; // Name of the arena
|
||||
private String blueName; // Name of the blue team, expected to begin with "§a" colorcode
|
||||
private String redName; // Name of the red team, expected to begin with "§a" colorcode
|
||||
private String fightState; // Fight state (technical term) (if known, else "")
|
||||
private int countdown; // Countdown state in seconds (if known, else 0)
|
||||
private int blueLeader; // SWUserID of the blue team leader (if known, else 0)
|
||||
private int redLeader; // SWUserID of the red team leader (if known, else 0)
|
||||
private int blueSchem; // Blue SchemID (if known, else 0)
|
||||
private int redSchem; // Red SchemID (if known, else 0)
|
||||
private List<Integer> bluePlayers; // List of Blue SWUserIDs
|
||||
private List<Integer> redPlayers; // List of Red SWUserIDs
|
||||
private List<Integer> spectators; // List of Spectator SWUserIDs
|
||||
|
||||
@Override
|
||||
public void handle(NetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
33
src/de/steamwar/network/packets/server/BaumemberUpdatePacket.java
Normale Datei
33
src/de/steamwar/network/packets/server/BaumemberUpdatePacket.java
Normale Datei
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.server;
|
||||
|
||||
import de.steamwar.network.packets.client.ClientNetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BaumemberUpdatePacket extends ServerPacket{
|
||||
private static final long serialVersionUID = 6863118892424244051L;
|
||||
|
||||
@Override
|
||||
public void handle(ClientNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
35
src/de/steamwar/network/packets/server/CloseInventoryPacket.java
Normale Datei
35
src/de/steamwar/network/packets/server/CloseInventoryPacket.java
Normale Datei
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.server;
|
||||
|
||||
import de.steamwar.network.packets.client.ClientNetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CloseInventoryPacket extends ServerPacket {
|
||||
|
||||
private static final long serialVersionUID = -2191021190060504521L;
|
||||
private int playerId;
|
||||
|
||||
@Override
|
||||
public void handle(ClientNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
40
src/de/steamwar/network/packets/server/InventoryPacket.java
Normale Datei
40
src/de/steamwar/network/packets/server/InventoryPacket.java
Normale Datei
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.server;
|
||||
|
||||
import de.steamwar.network.packets.client.ClientNetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class InventoryPacket extends ServerPacket {
|
||||
|
||||
private static final long serialVersionUID = 8071052544654047316L;
|
||||
private String title;
|
||||
private int player;
|
||||
private int size;
|
||||
private Map<Integer, String> items;
|
||||
|
||||
@Override
|
||||
public void handle(ClientNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
32
src/de/steamwar/network/packets/server/PingPacket.java
Normale Datei
32
src/de/steamwar/network/packets/server/PingPacket.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.server;
|
||||
|
||||
import de.steamwar.network.packets.client.ClientNetworkHandler;
|
||||
|
||||
public class PingPacket extends ServerPacket {
|
||||
private static final long serialVersionUID = 714647343959550378L;
|
||||
private int id;
|
||||
|
||||
@Override
|
||||
public void handle(ClientNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
30
src/de/steamwar/network/packets/server/ServerNetworkHandler.java
Normale Datei
30
src/de/steamwar/network/packets/server/ServerNetworkHandler.java
Normale Datei
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.server;
|
||||
|
||||
import de.steamwar.network.packets.client.*;
|
||||
|
||||
public interface ServerNetworkHandler {
|
||||
void handle(ExecuteCommandPacket packet);
|
||||
void handle(ImALobbyPacket packet);
|
||||
void handle(InventoryCallbackPacket packet);
|
||||
void handle(PrepareSchemPacket packet);
|
||||
void handle(TablistNamePacket packet);
|
||||
}
|
37
src/de/steamwar/network/packets/server/ServerPacket.java
Normale Datei
37
src/de/steamwar/network/packets/server/ServerPacket.java
Normale Datei
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.server;
|
||||
|
||||
import de.steamwar.network.packets.NetworkHandler;
|
||||
import de.steamwar.network.packets.NetworkPacket;
|
||||
import de.steamwar.network.packets.client.ClientNetworkHandler;
|
||||
|
||||
public abstract class ServerPacket extends NetworkPacket {
|
||||
public ServerPacket() {
|
||||
super(Sender.SERVER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(NetworkHandler handler) {
|
||||
handle((ClientNetworkHandler) handler);
|
||||
}
|
||||
|
||||
public abstract void handle(ClientNetworkHandler handler);
|
||||
}
|
34
src/de/steamwar/network/packets/server/StartingServerPacket.java
Normale Datei
34
src/de/steamwar/network/packets/server/StartingServerPacket.java
Normale Datei
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.network.packets.server;
|
||||
|
||||
import de.steamwar.network.packets.client.ClientNetworkHandler;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StartingServerPacket extends ServerPacket {
|
||||
private static final long serialVersionUID = 2808607245898121801L;
|
||||
private int user;
|
||||
|
||||
@Override
|
||||
public void handle(ClientNetworkHandler handler) {
|
||||
handler.handle(this);
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren