diff --git a/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java b/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java index 2407d6a..97a7d9b 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java +++ b/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java @@ -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; diff --git a/SpigotCore_Main/src/de/steamwar/comms/packets/PrepareSchemPacket.java b/SpigotCore_Main/src/de/steamwar/comms/packets/PrepareSchemPacket.java new file mode 100644 index 0000000..99f2ecc --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/comms/packets/PrepareSchemPacket.java @@ -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 . +*/ + +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()); + } +}