SteamWar/SpigotCore
Archiviert
13
0

Removing SQLException

Dieser Commit ist enthalten in:
Lixfel 2019-12-05 11:03:24 +01:00
Ursprung bd6b5f48c3
Commit 602a4d1098

Datei anzeigen

@ -147,11 +147,12 @@ public class Schematic {
updateDB();
}
public Clipboard load() throws WrongVersionException, SQLException, IOException, NoClipboardException {
public Clipboard load() throws WrongVersionException, IOException, NoClipboardException {
if(Core.getVersion() <= 12 && schemFormat)
throw new WrongVersionException();
ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = " + schemID);
try {
rs.next();
InputStream is = rs.getBlob("SchemData").getBinaryStream();
switch(Core.getVersion()){
@ -162,13 +163,17 @@ public class Schematic {
default:
return Schematic_12.getClipboard(is);
}
} catch (SQLException e) {
throw new IOException(e);
}
}
public void loadToPlayer(Player player) throws SQLException, IOException, NoClipboardException, WrongVersionException {
public void loadToPlayer(Player player) throws IOException, NoClipboardException, WrongVersionException {
if(Core.getVersion() <= 12 && schemFormat)
throw new WrongVersionException();
ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = " + schemID);
try {
rs.next();
InputStream is = rs.getBlob("SchemData").getBinaryStream();
switch(Core.getVersion()){
@ -181,17 +186,21 @@ public class Schematic {
default:
Schematic_12.setPlayerClipboard(player, is);
}
} catch (SQLException e) {
throw new IOException(e);
}
}
public void saveOldFormatFromPlayer(Player player) throws SQLException, IOException, NoClipboardException {
public void saveOldFormatFromPlayer(Player player) throws IOException, NoClipboardException {
saveFromPlayer(player, false);
}
public void saveFromPlayer(Player player) throws SQLException, IOException, NoClipboardException {
public void saveFromPlayer(Player player) throws IOException, NoClipboardException {
saveFromPlayer(player, true);
}
private void saveFromPlayer(Player player, boolean newFormat) throws SQLException, IOException, NoClipboardException {
private void saveFromPlayer(Player player, boolean newFormat) throws IOException, NoClipboardException {
try{
PreparedStatement st = SQL.getCon().prepareStatement("UPDATE Schematic SET SchemData = ?, SchemFormat = ? WHERE SchemID = " + schemID);
byte[] data;
switch(Core.getVersion()){
@ -210,6 +219,9 @@ public class Schematic {
st.setBoolean(2, newFormat);
st.executeUpdate();
schemFormat = newFormat;
}catch(SQLException e){
throw new IOException(e);
}
}
public void remove(){