From 70071893fa3b8ce1f6ded7cf3270669fd41f7dfa Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 20 Sep 2020 12:13:35 +0200 Subject: [PATCH] Add /bau delete Confirm GUI Add License --- src/de/steamwar/bungeecore/BungeeCore.java | 25 +------- .../bungeecore/commands/BauCommand.java | 57 +++++++++++-------- .../bungeecore/commands/TestCommand.java | 33 ----------- .../bungeecore/comms/BungeePacket.java | 19 +++++++ .../bungeecore/comms/SpigotHandler.java | 19 +++++++ .../bungeecore/comms/SpigotReceiver.java | 19 +++++++ .../handlers/InventoryCallbackHandler.java | 19 +++++++ .../comms/packets/CloseInventoryPacket.java | 19 +++++++ .../comms/packets/InventoryPacket.java | 19 +++++++ .../bungeecore/comms/packets/PingPacket.java | 19 +++++++ .../comms/packets/inventory/InvCallback.java | 19 +++++++ .../comms/packets/inventory/SWInventory.java | 19 +++++++ .../comms/packets/inventory/SWItem.java | 19 +++++++ .../comms/packets/inventory/SWListInv.java | 19 +++++++ .../bungeecore/sql/SchematicMember.java | 19 +++++++ 15 files changed, 262 insertions(+), 81 deletions(-) delete mode 100644 src/de/steamwar/bungeecore/commands/TestCommand.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 93076b76..ab6d7f30 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -127,8 +127,6 @@ public class BungeeCore extends Plugin { new IgnoreCommand(); new UnIgnoreCommand(); - new TestCommand(); - new EventStarter(); new Broadcaster(); new SessionManager(); @@ -217,28 +215,7 @@ public class BungeeCore extends Plugin { ProxyServer.getInstance().stop("Could not save conig file"); return; } - try { - config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile); - } - catch (YAMLException e) { - e.printStackTrace(); - CHAT_PREFIX = "§eSteam§8War» §r"; - WORLD_FOLDER = "/home/minecraft/userworlds/"; - BAUWELT_PROTOTYP = "/home/minecraft/backbone/server/UserBau/Bauwelt2"; - LOBBY_SERVER = "Lobby"; - USERWORLDS15 = "/home/minecraft/userworlds15/"; - BAUWELT15 = "/home/minecraft/backbone/server/Bau15/Bauwelt"; - Broadcaster.setBroadCastMsgs(new String[] {""}); - Persistent.setChatPrefix(CHAT_PREFIX); - Persistent.setLobbyServer(LOBBY_SERVER); - - SQL.connect( - "jdbc:mysql://127.0.0.1:3306/developer", - Password.getUsername(), - Password.getPassword() - ); - return; - } + config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile); }catch(IOException e){ log("Could not save/load config.yml", e); ProxyServer.getInstance().stop(); diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 18ab9beb..f50d456a 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -20,6 +20,8 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; +import de.steamwar.bungeecore.comms.packets.inventory.SWInventory; +import de.steamwar.bungeecore.comms.packets.inventory.SWItem; import de.steamwar.bungeecore.sql.BauweltMember; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.ProxyServer; @@ -226,32 +228,39 @@ public class BauCommand { } private static void delete(ProxiedPlayer p, String[] command){ - if(bau15(p, command, 2)){ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt."); - ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { - for (Subserver subserver : Subserver.getServerList()) { - if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) { - subserver.stop(); - break; + SWInventory inventory = new SWInventory(p, 9, "§eDelete Confirm"); + inventory.addItem(1, new SWItem(1, "§cDecline", 1), click -> { + inventory.close(); + }); + inventory.addItem(7, new SWItem(7, "§aAccept", 10), click -> { + if(bau15(p, command, 2)){ + BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt."); + ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { + for (Subserver subserver : Subserver.getServerList()) { + if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) { + subserver.stop(); + break; + } } - } - SteamwarUser user = SteamwarUser.get(p.getUniqueId()); - File directory = new File(BungeeCore.USERWORLDS15 + user.getId()); - del(directory); - }); - }else{ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt."); - ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { - for (Subserver subserver : Subserver.getServerList()) { - if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) { - subserver.stop(); - break; + SteamwarUser user = SteamwarUser.get(p.getUniqueId()); + File directory = new File(BungeeCore.USERWORLDS15 + user.getId()); + del(directory); + }); + }else{ + BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt."); + ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { + for (Subserver subserver : Subserver.getServerList()) { + if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) { + subserver.stop(); + break; + } } - } - File directory = new File(BungeeCore.WORLD_FOLDER + p.getUniqueId().toString()); - del(directory); - }); - } + File directory = new File(BungeeCore.WORLD_FOLDER + p.getUniqueId().toString()); + del(directory); + }); + } + }); + inventory.open(); } private static void testarena(ProxiedPlayer p, String[] command){ diff --git a/src/de/steamwar/bungeecore/commands/TestCommand.java b/src/de/steamwar/bungeecore/commands/TestCommand.java deleted file mode 100644 index 77d8419f..00000000 --- a/src/de/steamwar/bungeecore/commands/TestCommand.java +++ /dev/null @@ -1,33 +0,0 @@ -package de.steamwar.bungeecore.commands; - -import de.steamwar.bungeecore.comms.packets.inventory.SWInventory; -import de.steamwar.bungeecore.comms.packets.inventory.SWItem; -import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.connection.ProxiedPlayer; - -public class TestCommand extends BasicCommand { - - public TestCommand() { - super("test", null); - } - - @Override - public void execute(CommandSender commandSender, String[] strings) { - if(!(commandSender instanceof ProxiedPlayer)) - return; - SWInventory inventory = new SWInventory((ProxiedPlayer) commandSender, 3*9, "Test Inventory"); - SWItem item = new SWItem("DIRT1", 13, "§e§lTest Item"); - item.setSkullOwner(commandSender.getName()); - for (ProxiedPlayer player: - ((ProxiedPlayer) commandSender).getServer().getInfo().getPlayers()) { - item.addLore("§6" + player.getDisplayName()); - } - item.setEnchanted(true); - item.setCallback(click -> { - inventory.close(); - commandSender.sendMessage("TEST!!! FJOnbds"); - }); - inventory.addItem(item); - inventory.open(); - } -} diff --git a/src/de/steamwar/bungeecore/comms/BungeePacket.java b/src/de/steamwar/bungeecore/comms/BungeePacket.java index 1233b302..8ccf0b7f 100644 --- a/src/de/steamwar/bungeecore/comms/BungeePacket.java +++ b/src/de/steamwar/bungeecore/comms/BungeePacket.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms; import com.google.common.io.ByteArrayDataOutput; diff --git a/src/de/steamwar/bungeecore/comms/SpigotHandler.java b/src/de/steamwar/bungeecore/comms/SpigotHandler.java index fafc9976..5c0f118c 100644 --- a/src/de/steamwar/bungeecore/comms/SpigotHandler.java +++ b/src/de/steamwar/bungeecore/comms/SpigotHandler.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms; import com.google.common.io.ByteArrayDataInput; diff --git a/src/de/steamwar/bungeecore/comms/SpigotReceiver.java b/src/de/steamwar/bungeecore/comms/SpigotReceiver.java index 2a5521ce..af2061e0 100644 --- a/src/de/steamwar/bungeecore/comms/SpigotReceiver.java +++ b/src/de/steamwar/bungeecore/comms/SpigotReceiver.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms; import com.google.common.io.ByteArrayDataInput; diff --git a/src/de/steamwar/bungeecore/comms/handlers/InventoryCallbackHandler.java b/src/de/steamwar/bungeecore/comms/handlers/InventoryCallbackHandler.java index 15eb08b8..2e7fb17c 100644 --- a/src/de/steamwar/bungeecore/comms/handlers/InventoryCallbackHandler.java +++ b/src/de/steamwar/bungeecore/comms/handlers/InventoryCallbackHandler.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms.handlers; import com.google.common.io.ByteArrayDataInput; diff --git a/src/de/steamwar/bungeecore/comms/packets/CloseInventoryPacket.java b/src/de/steamwar/bungeecore/comms/packets/CloseInventoryPacket.java index e84f6dae..fb8858b1 100644 --- a/src/de/steamwar/bungeecore/comms/packets/CloseInventoryPacket.java +++ b/src/de/steamwar/bungeecore/comms/packets/CloseInventoryPacket.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms.packets; import com.google.common.io.ByteArrayDataOutput; diff --git a/src/de/steamwar/bungeecore/comms/packets/InventoryPacket.java b/src/de/steamwar/bungeecore/comms/packets/InventoryPacket.java index 16417905..6c46ef86 100644 --- a/src/de/steamwar/bungeecore/comms/packets/InventoryPacket.java +++ b/src/de/steamwar/bungeecore/comms/packets/InventoryPacket.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms.packets; import com.google.common.io.ByteArrayDataOutput; diff --git a/src/de/steamwar/bungeecore/comms/packets/PingPacket.java b/src/de/steamwar/bungeecore/comms/packets/PingPacket.java index ba435e67..dddb2727 100644 --- a/src/de/steamwar/bungeecore/comms/packets/PingPacket.java +++ b/src/de/steamwar/bungeecore/comms/packets/PingPacket.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms.packets; import com.google.common.io.ByteArrayDataOutput; diff --git a/src/de/steamwar/bungeecore/comms/packets/inventory/InvCallback.java b/src/de/steamwar/bungeecore/comms/packets/inventory/InvCallback.java index 71fd7672..666e456e 100644 --- a/src/de/steamwar/bungeecore/comms/packets/inventory/InvCallback.java +++ b/src/de/steamwar/bungeecore/comms/packets/inventory/InvCallback.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms.packets.inventory; public interface InvCallback { diff --git a/src/de/steamwar/bungeecore/comms/packets/inventory/SWInventory.java b/src/de/steamwar/bungeecore/comms/packets/inventory/SWInventory.java index 7b4c800a..8cb07287 100644 --- a/src/de/steamwar/bungeecore/comms/packets/inventory/SWInventory.java +++ b/src/de/steamwar/bungeecore/comms/packets/inventory/SWInventory.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms.packets.inventory; import de.steamwar.bungeecore.comms.handlers.InventoryCallbackHandler; diff --git a/src/de/steamwar/bungeecore/comms/packets/inventory/SWItem.java b/src/de/steamwar/bungeecore/comms/packets/inventory/SWItem.java index e2b58421..9a2a640c 100644 --- a/src/de/steamwar/bungeecore/comms/packets/inventory/SWItem.java +++ b/src/de/steamwar/bungeecore/comms/packets/inventory/SWItem.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms.packets.inventory; import com.google.gson.JsonArray; diff --git a/src/de/steamwar/bungeecore/comms/packets/inventory/SWListInv.java b/src/de/steamwar/bungeecore/comms/packets/inventory/SWListInv.java index b3e866be..5cd876a3 100644 --- a/src/de/steamwar/bungeecore/comms/packets/inventory/SWListInv.java +++ b/src/de/steamwar/bungeecore/comms/packets/inventory/SWListInv.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.comms.packets.inventory; import de.steamwar.bungeecore.sql.Schematic; diff --git a/src/de/steamwar/bungeecore/sql/SchematicMember.java b/src/de/steamwar/bungeecore/sql/SchematicMember.java index 7d3c9a5d..85b84855 100644 --- a/src/de/steamwar/bungeecore/sql/SchematicMember.java +++ b/src/de/steamwar/bungeecore/sql/SchematicMember.java @@ -1,3 +1,22 @@ +/* + 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 . +*/ + package de.steamwar.bungeecore.sql; import java.sql.ResultSet;