Add Schemtransfer #81
@ -43,14 +43,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>8</source>
|
|
||||||
<target>8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
<finalName>schematicsystem</finalName>
|
<finalName>schematicsystem</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 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.schematicsystem;
|
package de.steamwar.schematicsystem;
|
||||||
|
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
@ -16,6 +34,7 @@ import java.util.zip.ZipEntry;
|
|||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
public class ExternalUpDownload {
|
public class ExternalUpDownload {
|
||||||
|
private ExternalUpDownload(){}
|
||||||
|
|
||||||
public static void downloadSchemsFromWGW(Player player, String pw) {
|
public static void downloadSchemsFromWGW(Player player, String pw) {
|
||||||
BasicCookieStore cookieStore = new BasicCookieStore();
|
BasicCookieStore cookieStore = new BasicCookieStore();
|
||||||
@ -31,7 +50,7 @@ public class ExternalUpDownload {
|
|||||||
loginPost.setEntity(loginEntity);
|
loginPost.setEntity(loginEntity);
|
||||||
HttpResponse loginResponse = httpclient.execute(loginPost);
|
HttpResponse loginResponse = httpclient.execute(loginPost);
|
||||||
if(loginResponse.getStatusLine().getStatusCode() != 302) {
|
if(loginResponse.getStatusLine().getStatusCode() != 302) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cLogin Fehlgeschlagen");
|
player.sendMessage(SchematicSystem.PREFIX + "§cLogin mit gegebenem Passwort nicht möglich.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,11 +76,11 @@ public class ExternalUpDownload {
|
|||||||
break;
|
break;
|
||||||
builder.append((char) readed);
|
builder.append((char) readed);
|
||||||
}
|
}
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aDownload erstellt!");
|
player.sendMessage(SchematicSystem.PREFIX + "§aWGW-Downloadlink erstellt...");
|
||||||
player.sendMessage("§ahttps://wargearworld.net/images/temp/schematics/" + builder.toString() + ".zip");
|
player.sendMessage("§ahttps://wargearworld.net/images/temp/schematics/" + builder.toString() + ".zip");
|
||||||
|
|
||||||
//Process Schems
|
//Process Schems
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aSchematics werden verarbeitet!");
|
player.sendMessage(SchematicSystem.PREFIX + "§aSchematics werden verarbeitet...");
|
||||||
ZipInputStream zipInputStream = new ZipInputStream(new URL("https://wargearworld.net/images/temp/schematics/" + builder.toString() + ".zip").openStream());
|
ZipInputStream zipInputStream = new ZipInputStream(new URL("https://wargearworld.net/images/temp/schematics/" + builder.toString() + ".zip").openStream());
|
||||||
while (true) {
|
while (true) {
|
||||||
ZipEntry schematic = zipInputStream.getNextEntry();
|
ZipEntry schematic = zipInputStream.getNextEntry();
|
||||||
@ -95,11 +114,11 @@ public class ExternalUpDownload {
|
|||||||
zipInputStream.closeEntry();
|
zipInputStream.closeEntry();
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§6Die Schematic §e" + schematic.getName() + " §6wurde von WarGearWorld.net als §e" + name.toString() + " §6heruntergeladen!");
|
player.sendMessage(SchematicSystem.PREFIX + "§6Die Schematic §e" + schematic.getName() + " §6wurde von WarGearWorld.net als §e" + name.toString() + " §6heruntergeladen!");
|
||||||
}
|
}
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§aAlle deine Schematics wurden von §6W§7ar§6G§7ear§6W§7orld.net §aauf §eSteam§8War §aHochgeladen!");
|
player.sendMessage(SchematicSystem.PREFIX + "§aAlle deine Schematics wurden von §6W§7ar§6G§7ear§6W§7orld.net §aauf §eSteam§8War §atransferiert!");
|
||||||
zipInputStream.close();
|
zipInputStream.close();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
player.sendMessage("Beidem Schemdownload ist ein Fehler passiert, Versuche es Später nochmal.");
|
player.sendMessage("§cUnerwarteter Fehler beim Schematictransfer. Developer wurden benachrichtigt.");
|
||||||
throw new SecurityException(e);
|
throw new SecurityException(e);
|
||||||
} finally {
|
} finally {
|
||||||
httpclient.getConnectionManager().shutdown();
|
httpclient.getConnectionManager().shutdown();
|
||||||
|
@ -15,11 +15,11 @@ public class SchemTransferCommand implements CommandExecutor {
|
|||||||
if(commandSender instanceof Player) {
|
if(commandSender instanceof Player) {
|
||||||
if(args.length < 1) {
|
if(args.length < 1) {
|
||||||
Player p = (Player) commandSender;
|
Player p = (Player) commandSender;
|
||||||
p.sendMessage("§6W§7ar§6G§7ear§6W§7orld §6Schematictransfer");
|
p.sendMessage("§6W§7ar§6G§7ear§6W§7orld Schematictransfer");
|
||||||
p.sendMessage("§7Mit diesem Command kannst du deine Wargearworld schematics auf Steamwar Transferieren");
|
p.sendMessage("§7Mit diesem Command kannst du deine WGW-Schematics auf SteamWar übertragen");
|
||||||
p.sendMessage("§8/§eschemtransfer [Dein Wargearworld Website Passwort]");
|
p.sendMessage("§8/§eschemtransfer §8[§eDein WGW-Website Passwort§8]");
|
||||||
p.sendMessage("§4§lDISCLAIMER: §eDein Passwort wird in keinster von uns gespeichert, es wird nut für den Download der Schematics von Wargearworld.net verwendet und danach sofort wieder gelöcht!");
|
p.sendMessage("§cDISCLAIMER§8: §eDein Passwort wird nicht von uns gespeichert, es wird nur für den Download der Schematics von WGW verwendet und danach sofort wieder gelöscht!");
|
||||||
p.sendMessage("§eWenn du uns das nicht glaubst, kannst du es gerne hier https://steamwar.de/devlabs/SteamWar/SchematicSystem/src/branch/master/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchemTranferCommand.java nachlesen oder auch einen Developer fragen.");
|
p.sendMessage("§eWenn du uns das nicht glaubst, kannst du es gerne hier https://steamwar.de/devlabs/SteamWar/SchematicSystem/src/branch/master/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchemTranferCommand.java nachlesen oder die Schematics manuell übertragen.");
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(SchematicSystem.INSTANCE, () -> ExternalUpDownload.downloadSchemsFromWGW((Player) commandSender, args[0]));
|
Bukkit.getScheduler().runTaskAsynchronously(SchematicSystem.INSTANCE, () -> ExternalUpDownload.downloadSchemsFromWGW((Player) commandSender, args[0]));
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren