Fixing of Big Schems
Dieser Commit ist enthalten in:
Ursprung
7056675fc7
Commit
8fb3f8b066
@ -30,6 +30,8 @@ import org.apache.http.impl.client.HttpClients;
|
||||
import org.bukkit.entity.Player;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
@ -96,8 +98,14 @@ public class ExternalUpDownload {
|
||||
name.append(schemName[i].replace("/", "-"));
|
||||
}
|
||||
Schematic testSchem = Schematic.getSchemFromDB(name.toString(), player.getUniqueId());
|
||||
byte[] schemData = new byte[zipInputStream.available()];
|
||||
zipInputStream.read(schemData);
|
||||
List<Byte> schemData = new ArrayList<>();
|
||||
while (zipInputStream.available() == 1) {
|
||||
schemData.add((byte) zipInputStream.read());
|
||||
}
|
||||
byte[] bytes = new byte[schemData.size()];
|
||||
for (int i = 0; i < schemData.size(); i++) {
|
||||
bytes[i] = schemData.get(i);
|
||||
}
|
||||
if(testSchem != null) {
|
||||
int i = 1;
|
||||
while (true) {
|
||||
@ -110,7 +118,7 @@ public class ExternalUpDownload {
|
||||
}
|
||||
Schematic.createSchem(name.toString(), player.getUniqueId(), "", SchematicType.Normal);
|
||||
Schematic schem = Schematic.getSchemFromDB(name.toString(), player.getUniqueId());
|
||||
schem.saveFromBytes(schemData, schemName[schemName.length - 1].equals("schem"));
|
||||
schem.saveFromBytes(bytes, schemName[schemName.length - 1].equals("schem"));
|
||||
zipInputStream.closeEntry();
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§6Die Schematic §e" + schematic.getName() + " §6wurde von WarGearWorld.net als §e" + name.toString() + " §6heruntergeladen!");
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren