Fixing of SchemName
Dieser Commit ist enthalten in:
Ursprung
8fb3f8b066
Commit
3cb522b0aa
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package de.steamwar.schematicsystem;
|
||||
|
||||
import de.steamwar.schematicsystem.commands.SchematicCommand;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import org.apache.http.HttpResponse;
|
||||
@ -95,9 +96,10 @@ public class ExternalUpDownload {
|
||||
for (int i = 0; i < schemName.length - 1; i++) {
|
||||
if(!name.toString().equals(""))
|
||||
name.append(".");
|
||||
name.append(schemName[i].replace("/", "-"));
|
||||
name.append(replaceString(schemName[i]));
|
||||
}
|
||||
Schematic testSchem = Schematic.getSchemFromDB(name.toString(), player.getUniqueId());
|
||||
String schematicName = name.substring(0, 60);
|
||||
Schematic testSchem = Schematic.getSchemFromDB(schematicName, player.getUniqueId());
|
||||
List<Byte> schemData = new ArrayList<>();
|
||||
while (zipInputStream.available() == 1) {
|
||||
schemData.add((byte) zipInputStream.read());
|
||||
@ -109,15 +111,16 @@ public class ExternalUpDownload {
|
||||
if(testSchem != null) {
|
||||
int i = 1;
|
||||
while (true) {
|
||||
if(Schematic.getSchemFromDB(name.toString() + "-" + i, player.getUniqueId()) == null) {
|
||||
name = new StringBuilder(name.toString() + "-" + i);
|
||||
if(Schematic.getSchemFromDB(schematicName + "-" + i, player.getUniqueId()) == null) {
|
||||
schematicName = schematicName + "-" + i;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
Schematic.createSchem(name.toString(), player.getUniqueId(), "", SchematicType.Normal);
|
||||
Schematic schem = Schematic.getSchemFromDB(name.toString(), player.getUniqueId());
|
||||
|
||||
Schematic.createSchem(schematicName, player.getUniqueId(), "", SchematicType.Normal);
|
||||
Schematic schem = Schematic.getSchemFromDB(schematicName, player.getUniqueId());
|
||||
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!");
|
||||
@ -132,4 +135,8 @@ public class ExternalUpDownload {
|
||||
httpclient.getConnectionManager().shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private static String replaceString(String str) {
|
||||
return str.replace("/", "-").replace("\\", "-").replace("<", "~").replace(">", "~").replace("^", "*").replace("°", "*").replace("'", "*").replace("\\", ":");
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren