SteamWar/SpigotCore
Archiviert
13
0
Dieser Commit ist enthalten in:
Chaoscaot 2020-10-29 15:35:38 +01:00
Ursprung e52a7983eb
Commit b013be8457
3 geänderte Dateien mit 10 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -26,10 +26,10 @@ import de.steamwar.comms.handlers.InventoryHandler;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.sql.*;
import net.minecraft.server.v1_15_R1.Packet;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.plugin.messaging.PluginMessageListener;
@ -49,7 +49,7 @@ public class BungeeReceiver implements PluginMessageListener {
UUID uuid = SteamwarUser.get(byteArrayDataInput.readInt()).getUUID();
if(Bukkit.getPlayer(uuid).isOnline()) {
Player player = Bukkit.getPlayer(uuid);
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.MASTER, 1, 1);
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
}
});
@ -58,7 +58,7 @@ public class BungeeReceiver implements PluginMessageListener {
Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID());
player.closeInventory();
});
BungeeReceiver.registerHandler((byte) 0x26, byteArrayDataInput -> {
BungeeReceiver.registerHandler((byte) PacketIdManager.CHANGE_ITEM_INV, byteArrayDataInput -> {
Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID());
Schematic schem = Schematic.getSchemFromDB(byteArrayDataInput.readInt());
List<SWListInv.SWListEntry<Material>> materials = new LinkedList<>();
@ -81,10 +81,6 @@ public class BungeeReceiver implements PluginMessageListener {
public void onPluginMessageReceived(String s, Player player, byte[] bytes) {
ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
Byte handler = in.readByte();
if(handlerMap.containsKey(handler))
handlerMap.get(handler).handle(in);
else
throw new SecurityException("Could not find Handler");
}
}

Datei anzeigen

@ -28,6 +28,8 @@ public class PacketIdManager {
public final static byte INVENTORY_CALLBACK_PACKET = 0x11;
public final static byte INVENTORY_CLOSE_PACKET = 0x12;
//0x2(X) Schematic System
public final static byte MATERIALS_GET_PACKET = 0x21;
public final static byte MATERIALS_RETURN_PACKET = 0x22;
public static final byte LOAD_SCHEMATIC = 0x23;
public static final byte SAVE_SCHEMATIC = 0x24;
public static final byte CHECK_SCHEMATIC = 0x25;
public static final byte CHANGE_ITEM_INV = 0x26;
}

Datei anzeigen

@ -61,8 +61,8 @@ public class Schematic {
}
public static void createSchem(String schemName, int schemOwner, String item, SchematicType schemType){
SQL.update("INSERT INTO Schematic (SchemName, SchemOwner, Item, SchemType, Rank) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE Item = VALUES(Item), SchemType = VALUES(SchemType)",
schemName, schemOwner, item, schemType.toDB(), 0);
SQL.update("INSERT INTO Schematic (SchemName, SchemOwner, Item, SchemType) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE Item = VALUES(Item), SchemType = VALUES(SchemType)",
schemName, schemOwner, item, schemType.toDB());
}
public static Schematic getSchemFromDB(String schemName, UUID schemOwner){