diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/CheckSchemType.java index 257c466..f57c958 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -22,6 +22,7 @@ package de.steamwar.schematicsystem; import com.sk89q.worldedit.extent.clipboard.Clipboard; import de.steamwar.core.VersionDependent; import de.steamwar.sql.NoClipboardException; +import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicType; import org.bukkit.Bukkit; @@ -109,7 +110,7 @@ public class CheckSchemType { AutoCheckResult result = new AutoCheckResult(this); Clipboard clipboard; try { - clipboard = schematic.load(); + clipboard = new SchematicData(schematic).load(); } catch (IOException | NoClipboardException e) { Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e); result.setErrorLoadingSchematic(); diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/DownloadCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/DownloadCommand.java index 08e8ea3..3ebc4af 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/DownloadCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/DownloadCommand.java @@ -21,10 +21,7 @@ package de.steamwar.schematicsystem.commands; import de.steamwar.command.SWCommand; import de.steamwar.schematicsystem.SchematicSystem; -import de.steamwar.sql.NoClipboardException; -import de.steamwar.sql.SchematicNode; -import de.steamwar.sql.SchematicType; -import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.*; import org.bukkit.entity.Player; import java.io.IOException; @@ -36,7 +33,7 @@ public class DownloadCommand extends SWCommand { @Register(help = true) public void genericCommand(Player player, String... args) { - SteamwarUser user = SteamwarUser.get(player); + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SchematicNode copyNode = SchematicNode.getSchematicNode(user.getId(), "//copy", 0); boolean newSchem = false; if(copyNode == null) { @@ -45,7 +42,7 @@ public class DownloadCommand extends SWCommand { } try { - copyNode.saveFromPlayer(player); + new SchematicData(copyNode).saveFromPlayer(player); } catch (IOException e) { SchematicSystem.MESSAGE.send("DOWNLOAD_ERROR", player); if(newSchem) { diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java index c2ccbf3..9309a7d 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java @@ -73,7 +73,7 @@ public class GUI { if(node.getOwner() == user.getId()){ if(!node.isDir() && node.getSchemtype().writeable()){ - CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> + CheckedSchematic.getLastDeclinedOfNode(node.getId()).stream().findFirst().ifPresent(checkedSchematic -> inv.setItem(1, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS", player, node.getSchemtype().name()), Collections.singletonList(SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS_LORE", player, checkedSchematic.getDeclineReason().replaceAll("&", "ยง"))), false, click -> {})); } Material mat = SWItem.getMaterial(node.getItem()); @@ -82,7 +82,7 @@ public class GUI { changeItem(player, node, back); }); if(!node.isDir()) { - inv.setItem(6, node.getSchemtype().getMaterial(), SchematicSystem.MESSAGE.parse("GUI_INFO_TYPE", player, node.getSchemtype().name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), node.getSchemtype().fightType(), click -> { + inv.setItem(6, SWItem.getMaterial(node.getSchemtype().getMaterial()), SchematicSystem.MESSAGE.parse("GUI_INFO_TYPE", player, node.getSchemtype().name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), node.getSchemtype().fightType(), click -> { changeType(player, node); }); inv.setItem(7, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), SchematicSystem.MESSAGE.parse("GUI_INFO_DOWNLOAD", player), click -> { @@ -170,7 +170,7 @@ public class GUI { if(!type.isAssignable()) continue; - SWItem item = new SWItem(type.getMaterial(), type.name()); + SWItem item = new SWItem(SWItem.getMaterial(type.getMaterial()), type.name()); if(type.fightType()) item.setEnchanted(true); diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index e21ee72..15d3aed 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -183,7 +183,7 @@ public class SchematicCommand extends SWCommand { } try { - node.saveFromPlayer(player); + new SchematicData(node).saveFromPlayer(player); } catch (NoClipboardException e) { SchematicSystem.MESSAGE.send("COMMAND_SAVE_CLIPBOARD_EMPTY", player); if (newSchem) @@ -748,7 +748,7 @@ public class SchematicCommand extends SWCommand { if(!nodeNullCheck(messageSender, schematicNode)) { return false; } - if(schematicNode.getOwner() != SteamwarUser.get((Player) commandSender).getId()) { + if(schematicNode.getOwner() != SteamwarUser.get(((Player) commandSender).getUniqueId()).getId()) { messageSender.send("COMMAND_NOT_OWN"); return false; } @@ -762,7 +762,7 @@ public class SchematicCommand extends SWCommand { if(!nodeNullCheck(messageSender, schematicNode)) { return false; } - if(schematicNode.getOwner() != SteamwarUser.get((Player) commandSender).getId()) { + if(schematicNode.getOwner() != SteamwarUser.get(((Player) commandSender).getUniqueId()).getId()) { messageSender.send("COMMAND_NOT_OWN"); return false; } diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java index 631e7ee..507047c 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java @@ -242,7 +242,7 @@ public class SchematicCommandUtils { } SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_FORMAT", player, node.getSchemFormat() ? ".schem" : ".schematic"); - CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason())); + CheckedSchematic.getLastDeclinedOfNode(node.getId()).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason())); } else { SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player)); } @@ -361,7 +361,7 @@ public class SchematicCommandUtils { } try { - node.loadToPlayer(player); + new SchematicData(node).loadToPlayer(player); SchematicSystem.MESSAGE.send("UTIL_LOAD_DONE", player, node.getName()); Bukkit.getLogger().log(Level.INFO, "{0} has loaded Schematic {1} {2}", new Object[]{player.getName(), node.getId(), node.getName()}); } catch (NoClipboardException e) {