SteamWar/BungeeCore
Archiviert
13
2

Check if mod exists in database
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
zOnlyKroks 2023-01-04 15:15:16 +01:00
Ursprung 1bec6c4cd4
Commit e0a1542b03

Datei anzeigen

@ -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);