SteamWar/BungeeCore
Archiviert
13
2

Add new rank system #303

Zusammengeführt
Lixfel hat 3 Commits von Ranked nach master 2022-03-10 11:45:39 +01:00 zusammengeführt
4 geänderte Dateien mit 111 neuen und 0 gelöschten Zeilen
Nur Änderungen aus Commit 9ec6ea5090 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -36,4 +36,5 @@ public class PacketIdManager {
//0x2(X) Server Information System
public static final byte I_AM_A_LOBBY = 0x20;
public static final byte FIGHT_INFO = 0x21;
public static final byte FIGHT_ENDS = 0x22;
}

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bungeecore.comms;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import de.steamwar.bungeecore.comms.handlers.*;
import de.steamwar.bungeecore.comms.packets.FightEndsPacket;
import de.steamwar.bungeecore.listeners.BasicListener;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.event.PluginMessageEvent;
@ -59,5 +60,6 @@ public class SpigotReceiver extends BasicListener {
registerHandler(PacketIdManager.I_AM_A_LOBBY, new ImALobbyHandler());
registerHandler(PacketIdManager.FIGHT_INFO, new FightInfoHandler());
registerHandler(PacketIdManager.EXECUTE_COMMAND, new ExecuteCommandHandler());
registerHandler(PacketIdManager.FIGHT_ENDS, new FightEndsHandler());
}
}

Datei anzeigen

@ -0,0 +1,34 @@
/*
* 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.bungeecore.comms.handlers;
import com.google.common.io.ByteArrayDataInput;
import de.steamwar.bungeecore.comms.SpigotHandler;
import de.steamwar.bungeecore.comms.packets.FightEndsPacket;
import net.md_5.bungee.api.config.ServerInfo;
public class FightEndsHandler implements SpigotHandler {
@Override
public void handle(ByteArrayDataInput in, ServerInfo info) {
FightEndsPacket fightEndsPacket = new FightEndsPacket(in);
}
}

Datei anzeigen

@ -0,0 +1,74 @@
/*
* 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.bungeecore.comms.packets;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import de.steamwar.bungeecore.comms.BungeePacket;
import de.steamwar.bungeecore.comms.PacketIdManager;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.List;
@AllArgsConstructor
@Getter
public class FightEndsPacket extends BungeePacket {
private byte win;
private int blueSchem;
private int redSchem;
private List<Integer> bluePlayers;
private List<Integer> redPlayers;
public FightEndsPacket(ByteArrayDataInput byteArrayDataInput) {
win = byteArrayDataInput.readByte();
blueSchem = byteArrayDataInput.readInt();
redSchem = byteArrayDataInput.readInt();
int blueSize = byteArrayDataInput.readInt();
for (int i = 0; i < blueSize; i++) {
bluePlayers.add(byteArrayDataInput.readInt());
}
int redSize = byteArrayDataInput.readInt();
for (int i = 0; i < redSize; i++) {
redPlayers.add(byteArrayDataInput.readInt());
}
}
@Override
public int getId() {
return PacketIdManager.FIGHT_ENDS;
}
@Override
public void writeVars(ByteArrayDataOutput byteArrayDataOutput) {
byteArrayDataOutput.writeByte(win);
byteArrayDataOutput.writeInt(blueSchem);
byteArrayDataOutput.writeInt(redSchem);
byteArrayDataOutput.writeInt(bluePlayers.size());
for (int i : bluePlayers) {
byteArrayDataOutput.writeInt(i);
}
byteArrayDataOutput.writeInt(redPlayers.size());
for (int i : redPlayers) {
byteArrayDataOutput.writeInt(i);
}
}
}