Merge branch 'master' into fight-replays
Dieser Commit ist enthalten in:
Commit
bf192a6164
@ -20,14 +20,18 @@
|
|||||||
package de.steamwar.comms;
|
package de.steamwar.comms;
|
||||||
|
|
||||||
public class PacketIdManager {
|
public class PacketIdManager {
|
||||||
|
private PacketIdManager(){}
|
||||||
|
|
||||||
//0x0(X) Standalone Packets
|
//0x0(X) Standalone Packets
|
||||||
public final static byte PING_PACKET = 0x01;
|
public static final byte PING_PACKET = 0x01;
|
||||||
public final static byte TABLIST_NAME = 0x02;
|
public static final byte TABLIST_NAME = 0x02;
|
||||||
public static final byte PREPARE_SCHEM = 0x03;
|
public static final byte PREPARE_SCHEM = 0x03;
|
||||||
public final static byte BAUMEMBER_UPDATE = 0x04;
|
public static final byte BAUMEMBER_UPDATE = 0x04;
|
||||||
//0x1(X) Bungee Inventory
|
//0x1(X) Bungee Inventory
|
||||||
public final static byte INVENTORY_PACKET = 0x10;
|
public static final byte INVENTORY_PACKET = 0x10;
|
||||||
public final static byte INVENTORY_CALLBACK_PACKET = 0x11;
|
public static final byte INVENTORY_CALLBACK_PACKET = 0x11;
|
||||||
public final static byte INVENTORY_CLOSE_PACKET = 0x12;
|
public static final byte INVENTORY_CLOSE_PACKET = 0x12;
|
||||||
|
//0x2(X) Server Information System
|
||||||
|
public static final byte I_AM_A_LOBBY = 0x20;
|
||||||
|
public static final byte FIGHT_INFO = 0x21;
|
||||||
}
|
}
|
||||||
|
174
SpigotCore_Main/src/de/steamwar/comms/packets/FightInfoPacket.java
Normale Datei
174
SpigotCore_Main/src/de/steamwar/comms/packets/FightInfoPacket.java
Normale Datei
@ -0,0 +1,174 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 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.comms.packets;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
import de.steamwar.comms.PacketIdManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FightInfoPacket extends SpigotPacket {
|
||||||
|
|
||||||
|
private final String serverName; // Name of the Server, might be changed by Bungee
|
||||||
|
private final String gameMode; // GameMode aka Schematictype (if known, else "")
|
||||||
|
private final String arena; // Name of the arena
|
||||||
|
private final String blueName; // Name of the blue team, expected to begin with "§a" colorcode
|
||||||
|
private final String redName; // Name of the red team, expected to begin with "§a" colorcode
|
||||||
|
private final String fightState; // Fight state (technical term) (if known, else "")
|
||||||
|
private final int countdown; // Countdown state in seconds (if known, else 0)
|
||||||
|
private final int blueLeader; // SWUserID of the blue team leader (if known, else 0)
|
||||||
|
private final int redLeader; // SWUserID of the red team leader (if known, else 0)
|
||||||
|
private final int blueSchem; // Blue SchemID (if known, else 0)
|
||||||
|
private final int redSchem; // Red SchemID (if known, else 0)
|
||||||
|
private final List<Integer> bluePlayers; // List of Blue SWUserIDs
|
||||||
|
private final List<Integer> redPlayers; // List of Red SWUserIDs
|
||||||
|
private final List<Integer> spectators; // List of Spectator SWUserIDs
|
||||||
|
|
||||||
|
public FightInfoPacket(String serverName, String gameMode, String arena, String blueName, String redName, String fightState, int countdown, int blueLeader, int redLeader, int blueSchem, int redSchem, List<Integer> bluePlayers, List<Integer> redPlayers, List<Integer> spectators) {
|
||||||
|
this.serverName = serverName;
|
||||||
|
this.gameMode = gameMode;
|
||||||
|
this.arena = arena;
|
||||||
|
this.blueName = blueName;
|
||||||
|
this.redName = redName;
|
||||||
|
this.fightState = fightState;
|
||||||
|
this.countdown = countdown;
|
||||||
|
this.blueLeader = blueLeader;
|
||||||
|
this.redLeader = redLeader;
|
||||||
|
this.blueSchem = blueSchem;
|
||||||
|
this.redSchem = redSchem;
|
||||||
|
this.bluePlayers = bluePlayers;
|
||||||
|
this.redPlayers = redPlayers;
|
||||||
|
this.spectators = spectators;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FightInfoPacket(ByteArrayDataInput in) {
|
||||||
|
this.serverName = in.readUTF();
|
||||||
|
this.gameMode = in.readUTF();
|
||||||
|
this.arena = in.readUTF();
|
||||||
|
this.blueName = in.readUTF();
|
||||||
|
this.redName = in.readUTF();
|
||||||
|
this.fightState = in.readUTF();
|
||||||
|
this.countdown = in.readInt();
|
||||||
|
this.blueLeader = in.readInt();
|
||||||
|
this.redLeader = in.readInt();
|
||||||
|
this.blueSchem = in.readInt();
|
||||||
|
this.redSchem = in.readInt();
|
||||||
|
this.bluePlayers = readPlayerList(in);
|
||||||
|
this.redPlayers = readPlayerList(in);
|
||||||
|
this.spectators = readPlayerList(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getName() {
|
||||||
|
return PacketIdManager.FIGHT_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeVars(ByteArrayDataOutput out) {
|
||||||
|
out.writeUTF(serverName);
|
||||||
|
out.writeUTF(gameMode);
|
||||||
|
out.writeUTF(arena);
|
||||||
|
out.writeUTF(blueName);
|
||||||
|
out.writeUTF(redName);
|
||||||
|
out.writeUTF(fightState);
|
||||||
|
out.writeInt(countdown);
|
||||||
|
out.writeInt(blueLeader);
|
||||||
|
out.writeInt(redLeader);
|
||||||
|
out.writeInt(blueSchem);
|
||||||
|
out.writeInt(redSchem);
|
||||||
|
writePlayerList(out, bluePlayers);
|
||||||
|
writePlayerList(out, redPlayers);
|
||||||
|
writePlayerList(out, spectators);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServerName() {
|
||||||
|
return serverName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGameMode() {
|
||||||
|
return gameMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArena() {
|
||||||
|
return arena;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBlueName() {
|
||||||
|
return blueName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRedName() {
|
||||||
|
return redName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFightState() {
|
||||||
|
return fightState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCountdown() {
|
||||||
|
return countdown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBlueLeader() {
|
||||||
|
return blueLeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRedLeader() {
|
||||||
|
return redLeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBlueSchem() {
|
||||||
|
return blueSchem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRedSchem() {
|
||||||
|
return redSchem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getBluePlayers() {
|
||||||
|
return bluePlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getRedPlayers() {
|
||||||
|
return redPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getSpectators() {
|
||||||
|
return spectators;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Integer> readPlayerList(ByteArrayDataInput in) {
|
||||||
|
int length = in.readInt();
|
||||||
|
List<Integer> players = new ArrayList<>(length);
|
||||||
|
for(int i = 0; i < length; i++) {
|
||||||
|
players.add(in.readInt());
|
||||||
|
}
|
||||||
|
return players;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writePlayerList(ByteArrayDataOutput out, List<Integer> players) {
|
||||||
|
out.writeInt(players.size());
|
||||||
|
for(Integer player : players) {
|
||||||
|
out.writeInt(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
SpigotCore_Main/src/de/steamwar/comms/packets/ImALobbyPacket.java
Normale Datei
36
SpigotCore_Main/src/de/steamwar/comms/packets/ImALobbyPacket.java
Normale Datei
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 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.comms.packets;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
import de.steamwar.comms.PacketIdManager;
|
||||||
|
|
||||||
|
public class ImALobbyPacket extends SpigotPacket {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getName() {
|
||||||
|
return PacketIdManager.I_AM_A_LOBBY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeVars(ByteArrayDataOutput byteArrayDataOutput) {
|
||||||
|
//no content
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren