SteamWar/SpigotCore
Archiviert
13
0

Schematic Nodes #90

Zusammengeführt
Lixfel hat 48 Commits von schematic-node nach master 2021-11-20 13:12:32 +01:00 zusammengeführt
2 geänderte Dateien mit 28 neuen und 7 gelöschten Zeilen
Nur Änderungen aus Commit 8ca2d97034 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.inventory;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType;
import org.bukkit.Bukkit;
@ -115,7 +116,29 @@ public class SWListInv<T> extends SWInventory {
return onlinePlayers;
}
public static List<SWListEntry<SchematicNode>> getSchemList(SchematicType type, int steamwarUserId){
public static List<SWListEntry<Schematic>> getSchemList(SchematicType type, int steamwarUserId){
List<SWListEntry<Schematic>> schemList = new ArrayList<>();
List<Schematic> schems;
if(type == null)
schems = Schematic.getSchemsAccessibleByUser(steamwarUserId);
else
schems = Schematic.getSchemsOfType(steamwarUserId, type);
for(Schematic s : schems){
Material m;
if(s.getItem().isEmpty())
m = SWItem.getMaterial("CAULDRON_ITEM");
else
m = SWItem.getMaterial(s.getItem());
SWItem item = new SWItem(m,"§e" + s.getSchemName());
item.setEnchanted(s.getSchemType().fightType());
schemList.add(new SWListEntry<>(item, s));
}
return schemList;
}
public static List<SWListEntry<SchematicNode>> getSchemnodeList(SchematicType type, int steamwarUserId){
List<SWListEntry<SchematicNode>> schemList = new ArrayList<>();
List<SchematicNode> schems;

Datei anzeigen

@ -160,7 +160,7 @@ public class SchematicNode {
}
public static List<SchematicNode> getAllSchematicsOfType(int owner, String schemType) {
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE NodeOwner = ? AND SchemType = ?", owner, schemType);
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE NodeOwner = ? AND NodeType = ?", owner, schemType);
try {
List<SchematicNode> nodes = new ArrayList<>();
while (set.next())
@ -172,7 +172,7 @@ public class SchematicNode {
}
public static List<SchematicNode> getAllSchematicsOfType(String schemType) {
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE SchemType = ?", schemType);
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE NodeType = ?", schemType);
try {
List<SchematicNode> nodes = new ArrayList<>();
while (set.next())
@ -184,8 +184,6 @@ public class SchematicNode {
}
public static List<SchematicNode> getSchematicsOfType(int owner, String schemType, Integer parent) {
if(parent != null && parent == 0)
parent = null;
List<SchematicNode> schems = getAllSchematicsOfType(owner, schemType);
Map<Integer, SchematicNode> nodesInParent = new LinkedHashMap<>();
for (SchematicNode schematicNode : schems) {
@ -354,8 +352,8 @@ public class SchematicNode {
}
private void updateDB() {
SQL.update("UPDATE SchematicNode SET NodeName = ?, NodeOwner = ?, ParentNode = ?, NodeItem = ?, NodeType = ? WHERE NodeId = ?",
name, owner, parent, item, type, id);
SQL.update("UPDATE SchematicNode SET NodeName = ?, NodeOwner = ?, ParentNode = ?, NodeItem = ?, NodeType = ?, NodeRank = ? WHERE NodeId = ?",
name, owner, parent, item, type, rank, id);
}
public void delete() {