From 6e348cd6baeed872aab7bd1f7895b2b46eb3b26b Mon Sep 17 00:00:00 2001 From: Yaruma3341 Date: Thu, 30 May 2019 18:36:03 +0200 Subject: [PATCH] CheckedSchematic will now be removed from table when deleting an arena schematic Signed-off-by: yaruma3341 --- .../schematicsystem/commands/SchematicCommand.java | 8 ++++++++ .../warking/schematicsystem/utils/CheckedSchematic.java | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/de/warking/schematicsystem/commands/SchematicCommand.java b/src/de/warking/schematicsystem/commands/SchematicCommand.java index f5755cc..c2db2ad 100644 --- a/src/de/warking/schematicsystem/commands/SchematicCommand.java +++ b/src/de/warking/schematicsystem/commands/SchematicCommand.java @@ -149,6 +149,14 @@ public class SchematicCommand implements CommandExecutor { File file = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId() + "/" + args[1] + ".schematic"); file.delete(); schematic.remove(); + + List checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId()); + for(CheckedSchematic checkedSchematic : checkedSchematics) { + if(checkedSchematic.getSchemOwner() == schematic.getSchemOwner() && + checkedSchematic.getSchemName() == schematic.getSchemName()) + checkedSchematic.remove(); + } + player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7gelöscht."); return false; } else { diff --git a/src/de/warking/schematicsystem/utils/CheckedSchematic.java b/src/de/warking/schematicsystem/utils/CheckedSchematic.java index e5a6d61..aed6631 100644 --- a/src/de/warking/schematicsystem/utils/CheckedSchematic.java +++ b/src/de/warking/schematicsystem/utils/CheckedSchematic.java @@ -1,5 +1,6 @@ package de.warking.schematicsystem.utils; +import de.warking.hunjy.Core; import de.warking.hunjy.MySQL.MySQL; import de.warking.hunjy.MySQL.WarkingUser; @@ -73,6 +74,10 @@ public class CheckedSchematic { return lastDeclined; } + public void remove() { + Core.sql.update("DELETE FROM CheckedSchematic WHERE SchemOwner = " + this.SchemOwner + " AND SchemName = '" + this.SchemName + "'"); + } + public String getSchemName() { return SchemName; }