From abd9815de9cc9591f45991a59004fa3def6d4524 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 30 Apr 2020 15:43:58 +0200 Subject: [PATCH] Adding schematic by id method --- SpigotCore_Main/src/de/steamwar/sql/Schematic.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index 9053edf..00a2b6e 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -64,6 +64,17 @@ public class Schematic { } } + public static Schematic getSchemFromDB(int schemID){ + ResultSet schematic = SQL.select("SELECT SchemID, SchemName, SchemOwner, Item, SchemType, SchemFormat FROM Schematic WHERE SchemID = ?", schemID); + try { + if(!schematic.next()) + throw new SecurityException("Failed loading schematic " + schemID); + return new Schematic(schematic); + } catch (SQLException e) { + throw new SecurityException("Failed loading schematic", e); + } + } + public static List getSchemsAccessibleByUser(UUID schemOwner){ return getSchemsAccessibleByUser(SteamwarUser.get(schemOwner).getId()); }