SteamWar/SpigotCore
Archiviert
13
0

Merge pull request 'Extracting BungeeGUI Changes' (#73) from spigot-gui-changes into master

Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2020-12-15 19:38:49 +01:00
Commit aebd4dde1b
3 geänderte Dateien mit 11 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -24,7 +24,7 @@ import com.google.common.io.ByteStreams;
import de.steamwar.comms.handlers.BungeeHandler; import de.steamwar.comms.handlers.BungeeHandler;
import de.steamwar.comms.handlers.InventoryHandler; import de.steamwar.comms.handlers.InventoryHandler;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener; import org.bukkit.plugin.messaging.PluginMessageListener;

Datei anzeigen

@ -23,13 +23,16 @@ import com.google.common.io.ByteArrayDataInput;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import de.steamwar.comms.packets.InventoryCallbackPacket;
import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import de.steamwar.comms.packets.*; import org.bukkit.event.inventory.InventoryType;
import java.util.*; import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class InventoryHandler implements BungeeHandler { public class InventoryHandler implements BungeeHandler {
@ -50,7 +53,10 @@ public class InventoryHandler implements BungeeHandler {
} }
SWInventory inventory = new SWInventory(Bukkit.getPlayer(player), size, title, items); SWInventory inventory = new SWInventory(Bukkit.getPlayer(player), size, title, items);
inventory.addCloseCallback(click -> new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player))); inventory.addCloseCallback(click -> {
if(Bukkit.getPlayer(player).getOpenInventory().getType() != InventoryType.CHEST)
new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player));
});
inventory.open(); inventory.open();
} }
} }

Datei anzeigen

@ -138,7 +138,7 @@ public class SWItem {
itemJson.has("color")?itemJson.get("color").getAsByte():0, itemJson.has("color")?itemJson.get("color").getAsByte():0,
itemJson.get("title").getAsString()); itemJson.get("title").getAsString());
}else { }else {
item = new SWItem(Material.valueOf(itemJson.get("material").getAsString()), itemJson.get("title").getAsString()); item = new SWItem(SWItem.getMaterial(itemJson.get("material").getAsString()), itemJson.get("title").getAsString());
} }
}catch (IllegalArgumentException e) { }catch (IllegalArgumentException e) {
item = new SWItem(Material.STONE, itemJson.get("title").getAsString()); item = new SWItem(Material.STONE, itemJson.get("title").getAsString());