SteamWar/BungeeCore
Archiviert
13
2

Update to CommonDB
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2023-02-23 17:33:30 +01:00
Ursprung a4509ab88e
Commit 724246e48e
3 geänderte Dateien mit 3 neuen und 50 gelöschten Zeilen

@ -1 +1 @@
Subproject commit 95b46f3a9a83eb63f5770552134967a1921ae159
Subproject commit d22bb36fc348fae373713b83235cef67010cf020

Datei anzeigen

@ -19,8 +19,8 @@
package de.steamwar.bungeecore.bot.listeners;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.sql.NodeData;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser;
import net.dv8tion.jda.api.entities.Message;
@ -67,7 +67,7 @@ public class PrivateMessageListener extends BasicDiscordListener {
try {
InputStream in = attachment.retrieveInputStream().get();
new SchematicData(node).saveFromStream(in, newFormat);
NodeData.get(node).saveFromStream(in, newFormat);
in.close();
event.getMessage().reply("`" + name + "` wurde erfolgreich hochgeladen").queue();
} catch (Exception e) {

Datei anzeigen

@ -1,47 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.sql;
import de.steamwar.sql.internal.SqlTypeMapper;
import de.steamwar.sql.internal.Statement;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.sql.PreparedStatement;
public class SchematicData {
static {
new SqlTypeMapper<>(BufferedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("PipedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
}
private static final Statement updateDatabase = new Statement("UPDATE SchematicNode SET NodeData = ?, NodeFormat = ? WHERE NodeId = ?");
private final SchematicNode node;
public SchematicData(SchematicNode node) {
this.node = node;
}
public void saveFromStream(InputStream blob, boolean newFormat) {
updateDatabase.update(new BufferedInputStream(blob), newFormat, node.getId());
node.setNodeFormat(newFormat);
}
}