SteamWar/SpigotCore
Archiviert
13
0

Just a stupid error

Dieser Commit ist enthalten in:
Chaoscaot 2021-03-03 21:05:04 +01:00
Ursprung 6310c9f921
Commit 8ca2d97034
2 geänderte Dateien mit 28 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.inventory; package de.steamwar.inventory;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType; import de.steamwar.sql.SchematicType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -115,7 +116,29 @@ public class SWListInv<T> extends SWInventory {
return onlinePlayers; 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<SWListEntry<SchematicNode>> schemList = new ArrayList<>();
List<SchematicNode> schems; List<SchematicNode> schems;

Datei anzeigen

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