SteamWar/SpigotCore
Archiviert
13
0

Merge pull request 'Implementing prepare schem packet' (#96) from prepareSchem into master

Reviewed-on: #96
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Lixfel 2021-04-01 20:21:42 +02:00
Commit 9a9e337706
2 geänderte Dateien mit 52 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -24,6 +24,7 @@ public class PacketIdManager {
//0x0(X) Standalone Packets
public final static byte PING_PACKET = 0x01;
public final static byte TABLIST_NAME = 0x02;
public static final byte PREPARE_SCHEM = 0x03;
//0x1(X) Bungee Inventory
public final static byte INVENTORY_PACKET = 0x10;
public final static byte INVENTORY_CALLBACK_PACKET = 0x11;

Datei anzeigen

@ -0,0 +1,51 @@
/*
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;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
public class PrepareSchemPacket extends SpigotPacket{
private final SteamwarUser user;
private final Schematic schematic;
private final SchematicType schematicType;
public PrepareSchemPacket(SteamwarUser user, Schematic schematic, SchematicType schematicType){
this.user = user;
this.schematic = schematic;
this.schematicType = schematicType;
}
@Override
public int getName() {
return PacketIdManager.PREPARE_SCHEM;
}
@Override
public void writeVars(ByteArrayDataOutput byteArrayDataOutput) {
byteArrayDataOutput.writeInt(user.getId());
byteArrayDataOutput.writeInt(schematic.getSchemID());
byteArrayDataOutput.writeUTF(schematicType.toDB());
}
}