diff --git a/src/de/steamwar/bungeecore/commands/ModCommand.java b/src/de/steamwar/bungeecore/commands/ModCommand.java index 29a788de..e9c7077f 100644 --- a/src/de/steamwar/bungeecore/commands/ModCommand.java +++ b/src/de/steamwar/bungeecore/commands/ModCommand.java @@ -7,12 +7,16 @@ import de.steamwar.bungeecore.sql.UserGroup; import de.steamwar.command.SWCommand; import net.md_5.bungee.api.connection.ProxiedPlayer; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.SQLSyntaxErrorException; + public class ModCommand extends SWCommand { private static final Statement set = new Statement("UPDATE Mods Set ModType = ? WHERE ModName = ?"); - private static final Statement findFirst = new Statement("SELECT * FROM Mods WHERE modType = 0 LIMIT 1"); + private static final Statement findFirst = new Statement("SELECT * FROM Mods WHERE ModType = 0 LIMIT 1"); - private static final Statement exists = new Statement("SELECT * FROM Mods WHERE ModName = ?"); + private static final Statement get = new Statement("SELECT * FROM Mods WHERE ModName = ?"); public ModCommand() { super("mod", "bungeecore.teamchat", "mods"); @@ -28,6 +32,15 @@ public class ModCommand extends SWCommand { return; } + boolean modExists = get.select(ResultSet::next,modName); + + System.out.println(modExists); + + if(!modExists) { + Message.send("MOD_COMMAND_NOT_FOUND_IN_DATABASE",p,modName); + return; + } + set.update(newModType,modName); Message.send("MOD_CHANGED_TYPE",p,modName,newModType);