SteamWar/SpigotCore
Archiviert
13
0

SchemMember bugfix

Dieser Commit ist enthalten in:
Lixfel 2019-03-31 17:50:18 +02:00
Ursprung 0b2248de9a
Commit c0ecde6fd4
2 geänderte Dateien mit 20 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -49,8 +49,12 @@ public class Schematic {
ResultSet schematic = sql.select("SELECT * FROM Schematic WHERE SchemName = '" + schemName + "' AND SchemOwner = '" + schemOwner + "'");
try {
if(schematic == null || !schematic.next()){
SchematicMember member = SchematicMember.getMemberBySchematic(schemName, schemOwner);
if(member == null){
return null;
}
return getSchemFromDB(schemName, member.getSchemOwner());
}
String item = schematic.getString("Item");
SchematicType schemType = SchematicType.valueOf(schematic.getString("SchemType"));
return new Schematic(schemName, schemOwner, item, schemType, false);
@ -133,5 +137,6 @@ public class Schematic {
public void remove(){
sql.update("DELETE FROM Schematic WHERE SchemOwner = " + SchemOwner + " AND SchemName = '" + SchemName + "'");
sql.update("DELETE FROM SchemMember WHERE SchemOwner = " + SchemOwner + " AND SchemName = '" + SchemName + "'");
}
}

Datei anzeigen

@ -53,6 +53,20 @@ public class SchematicMember {
return null;
}
public static SchematicMember getMemberBySchematic(String schemName, int schemMember){
ResultSet schematicMember = sql.select("SELECT * FROM SchemMember WHERE SchemName = '" + schemName + "' AND Member = '" + schemMember + "'");
try {
if(schematicMember == null || !schematicMember.next()){
return null;
}
int schemOwner = schematicMember.getInt("SchemOwner");
return new SchematicMember(schemName, schemOwner, schemMember, false);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
public static List<SchematicMember> getSchemMembers(String schemName, UUID schemOwner){
return getSchemMembers(schemName, WarkingUser.get(schemOwner).getId());
}