Merge pull request 'Schematic inputstream api' (#112) from schemAPI into master
Reviewed-on: #112 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
6202a78f41
@ -182,21 +182,28 @@ public class Schematic {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Clipboard load() throws IOException, NoClipboardException {
|
public InputStream schemData() throws IOException {
|
||||||
ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = ?", schemID);
|
ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = ?", schemID);
|
||||||
try {
|
try {
|
||||||
rs.next();
|
rs.next();
|
||||||
Blob schemData = rs.getBlob("SchemData");
|
Blob schemData = rs.getBlob("SchemData");
|
||||||
if(schemData == null)
|
if(schemData == null)
|
||||||
throw new IOException("SchemData is null");
|
throw new IOException("SchemData is null");
|
||||||
InputStream is = schemData.getBinaryStream();
|
return schemData.getBinaryStream();
|
||||||
return VersionedCallable.call(new VersionedCallable<>(() -> Schematic_8.getClipboard(is, schemFormat), 8),
|
|
||||||
new VersionedCallable<>(() -> Schematic_14.getClipboard(is, schemFormat), 14));
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Clipboard clipboardFromStream(InputStream is, boolean schemFormat) {
|
||||||
|
return VersionedCallable.call(new VersionedCallable<>(() -> Schematic_8.getClipboard(is, schemFormat), 8),
|
||||||
|
new VersionedCallable<>(() -> Schematic_14.getClipboard(is, schemFormat), 14));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Clipboard load() throws IOException, NoClipboardException {
|
||||||
|
return clipboardFromStream(schemData(), schemFormat);
|
||||||
|
}
|
||||||
|
|
||||||
public void loadToPlayer(Player player) throws IOException, NoClipboardException {
|
public void loadToPlayer(Player player) throws IOException, NoClipboardException {
|
||||||
ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = ?", schemID);
|
ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = ?", schemID);
|
||||||
try {
|
try {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren