Fix CheckedSchematic
Dieser Commit ist enthalten in:
Ursprung
0895035b08
Commit
5a840b2194
@ -32,16 +32,14 @@ import java.util.logging.Level;
|
||||
|
||||
public class CheckedSchematic {
|
||||
|
||||
private final String schemName;
|
||||
private final int schemOwner;
|
||||
private final int node;
|
||||
private final int validator;
|
||||
private final Timestamp startTime;
|
||||
private final Timestamp endTime;
|
||||
private final String declineReason;
|
||||
|
||||
private CheckedSchematic(String schemName, int schemOwner, int validator, Timestamp startTime, Timestamp endTime, String declineReason, boolean insertDB){
|
||||
this.schemName = schemName;
|
||||
this.schemOwner = schemOwner;
|
||||
private CheckedSchematic(int node, int validator, Timestamp startTime, Timestamp endTime, String declineReason, boolean insertDB){
|
||||
this.node = node;
|
||||
this.validator = validator;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
@ -50,35 +48,34 @@ public class CheckedSchematic {
|
||||
insertDB();
|
||||
}
|
||||
|
||||
public CheckedSchematic(String schemName, int schemOwner, int validator, Timestamp startTime, Timestamp endTime, String declineReason){
|
||||
this(schemName, schemOwner, validator, startTime, endTime, declineReason, true);
|
||||
public CheckedSchematic(int node, int validator, Timestamp startTime, Timestamp endTime, String declineReason){
|
||||
this(node, validator, startTime, endTime, declineReason, true);
|
||||
}
|
||||
|
||||
public CheckedSchematic(String schemName, UUID schemOwner, UUID validator, Timestamp startTime, Timestamp endTime, String declineReason){
|
||||
this(schemName, SteamwarUser.get(schemOwner).getId(), SteamwarUser.get(validator).getId(), startTime, endTime, declineReason, true);
|
||||
public CheckedSchematic(int node, UUID validator, Timestamp startTime, Timestamp endTime, String declineReason){
|
||||
this(node, SteamwarUser.get(validator).getId(), startTime, endTime, declineReason, true);
|
||||
}
|
||||
|
||||
private void insertDB(){
|
||||
SQL.update("INSERT INTO CheckedSchematic" +
|
||||
" (SchemName, SchemOwner, Validator, StartTime, EndTime, DeclineReason) VALUES (?, ?, ?, ?, ?, ?)",
|
||||
schemName, schemOwner, validator, startTime, endTime, declineReason);
|
||||
" (NodeId, Validator, StartTime, EndTime, DeclineReason) VALUES (?, ?, ?, ?, ?)",
|
||||
node, validator, startTime, endTime, declineReason);
|
||||
}
|
||||
|
||||
public static List<CheckedSchematic> getLastDeclined(UUID schemOwner){
|
||||
return getLastDelined(SteamwarUser.get(schemOwner).getId());
|
||||
public static List<CheckedSchematic> getLastDeclined(SchematicNode node){
|
||||
return getLastDeclined(node.getId());
|
||||
}
|
||||
|
||||
public static List<CheckedSchematic> getLastDelined(int schemOwner){
|
||||
public static List<CheckedSchematic> getLastDeclined(int node){
|
||||
List<CheckedSchematic> lastDeclined = new LinkedList<>();
|
||||
try{
|
||||
ResultSet lastRS = SQL.select("SELECT * FROM CheckedSchematic WHERE SchemOwner = ? AND DeclineReason != '' AND DeclineReason != 'Prüfvorgang abgebrochen' ORDER BY EndTime DESC", schemOwner);
|
||||
ResultSet lastRS = SQL.select("SELECT * FROM CheckedSchematic WHERE NodeId = ? AND DeclineReason != '' AND DeclineReason != 'Prüfvorgang abgebrochen' ORDER BY EndTime DESC", node);
|
||||
while(lastRS.next()){
|
||||
String schemName = lastRS.getString("SchemName");
|
||||
int validator = lastRS.getInt("Validator");
|
||||
Timestamp startTime = lastRS.getTimestamp("StartTime");
|
||||
Timestamp endTime = lastRS.getTimestamp("EndTime");
|
||||
String declineReason = lastRS.getString("DeclineReason");
|
||||
lastDeclined.add(new CheckedSchematic(schemName, schemOwner, validator, startTime, endTime, declineReason, false));
|
||||
lastDeclined.add(new CheckedSchematic(node, validator, startTime, endTime, declineReason, false));
|
||||
}
|
||||
}catch(SQLException e){
|
||||
Bukkit.getLogger().log(Level.SEVERE, "getLastDeclined failed", e);
|
||||
@ -87,15 +84,7 @@ public class CheckedSchematic {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
SQL.update("DELETE FROM CheckedSchematic WHERE SchemOwner = ? AND SchemName = ?", schemOwner, schemName);
|
||||
}
|
||||
|
||||
public String getSchemName() {
|
||||
return schemName;
|
||||
}
|
||||
|
||||
public int getSchemOwner() {
|
||||
return schemOwner;
|
||||
SQL.update("DELETE FROM CheckedSchematic WHERE NodeId", node);
|
||||
}
|
||||
|
||||
public int getValidator() {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren