valueEntry : map.get(entryValues.getKey()).entrySet()) {
- valueBuilder.appendField(valueEntry.getKey(), valueEntry.getValue());
- allSkipped = false;
- }
- if (!allSkipped) {
- reallyAllSkipped = false;
- valuesBuilder.appendField(entryValues.getKey(), valueBuilder.build());
- }
- }
- if (reallyAllSkipped) {
- // Null = skip the chart
- return null;
- }
- return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
- }
- }
-
- /**
- * An extremely simple JSON builder.
- *
- * While this class is neither feature-rich nor the most performant one, it's sufficient enough
- * for its use-case.
- */
- public static class JsonObjectBuilder {
-
- private StringBuilder builder = new StringBuilder();
-
- private boolean hasAtLeastOneField = false;
-
- public JsonObjectBuilder() {
- builder.append("{");
- }
-
- /**
- * Appends a null field to the JSON.
- *
- * @param key The key of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendNull(String key) {
- appendFieldUnescaped(key, "null");
- return this;
- }
-
- /**
- * Appends a string field to the JSON.
- *
- * @param key The key of the field.
- * @param value The value of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, String value) {
- if (value == null) {
- throw new IllegalArgumentException("JSON value must not be null");
- }
- appendFieldUnescaped(key, "\"" + escape(value) + "\"");
- return this;
- }
-
- /**
- * Appends an integer field to the JSON.
- *
- * @param key The key of the field.
- * @param value The value of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, int value) {
- appendFieldUnescaped(key, String.valueOf(value));
- return this;
- }
-
- /**
- * Appends an object to the JSON.
- *
- * @param key The key of the field.
- * @param object The object.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, JsonObject object) {
- if (object == null) {
- throw new IllegalArgumentException("JSON object must not be null");
- }
- appendFieldUnescaped(key, object.toString());
- return this;
- }
-
- /**
- * Appends a string array to the JSON.
- *
- * @param key The key of the field.
- * @param values The string array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, String[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values)
- .map(value -> "\"" + escape(value) + "\"")
- .collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends an integer array to the JSON.
- *
- * @param key The key of the field.
- * @param values The integer array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, int[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values).mapToObj(String::valueOf).collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends an object array to the JSON.
- *
- * @param key The key of the field.
- * @param values The integer array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, JsonObject[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values).map(JsonObject::toString).collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends a field to the object.
- *
- * @param key The key of the field.
- * @param escapedValue The escaped value of the field.
- */
- private void appendFieldUnescaped(String key, String escapedValue) {
- if (builder == null) {
- throw new IllegalStateException("JSON has already been built");
- }
- if (key == null) {
- throw new IllegalArgumentException("JSON key must not be null");
- }
- if (hasAtLeastOneField) {
- builder.append(",");
- }
- builder.append("\"").append(escape(key)).append("\":").append(escapedValue);
- hasAtLeastOneField = true;
- }
-
- /**
- * Builds the JSON string and invalidates this builder.
- *
- * @return The built JSON string.
- */
- public JsonObject build() {
- if (builder == null) {
- throw new IllegalStateException("JSON has already been built");
- }
- JsonObject object = new JsonObject(builder.append("}").toString());
- builder = null;
- return object;
- }
-
- /**
- * Escapes the given string like stated in https://www.ietf.org/rfc/rfc4627.txt.
- *
- *
This method escapes only the necessary characters '"', '\'. and '\u0000' - '\u001F'.
- * Compact escapes are not used (e.g., '\n' is escaped as "\u000a" and not as "\n").
- *
- * @param value The value to escape.
- * @return The escaped value.
- */
- private static String escape(String value) {
- final StringBuilder builder = new StringBuilder();
- for (int i = 0; i < value.length(); i++) {
- char c = value.charAt(i);
- if (c == '"') {
- builder.append("\\\"");
- } else if (c == '\\') {
- builder.append("\\\\");
- } else if (c <= '\u000F') {
- builder.append("\\u000").append(Integer.toHexString(c));
- } else if (c <= '\u001F') {
- builder.append("\\u00").append(Integer.toHexString(c));
- } else {
- builder.append(c);
- }
- }
- return builder.toString();
- }
-
- /**
- * A super simple representation of a JSON object.
- *
- *
This class only exists to make methods of the {@link JsonObjectBuilder} type-safe and not
- * allow a raw string inputs for methods like {@link JsonObjectBuilder#appendField(String,
- * JsonObject)}.
- */
- public static class JsonObject {
-
- private final String value;
-
- private JsonObject(String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return value;
- }
- }
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BMySQL.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BMySQL.java
deleted file mode 100644
index 5c8528d..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BMySQL.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package de.jatitv.commandguiv2.Bungee;
-
-
-
-import net.md_5.bungee.api.plugin.Plugin;
-import net.t2code.lib.Bungee.Lib.messages.Bsend;
-
-import java.sql.*;
-import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Calendar;
-
-public class BMySQL {
- private static Plugin plugin = BMain.plugin;
- protected static Boolean Enable = false;
-
- protected static String ip = "localhost";
- protected static Integer port = 3306;
- protected static String database;
- protected static String user = "root";
- protected static String password = "";
- protected static String url;
- protected static Boolean SSL;
-
- public static void main() {
- Long long_ = Long.valueOf(System.currentTimeMillis());
- Calendar now = Calendar.getInstance();
- ZoneId timeZone = now.getTimeZone().toZoneId();
- Bsend.debug(plugin, "Server TimeZone is : " + timeZone);
- url = "jdbc:mysql://" + ip + ":" + port + "/" + database + "?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=" + timeZone;
- // Europe/Berlin
- if (SSL) {
- url = url + "&useSSL=true";
- } else url = url + "&useSSL=false";
- Bsend.debug(plugin, url);
- try (Connection con = DriverManager.getConnection(url, user, password)) {
- Statement stmt = con.createStatement();
- stmt.close();
- Bsend.console(BMain.prefix + " §2MySQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
- } catch (SQLException ex) {
- Bsend.console(BMain.prefix + " §4MySQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
- Bsend.error(plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_.longValue()) + "ms");
- }
- }
-
- public static void query(String query) {
- try (Connection con = DriverManager.getConnection(url, user, password)) {
- Statement stmt = con.createStatement();
- stmt.execute(query);
- stmt.close();
- } catch (SQLException ex) {
- System.err.println(ex.getMessage());
- }
- }
-
-
- public static ArrayList selectAll(String query) {
- ArrayList Result = new ArrayList<>();
- try (Connection con = DriverManager.getConnection(url, user, password)) {
- Statement stmt = con.createStatement();
- ResultSet rs = stmt.executeQuery(query);
- int columns = rs.getMetaData().getColumnCount();
- while (rs.next()) {
- Result.add(rs.getString(1));
- }
- rs.close();
- stmt.close();
- } catch (SQLException ex) {
- System.err.println(ex.getMessage());
- }
- return Result;
- }
-
- public static String select(String query) {
- String Ausgabe = "";
- try (Connection con = DriverManager.getConnection(url, user, password)) {
- Statement stmt = con.createStatement();
- ResultSet rs = stmt.executeQuery(query);
- int columns = rs.getMetaData().getColumnCount();
- while (rs.next()) {
- Ausgabe = String.valueOf(rs.getString(1));
- }
- rs.close();
- stmt.close();
- } catch (SQLException ex) {
- System.err.println(ex.getMessage());
- }
- return Ausgabe;
- }
-
- public static int count(String query) {
- Integer count = 0;
- try (Connection con = DriverManager.getConnection(url, user, password)) {
- Statement stmt = con.createStatement();
- ResultSet rs = stmt.executeQuery(query);
- int columns = rs.getMetaData().getColumnCount();
- while (rs.next()) {
- count++;
- }
- rs.close();
- stmt.close();
- } catch (SQLException ex) {
- System.err.println(ex.getMessage());
- }
- return count;
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BUpdateChecker.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BUpdateChecker.java
deleted file mode 100644
index 45562b1..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BUpdateChecker.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// This claas was created by JaTiTV
-
-// -----------------------------
-// _____ _____ _ _ _____
-// / ____/ ____| | | |_ _|
-// | | | | __| | | | | |
-// | | | | |_ | | | | | |
-// | |___| |__| | |__| |_| |_
-// \_____\_____|\____/|_____|
-// -----------------------------
-
-package de.jatitv.commandguiv2.Bungee;
-
-import net.md_5.bungee.api.ProxyServer;
-import net.md_5.bungee.api.plugin.Plugin;
-import net.t2code.lib.Bungee.Lib.messages.Bsend;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Scanner;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Consumer;
-
-public class BUpdateChecker {
-
- public static void sendUpdateMsg(String Prefix, String foundVersion, String update_version) {
- Bsend.console("§4=========== " + Prefix + " §4===========");
- Bsend.console("§6A new version was found!");
- Bsend.console("§6Your version: §c" + foundVersion + " §7- §6Current version: §a" + update_version+"_Bungee");
- Bsend.console("§6You can download it here: §e" + BMain.spigot);
- Bsend.console("§6You can find more information on Discord: §e" + BMain.discord);
- Bsend.console("§4=========== " + Prefix + " §4===========");
- }
-
-
- public static void onUpdateCheckTimer() {
- ProxyServer.getInstance().getScheduler().schedule(BMain.plugin, new Runnable() {
- public void run() {
- (new BUpdateChecker(BMain.plugin, BMain.spigotID)).getVersion((update_version) -> {
- String foundVersion = BMain.plugin.getDescription().getVersion();
- BMain.update_version = update_version;
- if (!foundVersion.replace("_Bungee", "").equalsIgnoreCase(update_version)) {
- sendUpdateMsg(BMain.prefix, foundVersion, update_version);
- }
- });
- }
- }, 0, 20 * 60 * 60L, TimeUnit.SECONDS);
- }
-
- public static void onUpdateCheck() {
- (new BUpdateChecker(BMain.plugin, BMain.spigotID)).getVersion((update_version) -> {
- String foundVersion = BMain.plugin.getDescription().getVersion();
- BMain.update_version = update_version;
- if (foundVersion.replace("_Bungee", "").equalsIgnoreCase(update_version)) {
- Bsend.console(BMain.prefix + " §2No update found.");
- }
- });
- }
-
- private Plugin plugin;
- private int resourceId;
-
- public BUpdateChecker(Plugin plugin, int resourceId) {
- this.plugin = plugin;
- this.resourceId = resourceId;
- }
-
- public void getVersion(Consumer consumer) {
- ProxyServer.getInstance().getScheduler().runAsync(this.plugin, () -> {
- try {
- InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
- try {
- Scanner scanner = new Scanner(inputStream);
-
- try {
- if (scanner.hasNext()) {
- consumer.accept(scanner.next());
- }
- } catch (Throwable var8) {
- try {
- scanner.close();
- } catch (Throwable var7) {
- var8.addSuppressed(var7);
- }
- throw var8;
- }
- scanner.close();
- } catch (Throwable var9) {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (Throwable var6) {
- var9.addSuppressed(var6);
- }
- }
- throw var9;
- }
- if (inputStream != null) {
- inputStream.close();
- }
- } catch (IOException var10) {
- this.plugin.getLogger().severe(BMain.prefix + "§4 Cannot look for updates: " + var10.getMessage());
- }
- });
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ConfigChat.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ConfigChat.java
deleted file mode 100644
index 1c7e936..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ConfigChat.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.Listener;
-
-import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.Objekte.Object;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.AsyncPlayerChatEvent;
-
-import java.util.HashMap;
-
-public class ConfigChat implements Listener {
- public static HashMap EditChat = new HashMap<>();
-
- @EventHandler
- public void onChat(AsyncPlayerChatEvent playerChatEvent) {
- Player player = playerChatEvent.getPlayer();
- if (EditChat.containsKey(player)) {
- if (playerChatEvent.getMessage().equals("cancel")) {
- //player.sendMessage(DefaultValue.SettingsGUIchatIsCanceled.replace("[setting]", EditChat.get(player)));
- } else {
- for (Object gui : Main.guiHashMap.values()) {
- for (Slot slot : gui.GUI_Slots) {
- if (slot.ConfigOptionPath.equals(EditChat.get(player))) {
-
-
- }
- }
- }
- }
- }
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUI_Listener.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUI_Listener.java
deleted file mode 100644
index d43b47c..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUI_Listener.java
+++ /dev/null
@@ -1,396 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.Listener;
-
-import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
-import de.jatitv.commandguiv2.Spigot.system.Bungee_Sender_Reciver;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import de.jatitv.commandguiv2.Spigot.Objekte.Object;
-import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import de.jatitv.commandguiv2.Spigot.Main;
-import net.t2code.lib.Spigot.Lib.items.ItemVersion;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.replace.Replace;
-import net.t2code.lib.Spigot.Lib.vault.Vault;
-import net.t2code.lib.Util;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.scheduler.BukkitRunnable;
-
-import java.io.File;
-import java.io.IOException;
-
-public class GUI_Listener implements Listener {
-
- private static String prefix = Util.Prefix;
- public static String GUICode;
- private static Plugin plugin = Main.plugin;
-
- @EventHandler
- public void onInventoryClick(InventoryClickEvent e) {
- Player player = (Player) e.getWhoClicked();
- if (e.getInventory() != null && e.getCurrentItem() != null) {
- for (Object gui : Main.guiHashMap.values()) {
- if (player.getOpenInventory().getTitle().equals(Replace.replace(prefix, GUICode + gui.GUI_Name))
- || (Main.PaPi && player.getOpenInventory().getTitle().equals(Replace.replace(prefix, player, GUICode + gui.GUI_Name)))) {
- e.setCancelled(true);
- for (Slot slot : gui.GUI_Slots) {
- /* if (!slot.ItemsRemovable) {
- e.setCancelled(true);
- }
- */
-
- if (e.getSlot() == slot.Slot) {
-
- if (!slot.Perm || player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
- || player.hasPermission("commandgui.admin")) {
-
- if (slot.Enable) {
- if (e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, slot.Name))) {
- if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == Material.valueOf(slot.Item.toUpperCase().replace(".", "_"))) {
- if (slot.Cost_Enable) {
- if (slot.Command_Enable || slot.Message_Enable || slot.OpenGUI_Enable || slot.ServerChange) {
- if (Vault.buy(prefix, player, slot.Price)) {
- player.sendMessage(SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, slot.Name))
- .replace("[price]", slot.Price + " " + SelectConfig.Currency));
- if (slot.Command_Enable) {
-
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
-
- new BukkitRunnable() {
- @Override
- public void run() {
- if (slot.Command_BungeeCommand && SelectConfig.Bungee) {
- for (String cmd : slot.Command) {
- Bungee_Sender_Reciver.sendToBungee(player, player.getName(), cmd.replace("[player]", player.getName()));
- }
- } else {
- if (slot.CommandAsConsole) {
- for (String cmd : slot.Command) {
- Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
- }
- } else {
- for (String cmd : slot.Command) {
- player.chat("/" + cmd.replace("[player]", player.getName()));
- }
- }
- }
- }
- }.runTaskLater(plugin, 2L);
- }
- if (slot.OpenGUI_Enable) {
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
-
- }
- }.runTaskLater(plugin, 1L);
- new BukkitRunnable() {
- @Override
- public void run() {
- OpenGUI.openGUI(player, Main.guiHashMap.get(slot.OpenGUI), slot.OpenGUI);
- }
- }.runTaskLater(plugin, 2L);
- }
- if (slot.Message_Enable) {
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
-
- for (String msg : slot.Message) {
- if (Main.PaPi) {
- player.sendMessage(Replace.replacePrice(prefix, player, msg, slot.Price + " " + SelectConfig.Currency));
- } else
- player.sendMessage(Replace.replacePrice(prefix, msg, slot.Price + " " + SelectConfig.Currency));
- }
- }
- if (slot.ServerChange) {
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
-
- send.player(player, SelectMessages.onServerChange.replace("[server]", slot.ServerChangeServer));
- new BukkitRunnable() {
- @Override
- public void run() {
- ServerChange.send(player, slot.ServerChangeServer);
- }
- }.runTaskLater(Main.plugin, 20L);
- }
- if (slot.SetConfigEnable) {
- File config = new File(slot.ConfigFilePath);
- YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
- /*if (slot.ConfigChatInput){
- ConfigChat.EditChat.put(player, slot.ConfigOptionPath);
- player.sendMessage(DefaultValue.SettingsGUIchatSet.replace("[setting]", "Shop Name Chest small"));
- player.sendMessage(DefaultValue.SettingsGUIchatCancel);
- } else
- {
- */
- if (e.isLeftClick()) {
- if (slot.ConfigOptionPremat.equals("String")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueLeft);
- } else if (slot.ConfigOptionPremat.equals("Boolean")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigBooleanValueLeft);
- } else if (slot.ConfigOptionPremat.equals("Integer")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigIntegerValueLeft);
- } else if (slot.ConfigOptionPremat.equals("Double")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigDoubleValueLeft);
- } else if (slot.ConfigOptionPremat.equals("List")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigListValueLeft);
- } else {
- player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
- }
- }
- if (e.isRightClick()) {
- if (slot.ConfigOptionPremat.equals("String")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueRight);
- } else if (slot.ConfigOptionPremat.equals("Boolean")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigBooleanValueRight);
- } else if (slot.ConfigOptionPremat.equals("Integer")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigIntegerValueRight);
- } else if (slot.ConfigOptionPremat.equals("Double")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigDoubleValueRight);
- } else if (slot.ConfigOptionPremat.equals("List")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigListValueRight);
- } else {
- player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
- }
- }
- try {
- yamlConfiguration.save(config);
- } catch (IOException tac) {
- tac.printStackTrace();
- }
- if (slot.PluginReloadEnable) {
- Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), slot.PluginReloadCommand);
- }
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
- }
-
- if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) {
- if (slot.CustomSound_Enable) {
- if (!slot.CustomSound_NoSound) {
- try {
- player.playSound(player.getLocation(), Sound.valueOf(slot.CustomSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
-
- } catch (Exception e1) {
- send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
- .replace("[sound]", "§6GUI: §e" + Replace.replace(prefix, gui.GUI_Name) + "§r §6Slot: §e" + slot.Slot + " §6CustomSound: §9" + slot.CustomSound_Sound));
- player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
- }
- }
- } else
- player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
- }
-
- } else {
-
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
-
- player.sendMessage(SelectMessages.No_money);
- if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable) {
- player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
- }
- }
- }
- } else {
- if (slot.Command_Enable) {
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
-
- new BukkitRunnable() {
- @Override
- public void run() {
- if (slot.Command_BungeeCommand) {
- if (SelectConfig.Bungee) {
- for (String cmd : slot.Command) {
- Bungee_Sender_Reciver.sendToBungee(player, player.getName(), cmd.replace("[player]", player.getName()));
- }
- } else {
- send.console(prefix + " §4To use bungee commands, enable the Bungee option in the config.");
- send.player(player, prefix + " §4To use bungee commands, enable the Bungee option in the config.");
- }
-
- } else {
- if (slot.CommandAsConsole) {
- for (String cmd : slot.Command) {
- Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
- }
- } else {
- for (String cmd : slot.Command) {
- player.chat("/" + cmd);
- }
- }
- }
- }
- }.runTaskLater(plugin, 2L);
- }
- if (slot.OpenGUI_Enable) {
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
- new BukkitRunnable() {
- @Override
- public void run() {
-
- OpenGUI.openGUI(player, Main.guiHashMap.get(slot.OpenGUI), slot.OpenGUI);
- }
- }.runTaskLater(plugin, 2L);
- }
- if (slot.Message_Enable) {
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
-
-
- for (String msg : slot.Message) {
- if (Main.PaPi) {
- player.sendMessage(Replace.replace(prefix, player, msg.replace("[prefix]", prefix)));
- } else
- player.sendMessage(Replace.replace(prefix, msg.replace("[prefix]", prefix)));
- }
- }
- if (slot.ServerChange) {
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
-
- send.player(player, SelectMessages.onServerChange.replace("[server]", slot.ServerChangeServer));
-
-
- new BukkitRunnable() {
- @Override
- public void run() {
- ServerChange.send(player, slot.ServerChangeServer);
- }
- }.runTaskLater(Main.plugin, 20L);
- }
- if (slot.SetConfigEnable) {
- File config = new File(slot.ConfigFilePath);
- YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
- /*if (slot.ConfigChatInput){
- ConfigChat.EditChat.put(player, slot.ConfigOptionPath);
- player.sendMessage(DefaultValue.SettingsGUIchatSet.replace("[setting]", "Shop Name Chest small"));
- player.sendMessage(DefaultValue.SettingsGUIchatCancel);
- } else
- {
- */
- if (e.isLeftClick()) {
- if (slot.ConfigOptionPremat.equals("String")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueLeft);
- } else if (slot.ConfigOptionPremat.equals("Boolean")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigBooleanValueLeft);
- } else if (slot.ConfigOptionPremat.equals("Integer")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigIntegerValueLeft);
- } else if (slot.ConfigOptionPremat.equals("Double")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigDoubleValueLeft);
- } else if (slot.ConfigOptionPremat.equals("List")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigListValueLeft);
- } else {
- player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
- }
- }
- if (e.isRightClick()) {
- if (slot.ConfigOptionPremat.equals("String")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueRight);
- } else if (slot.ConfigOptionPremat.equals("Boolean")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigBooleanValueRight);
- } else if (slot.ConfigOptionPremat.equals("Integer")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigIntegerValueRight);
- } else if (slot.ConfigOptionPremat.equals("Double")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigDoubleValueRight);
- } else if (slot.ConfigOptionPremat.equals("List")) {
- yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigListValueRight);
- } else {
- player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
- }
- }
- try {
- yamlConfiguration.save(config);
- } catch (IOException tac) {
- tac.printStackTrace();
- }
- if (slot.PluginReloadEnable) {
- Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), slot.PluginReloadCommand);
- }
- new BukkitRunnable() {
- @Override
- public void run() {
- player.closeInventory();
- }
- }.runTaskLater(plugin, 1L);
- }
- if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) {
- if (slot.CustomSound_Enable) {
- if (!slot.CustomSound_NoSound) {
- try {
- player.playSound(player.getLocation(), Sound.valueOf(slot.CustomSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
-
- } catch (Exception e1) {
- send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
- .replace("[sound]", "§6GUI: §e" + Replace.replace(prefix, gui.GUI_Name) + "§r §6Slot: §e" + slot.Slot + " §6CustomSound: §9" + slot.CustomSound_Sound));
- player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
- }
- }
- } else
- player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
- }
- }
- }
- }
- }
- } else {
- player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, slot.Name))
- .replace("[perm]", "commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1)));
- }
- }
- }
- }
- }
- }
- }
-}
-
-
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java
deleted file mode 100644
index ecae016..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.Listener;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.system.Give_UseItem;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
-import net.t2code.lib.Spigot.Lib.items.ItemVersion;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-
-public class ItemChange {
- public static void itemChange(Player player) {
- Integer slot;
- if (Select_Database.selectSlot(player) == null) {
- slot = SelectConfig.UseItem_InventorySlot;
- } else {
- slot = Select_Database.selectSlot(player);
- }
- if (!SelectConfig.UseItem_Enable) {
- return;
- }
- if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
- if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
- if (!player.hasPlayedBefore()) {
- new BukkitRunnable() {
- @Override
- public void run() {
- Give_UseItem.onGive(player);
- }
- }.runTaskLater(Main.plugin, 1L * 1);
- if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin || SelectConfig.Cursor_ToGUIItem_OnLogin) {
- player.getInventory().setHeldItemSlot(slot - 1);
- }
- }
- }
- return;
- }
- if (SelectConfig.UseItem_GiveOnEveryJoin) {
- new BukkitRunnable() {
- @Override
- public void run() {
- for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
- ItemStack itm = player.getInventory().getItem(iam);
- if (itm != null) {
- if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
- if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- player.getInventory().remove(itm);
- player.updateInventory();
- break;
- }
- }
- }
- }
- if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
- if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
- Give_UseItem.onGive(player);
- if (SelectConfig.Cursor_ToGUIItem_OnLogin) {
- if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {
- if (!player.hasPlayedBefore()) {
- player.getInventory().setHeldItemSlot(slot - 1);
- }
- } else {
- if (SelectConfig.Bungee) {
- if (SelectConfig.UseItem_ServerChange) {
- player.getInventory().setHeldItemSlot(slot - 1);
- } else {
- if (Main.bungeejoinplayers.contains(player.getName())) {
- player.getInventory().setHeldItemSlot(slot - 1);
- Main.bungeejoinplayers.remove(player.getName());
- }
- }
- } else player.getInventory().setHeldItemSlot(slot - 1);
- }
- }
- } else if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
- boolean empty = false;
- for (int i = 0; i < 9; i++) {
- if (player.getInventory().getItem(i) == null) {
- empty = true;
- break;
- }
- }
- if (empty) {
- Give_UseItem.onGiveADD(player);
- }
- }
- }
- }
- }.runTaskLater(Main.plugin, 1L * 1);
- }
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/PluginEvent.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/PluginEvent.java
deleted file mode 100644
index 46a496d..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/PluginEvent.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// This claas was created by JaTiTV
-
-package de.jatitv.commandguiv2.Spigot.Listener;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
-import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerCommandPreprocessEvent;
-import org.bukkit.event.player.PlayerLoginEvent;
-import org.bukkit.event.server.ServerCommandEvent;
-import org.bukkit.scheduler.BukkitRunnable;
-
-public class PluginEvent implements Listener {
- private static String prefix = Main.prefix;
-
- @EventHandler
- public void onJoinEvent(PlayerLoginEvent event) {
- Player player = event.getPlayer();
- Select_Database.nameCheck(player);
- UpdateAPI.join(Main.plugin,prefix, "commandgui.updatemsg", event.getPlayer(), Main.spigot, Main.discord);
- }
-
-
- @EventHandler
- public void onClearServer(ServerCommandEvent event) {
- if (SelectConfig.UseItem_KeepAtCommandClear) {
- if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) {
- new BukkitRunnable() {
- @Override
- public void run() {
- try {
- Player player = Bukkit.getPlayer(event.getCommand().replace("/", "").replace("clear ", ""));
- if (player == null){
- return;
- }
- clearGive(player);
- } catch (Exception ex){
- ex.printStackTrace();
- return;
- }
- }
- }.runTaskLater(Main.plugin, 1L);
- }
- }
- }
-
-
- @EventHandler
- public void onClearPlayer(PlayerCommandPreprocessEvent event) {
- if (SelectConfig.UseItem_KeepAtCommandClear) {
- if (event.getMessage().toLowerCase().contains("clear")) {
- new BukkitRunnable() {
- @Override
- public void run() {
- clearGive(event.getPlayer());
- }
- }.runTaskLater(Main.plugin, 1L);
- }
- if (event.getMessage().toLowerCase().contains("clear " + event.getMessage().toLowerCase().replace("/", "").replace("clear ", ""))) {
- new BukkitRunnable() {
- @Override
- public void run() {
- clearGive(Bukkit.getPlayer(event.getMessage().toLowerCase().replace("/", "").replace("clear ", "")));
- }
- }.runTaskLater(Main.plugin, 1L);
- }
- }
- }
-
- private static void clearGive(Player player) {
- ItemChange.itemChange(player);
- }
-}
\ No newline at end of file
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ServerChange.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ServerChange.java
deleted file mode 100644
index df2e074..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ServerChange.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.Listener;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import org.bukkit.entity.Player;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-public class ServerChange {
-
- public static void send(Player player, String server){
- ByteArrayOutputStream b = new ByteArrayOutputStream();
- DataOutputStream out = new DataOutputStream(b);
- try {
- out.writeUTF("Connect");
- out.writeUTF(server);
- } catch (IOException i) {
- i.printStackTrace();
- }
- player.sendPluginMessage(Main.plugin, "BungeeCord", b.toByteArray());
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java
deleted file mode 100644
index b30e689..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java
+++ /dev/null
@@ -1,271 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener;
-
-import de.jatitv.commandguiv2.Spigot.Listener.ItemChange;
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
-import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
-import de.jatitv.commandguiv2.api.CGuiAPI;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import net.t2code.lib.Spigot.Lib.items.ItemVersion;
-import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.block.BlockPlaceEvent;
-import org.bukkit.event.entity.PlayerDeathEvent;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.event.inventory.InventoryDragEvent;
-import org.bukkit.event.inventory.InventoryMoveItemEvent;
-import org.bukkit.event.inventory.InventoryPickupItemEvent;
-import org.bukkit.event.player.*;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class Events implements Listener {
-
- @EventHandler
- public void onJoin(PlayerJoinEvent e) {
- if (CGuiAPI.JoinDisable) return;
- if (e.getPlayer().hasPermission("commandgui.get.guiitem.at.login")) {
- new BukkitRunnable() {
- @Override
- public void run() {
- ItemChange.itemChange(e.getPlayer());
- }
- }.runTaskLater(Main.plugin, 20L * 1);
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onDeathDrop(PlayerDeathEvent e) {
- Player player = e.getEntity().getPlayer();
- for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
- ItemStack itm = player.getInventory().getItem(iam);
- if (itm != null) {
- if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
- if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- player.getInventory().remove(itm);
- player.updateInventory();
- break;
- }
- }
- }
- }
- if (!e.getDrops().isEmpty()) {
- Iterator var3 = (new ArrayList(e.getDrops())).iterator();
- while (var3.hasNext()) {
- ItemStack items = (ItemStack) var3.next();
- if (items != null && items.hasItemMeta() && items.getItemMeta().hasDisplayName()
- && items.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- e.getDrops().remove(items);
- }
- }
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onRespawn(PlayerRespawnEvent e) {
- Player player = e.getPlayer();
- if (SelectConfig.UseItem_Enable) {
- ItemChange.itemChange(player);
- //if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
- // if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
- // if (!player.hasPlayedBefore()) {
- // new BukkitRunnable() {
- // @Override
- // public void run() {
- // Give_UseItem.onGive(player);
- // }
- // }.runTaskLater(Main.plugin, 20L * 1);
- // }
- // } else {
- // new BukkitRunnable() {
- // @Override
- // public void run() {
- // Give_UseItem.onGive(player);
- // }
- // }.runTaskLater(Main.plugin, 20L * 1);
- // }
- //}
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onGameModeChange(PlayerGameModeChangeEvent e) {
- Player player = e.getPlayer();
- new BukkitRunnable() {
- @Override
- public void run() {
- if (SelectConfig.UseItemGameModeChangeDisableInSpectator) {
- if (player.getGameMode() != GameMode.SPECTATOR) {
- ItemChange.itemChange(player);
- return;
- }
- for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
- ItemStack itm = player.getInventory().getItem(iam);
- if (itm != null) {
- if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
- if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- player.getInventory().remove(itm);
- player.updateInventory();
- break;
- }
- }
- }
- }
- } else ItemChange.itemChange(player);
- }
- }.runTaskLater(Main.plugin, 1L);
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onInteract(PlayerInteractEvent e) {
- Player p = e.getPlayer();
- if (SelectConfig.UseItem_Enable) {
- if (SelectConfig.UseItem_PlayerHead_Enable) {
- if (e.getItem() != null && p.getItemInHand().getType() == ItemVersion.getHead()) {
- if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- e.setCancelled(true);
- if (p.isSneaking()) {
- Commands.info(p);
- return;
- }
- if (!legacy()) {
- if (!topInventoryIsEmpty(p)) return;
- }
- if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) {
- OpenGUI.openGUI(p, Main.guiHashMap.get(SelectConfig.UseItem_OpenGUI), SelectConfig.UseItem_OpenGUI);
- if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
- p.playSound(p.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
- }
- } else {
- p.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
- .replace("[gui]", SelectConfig.UseItem_OpenGUI));
- }
- }
- }
- } else {
- if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(SelectConfig.UseItem_Material)) {
- if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- e.setCancelled(true);
- if (p.isSneaking()) {
- Commands.info(p);
- return;
- }
- if (!legacy()) {
- if (!topInventoryIsEmpty(p)) return;
- }
- if (!SelectConfig.UseItem_Permission || p.hasPermission("commandgui.useitem")) {
- OpenGUI.openGUI(p, Main.guiHashMap.get(SelectConfig.UseItem_OpenGUI), SelectConfig.UseItem_OpenGUI);
- if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
- p.playSound(p.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
- }
- } else {
- p.sendMessage(SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
- .replace("[gui]", SelectConfig.UseItem_OpenGUI));
- }
- }
- }
- }
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onItemMoveEvent(InventoryMoveItemEvent e) {
- if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
- if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
- && e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- e.setCancelled(true);
-
- }
- }
-
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onItemMove(InventoryDragEvent e) {
- if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
- if (e.getWhoClicked() instanceof Player) {
- Player p = (Player) e.getWhoClicked();
- if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
- && e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- p.closeInventory();
- e.setCancelled(true);
- ItemChange.itemChange(p);
- }
-
- if (e.getOldCursor() != null && e.getOldCursor().hasItemMeta() && e.getOldCursor().getItemMeta().hasDisplayName()
- && e.getOldCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- p.closeInventory();
- e.setCancelled(true);
- ItemChange.itemChange(p);
- }
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
- public void onItemMove(InventoryClickEvent e) {
- if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
- Player player = (Player) e.getWhoClicked();
-
- if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
- && e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- e.setCancelled(true);
- }
- if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
- && e.getCurrentItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
-
- e.setCancelled(true);
-
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onItemMove(InventoryPickupItemEvent e) {
- if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
- if (e.getItem() != null && e.getItem().getItemStack() != null) {
- ItemStack item = e.getItem().getItemStack();
- if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
- && item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- e.setCancelled(true);
- }
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onPlace(BlockPlaceEvent e) {
- if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
- if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
- && e.getItemInHand().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- e.setCancelled(true);
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onDrop(PlayerDropItemEvent e) {
- if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
- if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
- ItemStack item = e.getItemDrop().getItemStack();
- if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
- && item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- e.setCancelled(true);
- }
- }
- }
-
- private static boolean legacy() {
- if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15) {
- return true;
- } else return false;
- }
-
- private static boolean topInventoryIsEmpty(Player p) {
- return p.getOpenInventory().getTopInventory().isEmpty();
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events_from1_10.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events_from1_10.java
deleted file mode 100644
index 47f0e80..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events_from1_10.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener;
-
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.*;
-
-public class Events_from1_10 implements Listener {
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onHandSwap(PlayerSwapHandItemsEvent e) {
- if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9) return;
- if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
- if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
- && e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- }
- if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
- && e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- e.setCancelled(true);
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onItemMove(PlayerSwapHandItemsEvent e) {
- if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9) return;
- if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
- Player p = e.getPlayer();
- if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
- && e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- p.closeInventory();
- e.setCancelled(true);
- }
- if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
- && e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- p.closeInventory();
- e.setCancelled(true);
- }
- }
-}
\ No newline at end of file
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Main.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Main.java
deleted file mode 100644
index 8e04756..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Main.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package de.jatitv.commandguiv2.Spigot;
-//s bungeeplayers = new ArrayList<>();
- public static ArrayList bungeejoinplayers = new ArrayList<>();
-
- public static File getPath() {
- return plugin.getDataFolder();
- }
-
- private static Boolean enable = false;
-
- public static String prefix = "§8[§4C§9GUI§8]";
-
- public static String version;
-
- public static List autor;
- public static Integer spigotID = Util.SpigotID;
- public static Integer bstatsID = Util.BstatsID;
- public static String spigot = Util.Spigot;
- public static String discord = Util.Discord;
-
- public static Main plugin;
- public static List plugins;
-
- public static String update_version = null;
- public static Boolean PaPi = false;
- public static Boolean PlotSquaredGUI = false;
- public static Boolean PlugManGUI = false;
-
- public static HashMap guiHashMap = new HashMap<>();
- public static ArrayList allAliases = new ArrayList<>();
-
- @Override
- public void onEnable() {
- plugins = Arrays.asList(getServer().getPluginManager().getPlugins());
- // Plugin startup logic
- // Plugin startup logic
- Logger logger = this.getLogger();
- plugin = this;
- autor = plugin.getDescription().getAuthors();
- version = plugin.getDescription().getVersion();
- if (pluginNotFound("T2CodeLib", 96388, Util.requiredT2CodeLibVersion)) return;
- getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
- if (PluginCheck.papi()) {
- PaPi = true;
- }
- Load.onLoad(prefix, autor, version, spigot, spigotID, discord, bstatsID);
- enable = true;
-
- }
-
- public static void addonLoad() {
- if (Bukkit.getPluginManager().getPlugin("PlotSquaredGUI") != null) {
- PlotSquaredGUI = true;
- addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
- }
- if (Bukkit.getPluginManager().getPlugin("PlugManGUI") != null) {
- PlugManGUI = true;
- addonEnable(Bukkit.getPluginManager().getPlugin("PlugManGUI"));
- }
- }
-
- public static void addonEnable(Plugin plugin) {
- send.console(prefix + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
- }
-
- public static Boolean pluginNotFound(String pl, Integer spigotID) {
- if (Bukkit.getPluginManager().getPlugin(pl) == null) {
- plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
- Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
- "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
- Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
- return true;
- } else return false;
- }
-
- public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
- if (Bukkit.getPluginManager().getPlugin(pl) == null) {
- plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
- Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
- "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
- Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
- return true;
- } else {
- if (Double.parseDouble(Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion()) < ver) {
- plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
- Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4is out of date! This plugin requires at least version §2" + ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to use this version of " + plugin.getDescription().getName() + ".");
- Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
- return true;
- }
- return false;
- }
- }
-
- @Override
- public void onDisable() {
- // Plugin shutdown logic
- if (enable) T2CodeTemplate.onDisable(prefix, autor, version, spigot, discord);
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java
deleted file mode 100644
index 59e1739..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Obj_Select.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.Objekte;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
-import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
-import org.bukkit.configuration.file.YamlConfiguration;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-
-public class Obj_Select {
- public static void onSelect() {
- Main.guiHashMap.clear();
- Main.allAliases.clear();
- File f = new File(Main.getPath() + "/GUIs/");
- File[] fileArray = f.listFiles();
-
- for (File config_gui : fileArray) {
-
- Main.allAliases.add(config_gui.getName().replace(".yml", ""));
- String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
- if (sub.equals(".yml")) {
- YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config_gui);
-
- Boolean GUI_Enable = yamlConfiguration_gui.getBoolean("GUI.Enable");
- Integer GUI_Lines = yamlConfiguration_gui.getInt("GUI.Lines");
- if (yamlConfiguration_gui.getInt("GUI.Lines") > 6) {
- yamlConfiguration_gui.set("GUI.Lines", 6);
- }
- if (yamlConfiguration_gui.getInt("GUI.Lines") < 1) {
- yamlConfiguration_gui.set("GUI.Lines", 1);
- }
- String GUI_Name = yamlConfiguration_gui.getString("GUI.Name");
- Boolean GUI_FillItem_Enable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
- String GUI_FillItem_Item;
- if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
- GUI_FillItem_Item = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneCollor");
- } else GUI_FillItem_Item = yamlConfiguration_gui.getString("GUI.FillItem.Item");
-
-
- Boolean Command_Alias_Enable = yamlConfiguration_gui.getBoolean("Command.Alias");
- Boolean Command_Permission = yamlConfiguration_gui.getBoolean("Command.Permission.Required");
-
- ArrayList slots = new ArrayList<>();
- for (String key : yamlConfiguration_gui.getConfigurationSection("Slots").getKeys(false)) {
- Slot slot = new Slot(yamlConfiguration_gui.getInt("Slots." + key + ".Slot") - 1,
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Enable"),
- // yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.Removable"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.Empty"),
- yamlConfiguration_gui.getInt("Slots." + key + ".Item.Amount"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.PlayerHead.Enable"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.PlayerHead.Base64.Enable"),
- yamlConfiguration_gui.getString("Slots." + key + ".Item.PlayerHead.Base64.Base64Value"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Item.PlayerHead.PlayerWhoHasOpenedTheGUI"),
- yamlConfiguration_gui.getString("Slots." + key + ".Item.PlayerHead.PlayerName"),
- yamlConfiguration_gui.getString("Slots." + key + ".Item.Material"),
- yamlConfiguration_gui.getString("Slots." + key + ".Item.Name"),
- yamlConfiguration_gui.getList("Slots." + key + ".Item.Lore"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".CustomSound.Enable"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".CustomSound.NoSound"),
- yamlConfiguration_gui.getString("Slots." + key + ".CustomSound.Sound"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Cost.Enable"),
- yamlConfiguration_gui.getDouble("Slots." + key + ".Cost.Price"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Command.Enable"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Command.BungeeCommand"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Command.CommandAsConsole"),
- yamlConfiguration_gui.getStringList("Slots." + key + ".Command.Command"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".ServerChange.Enable"),
- yamlConfiguration_gui.getString("Slots." + key + ".ServerChange.Server"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".OpenGUI.Enable"),
- yamlConfiguration_gui.getString("Slots." + key + ".OpenGUI.GUI"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Message.Enable"),
- yamlConfiguration_gui.getStringList("Slots." + key + ".Message.Message"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".Permission.Required"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Enable"),
- yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.File.Path"),
- yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Option.Path"),
- yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Option.Premat"),
- // yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Value.ChatInput"),
-
- yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Value.LeftClick.String"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Value.LeftClick.Boolean"),
- yamlConfiguration_gui.getInt("Slots." + key + ".SetConfig.Value.LeftClick.Integer"),
- yamlConfiguration_gui.getDouble("Slots." + key + ".SetConfig.Value.LeftClick.Double"),
- yamlConfiguration_gui.getStringList("Slots." + key + ".SetConfig.Value.LeftClick.List"),
-
- yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.Value.RightClick.String"),
- yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.Value.RightClick.Boolean"),
- yamlConfiguration_gui.getInt("Slots." + key + ".SetConfig.Value.RightClick.Integer"),
- yamlConfiguration_gui.getDouble("Slots." + key + ".SetConfig.Value.RightClick.Double"),
- yamlConfiguration_gui.getStringList("Slots." + key + ".SetConfig.RightClick.Value.List"),
-
- yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.PluginReload.Enable"),
- yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.PluginReload.Command"));
- slots.add(slot);
-
- }
- Object objekt = new Object(GUI_Enable, GUI_Lines, GUI_Name, GUI_FillItem_Enable, GUI_FillItem_Item,
- config_gui.getName().replace(".yml", ""), Command_Alias_Enable, Command_Permission, slots);
-
- Main.guiHashMap.put(config_gui.getName().replace(".yml", ""), objekt);
- CmdExecuter_GUI.arg1.put(config_gui.getName().replace(".yml", ""), "commandgui.gui." + config_gui.getName().replace(".yml", ""));
-
- try {
- yamlConfiguration_gui.save(config_gui);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- }
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Object.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Object.java
deleted file mode 100644
index b7d493d..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Object.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.Objekte;
-
-import java.util.ArrayList;
-
-public class Object {
- public Boolean GUI_Enable;
- public Integer GUI_Lines;
- public String GUI_Name;
- public Boolean GUI_FillItem_Enable;
- public String GUI_FillItem_Item;
-
-
- public String Command_Command;
- public Boolean Command_Alias_Enable;
- public Boolean Command_Permission_Enable;
- public ArrayList GUI_Slots;
-
- public Object(Boolean GUI_Enable, Integer GUI_Lines, String GUI_Name, Boolean GUI_FillItem_Enable, String GUI_FillItem_Item,
- String Command_Command, Boolean Command_Alias_Enable, Boolean Command_Permission_Enable, ArrayList GUI_Slots){
- this.GUI_Enable = GUI_Enable;
- this.GUI_Lines = GUI_Lines;
- this.GUI_Name = GUI_Name;
- this.GUI_FillItem_Enable = GUI_FillItem_Enable;
- this.GUI_FillItem_Item = GUI_FillItem_Item;
- this.Command_Command = Command_Command;
- this.Command_Alias_Enable = Command_Alias_Enable;
- this.Command_Permission_Enable = Command_Permission_Enable;
- this.GUI_Slots = GUI_Slots;
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Slot.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Slot.java
deleted file mode 100644
index ca3015c..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Objekte/Slot.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.Objekte;
-
-import java.util.List;
-
-public class Slot {
-
- public Integer Slot;
- public Boolean Enable;
- // public Boolean ItemsRemovable;
- public Boolean Empty;
- public Integer ItemAmount;
- public Boolean PlayerHead_Enable;
- public Boolean Base64_Enable;
- public String Base64Value;
- public Boolean PlayerWhoHasOpenedTheGUI;
- public String PlayerName;
- public String Item;
- public String Name;
- public List Lore;
- public Boolean CustomSound_Enable;
- public Boolean CustomSound_NoSound;
- public String CustomSound_Sound;
- public Boolean Cost_Enable;
- public Double Price;
- public Boolean Command_Enable;
- public Boolean Command_BungeeCommand;
- public Boolean CommandAsConsole;
- public Boolean ServerChange;
- public String ServerChangeServer;
- public List Command;
- public Boolean OpenGUI_Enable;
- public String OpenGUI;
- public Boolean Message_Enable;
- public List Message;
- public Boolean Perm;
- public Boolean SetConfigEnable;
- public String ConfigFilePath;
- public String ConfigOptionPath;
- public String ConfigOptionPremat;
- // public Boolean ConfigChatInput;
-
- public String ConfigStringValueLeft;
- public Boolean ConfigBooleanValueLeft;
- public Integer ConfigIntegerValueLeft;
- public Double ConfigDoubleValueLeft;
- public List ConfigListValueLeft;
-
- public String ConfigStringValueRight;
- public Boolean ConfigBooleanValueRight;
- public Integer ConfigIntegerValueRight;
- public Double ConfigDoubleValueRight;
- public List ConfigListValueRight;
-
-
- public Boolean PluginReloadEnable;
- public String PluginReloadCommand;
-
- public Slot(Integer Slot,
- Boolean Enable,
- // Boolean ItemsRemovable,
- Boolean Empty,
- Integer ItemAmount,
- Boolean PlayerHead_Enable,
- Boolean Base64Value_Enable,
- String Base64Value,
- Boolean PlayerWhoHasOpenedTheGUI,
- String PlayerName,
- String Item,
- String Name,
- List Lore,
- Boolean CustomSound_Enable,
- Boolean CustomSound_NoSound,
- String CustomSound_Sound,
- Boolean Cost_Enable,
- Double Price,
- Boolean Command_Enable,
- Boolean Command_BungeeCommand,
- Boolean CommandAsConsole,
- List Command,
- Boolean ServerChange,
- String ServerChangeServer,
- Boolean OpenGUI_Enable,
- String OpenGUI,
- Boolean Message_Enable,
- List Message,
- Boolean Perm,
- Boolean SetConfigEnable,
- String ConfigFilePath,
- String ConfigOptionPath,
- String ConfigOptionPremat,
- // Boolean ConfigChatInput,
-
- String ConfigStringValueLeft,
- Boolean ConfigBooleanValueLeft,
- Integer ConfigIntegerValueLeft,
- Double ConfigDoubleValueLeft,
- List ConfigListValueLeft,
-
- String ConfigStringValueRight,
- Boolean ConfigBooleanValueRight,
- Integer ConfigIntegerValueRight,
- Double ConfigDoubleValueRight,
- List ConfigListValueRight,
-
- Boolean PluginReloadEnable,
- String PluginReloadCommand) {
- this.Slot = Slot;
- this.Enable = Enable;
- // this.ItemsRemovable = ItemsRemovable;
- this.Empty = Empty;
- this.ItemAmount = ItemAmount;
- this.PlayerHead_Enable = PlayerHead_Enable;
- this.Base64_Enable = Base64Value_Enable;
- this.Base64Value = Base64Value;
- this.PlayerWhoHasOpenedTheGUI = PlayerWhoHasOpenedTheGUI;
- this.PlayerName = PlayerName;
- this.Item = Item;
- this.Name = Name;
- this.Lore = Lore;
- this.CustomSound_Enable = CustomSound_Enable;
- this.CustomSound_NoSound = CustomSound_NoSound;
- this.CustomSound_Sound = CustomSound_Sound;
- this.Cost_Enable = Cost_Enable;
- this.Price = Price;
- this.Command_Enable = Command_Enable;
- this.Command_BungeeCommand = Command_BungeeCommand;
- this.CommandAsConsole = CommandAsConsole;
- this.Command = Command;
- this.ServerChange = ServerChange;
- this.ServerChangeServer = ServerChangeServer;
- this.OpenGUI_Enable = OpenGUI_Enable;
- this.OpenGUI = OpenGUI;
- this.Message_Enable = Message_Enable;
- this.Message = Message;
- this.Perm = Perm;
- this.SetConfigEnable = SetConfigEnable;
- this.ConfigFilePath = ConfigFilePath;
- this.ConfigOptionPath = ConfigOptionPath;
- this.ConfigOptionPremat = ConfigOptionPremat;
- // this.ConfigChatInput = ConfigChatInput;
-
- this.ConfigStringValueLeft = ConfigStringValueLeft;
- this.ConfigBooleanValueLeft = ConfigBooleanValueLeft;
- this.ConfigIntegerValueLeft = ConfigIntegerValueLeft;
- this.ConfigDoubleValueLeft = ConfigDoubleValueLeft;
- this.ConfigListValueLeft = ConfigListValueLeft;
-
- this.ConfigStringValueRight = ConfigStringValueRight;
- this.ConfigBooleanValueRight = ConfigBooleanValueRight;
- this.ConfigIntegerValueRight = ConfigIntegerValueRight;
- this.ConfigDoubleValueRight = ConfigDoubleValueRight;
- this.ConfigListValueRight = ConfigListValueRight;
-
-
- this.PluginReloadEnable = PluginReloadEnable;
- this.PluginReloadCommand = PluginReloadCommand;
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_Admin.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_Admin.java
deleted file mode 100644
index c7a7b28..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_Admin.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.cmdManagement;
-
-import de.jatitv.commandguiv2.Spigot.system.Debug;
-import de.jatitv.commandguiv2.Spigot.system.config.DefaultGUICreate;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Util;
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.TabCompleter;
-import org.bukkit.entity.Player;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-public class CmdExecuter_Admin implements CommandExecutor, TabCompleter {
- private static String prefix = Util.Prefix;
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
-
- if (args.length == 0) {
- Help.sendHelp(sender, prefix);
- } else {
- switch (args[0].toLowerCase()) {
- case "info":
- if (sender.hasPermission("commandgui.command.info")) {
- Commands.info(sender);
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand
- .replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.command.info"));
-
- break;
- case "reload":
- case "rl":
- if (sender.hasPermission("commandgui.admin")) {
- Commands.reload(sender);
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand
- .replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
- break;
- case "createdefaultgui":
- if (sender.hasPermission("commandgui.admin")) {
- DefaultGUICreate.configCreate();
- sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "/GUIs/default.yml"));
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand
- .replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
- break;
- case "debug":
- if (sender.hasPermission("commandgui.admin")) {
- Debug.onDebugFile(sender);
- /*if (args.length == 2) {
- if (args[1].equals("config")) {
- Debug.debugmsg();
- }
- if (args[1].equals("2")) {
- send.debug("2");
- }
- break;
-
- } else Debug.debugmsg();
-
- */
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
- break;
-
- case "give":
- if (args.length == 2) {
- if (sender.hasPermission("commandgui.giveitem.other")) {
- Player target = Bukkit.getPlayer(args[1]);
- Commands.give(sender, target);
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui give")
- .replace("[perm]", "commandgui.command.give"));
- } else Help.sendHelp(sender, prefix);
- break;
- case "help":
- default:
- Help.sendHelp(sender, prefix);
- break;
-
- }
- }
-
- return false;
- }
-
-
- //TabCompleter
- private static HashMap arg1 = new HashMap() {{
- put("reload", "commandgui.admin");
- put("rl", "commandgui.admin");
- put("createdefaultgui", "commandgui.admin");
- put("give", "commandgui.giveitem.other");
- put("info", "commandgui.command.info");
- }};
-
- @Override
- public List onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
- List list = new ArrayList<>();
- if (sender instanceof Player) {
- Player p = (Player) sender;
- if (args.length == 1) {
- for (String command : arg1.keySet()) {
- Boolean passend = true;
- for (int i = 0; i < args[0].length(); i++) {
- if (args[0].length() >= command.length()) {
- passend = false;
- } else {
- if (args[0].charAt(i) != command.charAt(i)) {
- passend = false;
- }
- }
- }
- if (hasPermission(p, arg1.get(command)) && passend) {
- list.add(command);
- }
- }
- }
-
- if (args.length == 2 && args[0].equalsIgnoreCase("give")) {
- if (sender.hasPermission("commandgui.giveitem.other")) {
- Iterator var6 = Bukkit.getOnlinePlayers().iterator();
-
- while (var6.hasNext()) {
- Player player1 = (Player) var6.next();
- list.add(player1.getName());
- }
- }
- return list;
- }
- }
- return list;
- }
-
-
- public static boolean hasPermission(Player player, String permission) {
- if (player.isOp()) {
- return true;
- }
- String[] Permissions = permission.split(";");
- for (String perm : Permissions) {
- if (player.hasPermission(perm)) {
- return true;
- }
- }
- return false;
- }
-}
-
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java
deleted file mode 100644
index 7a5aa4c..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.cmdManagement;
-
-import de.jatitv.commandguiv2.Spigot.system.Debug;
-import de.jatitv.commandguiv2.Spigot.system.config.DefaultGUICreate;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Util;
-import net.t2code.lib.Bungee.Lib.commands.BTab;
-import net.t2code.lib.Spigot.Lib.commands.Tab;
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.TabCompleter;
-import org.bukkit.entity.Player;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
- private static String prefix = Util.Prefix;
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (args.length == 0) {
- if (!(sender instanceof Player)) {
- sender.sendMessage(SelectMessages.OnlyForPlayer);
- return false;
- }
- Player player = (Player) sender;
- Commands.gui(player);
- } else {
- if (args[0].equals("admin")) {
- if (args.length == 1) {
- Help.sendHelp(sender, prefix);
- return false;
- }
-
- switch (args[1].toLowerCase()) {
- case "info":
- if (sender.hasPermission("commandgui.command.info")) {
- Commands.info(sender);
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand
- .replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.command.info"));
- break;
- case "reload":
- case "rl":
- if (sender.hasPermission("commandgui.admin")) {
- Commands.reload(sender);
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand
- .replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
- break;
- case "createdefaultgui":
- if (sender.hasPermission("commandgui.admin")) {
- DefaultGUICreate.configCreate();
- sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "/GUIs/default.yml"));
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand
- .replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
- break;
- case "debug":
- if (sender.hasPermission("commandgui.admin")) {
- Debug.onDebugFile(sender);
- /*if (args.length == 2) {
- if (args[1].equals("config")) {
- Debug.debugmsg();
- }
- if (args[1].equals("2")) {
- send.debug("2");
- }
- break;
-
- } else Debug.debugmsg();
-
- */
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
- break;
-
- case "give":
- if (args.length == 3) {
- if (sender.hasPermission("commandgui.giveitem.other")) {
- Player target = Bukkit.getPlayer(args[2]);
- Commands.give(sender, target);
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui give")
- .replace("[perm]", "commandgui.command.give"));
- } else Help.sendHelp(sender, prefix);
- break;
- case "help":
- default:
- Help.sendHelp(sender, prefix);
- break;
- }
- } else {
- if (sender instanceof Player) {
- Player player = (Player) sender;
- Commands.gui(player, args[0]);
- return false;
- }
- Help.sendHelp(sender, prefix);
- }
- }
-
- return false;
- }
-
- //TabCompleter
-
-
- public static HashMap arg1 = new HashMap();
-
- private static HashMap arg2 = new HashMap() {{
- put("reload", "commandgui.admin");
- put("rl", "commandgui.admin");
- put("createdefaultgui", "commandgui.admin");
- put("give", "commandgui.giveitem.other");
- put("info", "commandgui.command.info");
- }};
-
- @Override
- public List onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
- List list = new ArrayList<>();
-
- Tab.tab(list, sender, 0, args, arg1);
- Tab.tab(list, sender, 0, "admin", 1, args, arg2);
- Tab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
-
- // if (args.length == 1) {
- // for (String command : arg1.keySet()) {
- // Boolean passend = true;
- // for (int i = 0; i < args[0].length(); i++) {
- // if (args[0].length() >= command.length()) {
- // passend = false;
- // } else {
- // if (args[0].charAt(i) != command.charAt(i)) {
- // passend = false;
- // }
- // }
- // }
- // if (hasPermission(sender, arg1.get(command)) && passend) {
- // list.add(command);
- // }
- // }
- // }
- // if (args.length > 1) {
- // if (args[0].toLowerCase().equals("admin")){
- // return Tab.tab(sender,1,args,arg2);
- // }
- //
- // }
-
- return list;
- }
-
- public static boolean hasPermission(CommandSender sender, String permission) {
-
- if (permission.equals("")) {
- return true;
- }
- String[] Permissions = permission.split(";");
- for (String perm : Permissions) {
- if (sender.hasPermission(perm)) {
- return true;
- }
- }
- return false;
- }
-}
-
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUIItem.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUIItem.java
deleted file mode 100644
index e97b010..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUIItem.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.cmdManagement;
-
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Util;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.TabCompleter;
-import org.bukkit.entity.Player;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
- private static String prefix = Util.Prefix;
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- Player player = (Player) sender;
- if (sender.hasPermission("commandgui.useitem.toggle")) {
- if (args.length == 0) {
- Help.sendGUIItemHelp(sender, prefix);
- } else {
- if (args.length == 1 || args.length == 2) {
- if (sender instanceof Player) {
- if (SelectConfig.UseItem_AllowToggle) {
- switch (args[0].toLowerCase()) {
- case "on":
- Commands.itemOn(player);
- break;
- case "off":
- Commands.itemOff(player);
- break;
- case "slot":
- if (args.length == 2) {
- try {
- Commands.onSetSlot(player, Integer.valueOf(args[1]));
- } catch (Exception e5) {
- send.player(player, SelectMessages.ItemSlot_wrongValue);
- }
-
- } else send.player(player, "§4Use: §7/gui-item slot [slot]");
-
- break;
- default:
- Help.sendHelp(player, prefix);
-
- }
- }
- } else sender.sendMessage(SelectMessages.OnlyForPlayer);
- }
- }
- } else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui-item").replace("[perm]", "commandgui.useitem.toggle"));
- return false;
- }
-
-
- //TabCompleter
- private static HashMap arg1 = new HashMap() {{
- put("on", "commandgui.useitem.toggle");
- put("off", "commandgui.useitem.toggle");
- if (SelectConfig.UseItem_AllowSetSlot) {
- put("slot", "commandgui.useitem.toggle");
- }
- }};
-
- @Override
- public List onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
- List list = new ArrayList<>();
- if (sender instanceof Player) {
- if (SelectConfig.UseItem_AllowToggle) {
- Player p = (Player) sender;
- if (args.length == 1) {
- for (String command : arg1.keySet()) {
- Boolean passend = true;
- for (int i = 0; i < args[0].length(); i++) {
- if (args[0].length() >= command.length()) {
- passend = false;
- } else {
- if (args[0].charAt(i) != command.charAt(i)) {
- passend = false;
- }
- }
- }
- if (hasPermission(p, arg1.get(command)) && passend) {
- list.add(command);
- }
- }
- }
- }
- }
- return list;
- }
-
- public static boolean hasPermission(Player player, String permission) {
- if (player.isOp()) {
- return true;
- }
- String[] Permissions = permission.split(";");
- for (String perm : Permissions) {
- if (player.hasPermission(perm)) {
- return true;
- }
- }
- return false;
- }
-
-}
-
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_Help.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_Help.java
deleted file mode 100644
index 5d185ed..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_Help.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.cmdManagement;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Util;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-
-public class CmdExecuter_Help implements CommandExecutor {
- private static String prefix = Util.Prefix;
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (args.length == 0) {
- Help.sendHelp(sender, prefix);
- } else Help.sendHelp(sender, prefix);
- return false;
-
- }
-
-}
-
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java
deleted file mode 100644
index 0c90f14..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.cmdManagement;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.Objekte.Obj_Select;
-import de.jatitv.commandguiv2.Spigot.Objekte.Object;
-import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
-import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
-import de.jatitv.commandguiv2.Spigot.system.Give_UseItem;
-import de.jatitv.commandguiv2.Spigot.system.config.config.ConfigCreate;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.LanguagesCreate;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
-import de.jatitv.commandguiv2.Util;
-import net.md_5.bungee.api.chat.ClickEvent;
-import net.md_5.bungee.api.chat.TextComponent;
-import net.t2code.lib.Spigot.Lib.items.ItemVersion;
-import net.t2code.lib.Spigot.Lib.messages.TextBuilder;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.plugin.Plugin;
-
-public class Commands {
- private static Plugin plugin = Main.plugin;
- private static String prefix = Util.Prefix;
- private static String autor = String.valueOf(Main.autor);
- private static String version = Main.version;
- private static String spigot = Util.Spigot;
- private static String discord = Util.Discord;
-
- public static void info(CommandSender sender) {
- if (sender instanceof Player) {
- Player player = (Player) sender;
- send.player(player, prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
- send.player(player, prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
-
- if (UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion.equalsIgnoreCase(version)) {
- send.player(player, prefix + " §2Version: §6" + version);
- } else {
- UpdateAPI.sendUpdateMsg(prefix,spigot,discord,version,UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion,player);
- }
-
- send.player(player, prefix + " §2Spigot: §6" + spigot);
- send.player(player, prefix + " §2Discord: §6" + discord);
- send.player(player, prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
- } else {
- send.sender(sender, prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
- send.sender(sender, prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
-
- if (UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion.equalsIgnoreCase(version)) {
- send.sender(sender,prefix + " §2Version: §6" + version);
- } else {
- UpdateAPI.sendUpdateMsg(prefix,spigot,discord,version,UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion);
- }
-
- send.sender(sender, prefix + " §2Spigot: §6" + spigot);
- send.sender(sender, prefix + " §2Discord: §6" + discord);
- send.sender(sender, prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
- }
- }
-
- public static void reload(CommandSender sender) {
- if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadStart);
- send.console(prefix + "§8-------------------------------");
- send.console(prefix + " §6Plugin reload...");
- send.console(prefix + "§8-------------------------------");
-
- CmdExecuter_GUI.arg1.clear();
- CmdExecuter_GUI.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
- ConfigCreate.configCreate();
- SelectConfig.onSelect();
- plugin.reloadConfig();
-
- LanguagesCreate.langCreate();
-
- Obj_Select.onSelect();
- SelectMessages.onSelect(prefix);
- SelectConfig.sound(prefix);
- try {
- AliasRegister.onRegister();
- } catch (Exception e) {
- e.printStackTrace();
- }
- if (SelectConfig.Bungee){
- Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "commandgui:bungee");
-
- }
-
- if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadEnd);
- send.console(prefix + "§8-------------------------------");
- send.console(prefix + " §2Plugin successfully reloaded.");
- send.console(prefix + "§8-------------------------------");
- }
-
- public static void give(CommandSender sender, Player target) {
- if (Bukkit.getPlayer(target.getName()) != null) {
- Give_UseItem.onGive(target);
- send.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", SelectConfig.UseItem_Name));
- send.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", SelectConfig.UseItem_Name));
- if (SelectConfig.Sound_Give_Enable && SelectConfig.Sound_Enable) {
- target.playSound(target.getLocation(), SelectConfig.Sound_Give, 3, 1);
- }
- } else {
- sender.sendMessage(SelectMessages.PlayerNotFond.replace("[player]", target.getName()));
- if (SelectConfig.Sound_PlayerNotFound_Enable && SelectConfig.Sound_Enable) {
- if (sender instanceof Player)
- ((Player) sender).playSound(((Player) sender).getLocation(), SelectConfig.Sound_PlayerNotFound, 3, 1);
- }
- }
- }
-
- public static void itemOn(Player player) {
- for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
- ItemStack itm = player.getInventory().getItem(iam);
- if (itm != null) {
- if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
- if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- player.getInventory().remove(itm);
- player.updateInventory();
- break;
- }
- }
- }
- }
- Integer slot = null;
- if (Select_Database.selectSlot(player) == null) {
- slot = SelectConfig.UseItem_InventorySlot;
- } else {
- slot = Select_Database.selectSlot(player);
- }
- send.debug(plugin,String.valueOf(slot));
- if (player.getInventory().getItem(slot - 1) == null) {
- Select_Database.setItemStatusTrue(player);
- Give_UseItem.onGive(player);
- } else {
- boolean empty = false;
- for (int i = 0; i < 9; i++) {
- if (player.getInventory().getItem(i) == null) {
- empty = true;
- break;
- }
- }
- if (empty) {
- Select_Database.setItemStatusTrue(player);
- Give_UseItem.onGiveADD(player);
- send.player(player, SelectMessages.ItemON);
- } else {
- player.sendMessage(SelectMessages.NoInventorySpace);
- if (SelectConfig.Sound_NoInventorySpace_Enable && SelectConfig.Sound_Enable) {
- player.playSound(player.getLocation(), SelectConfig.Sound_NoInventorySpace, 3, 1);
- }
- }
- }
- }
-
- public static void itemOff(Player player) {
- Select_Database.setItemStatusFalse(player);
- for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
- ItemStack itm = player.getInventory().getItem(iam);
- if (itm != null) {
- if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
- if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- player.getInventory().remove(itm);
- player.updateInventory();
- send.player(player, SelectMessages.ItemOFF);
- }
- }
- }
- }
- }
-
- public static void onSetSlot(Player player, Integer setSlot) {
- if (SelectConfig.UseItem_AllowSetSlot) {
- if (setSlot < 1) {
- send.player(player, SelectMessages.ItemSlot_wrongValue);
- return;
- }
- if (setSlot > 9) {
- send.player(player, SelectMessages.ItemSlot_wrongValue);
- return;
- }
- ItemStack itm1 = player.getInventory().getItem(setSlot - 1);
- if (itm1 != null) {
- if (itm1.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm1.getType() == ItemVersion.getHead()) {
- if (itm1.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- player.sendMessage(SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
- return;
- }
- }
- }
- if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(setSlot - 1) != null) {
- send.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
- return;
- }
- for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
- ItemStack itm = player.getInventory().getItem(iam);
- if (itm != null) {
- if (itm.getType() == Material.valueOf(SelectConfig.UseItem_Material) || itm.getType() == ItemVersion.getHead()) {
- if (itm.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name)) {
- player.getInventory().remove(itm);
- player.updateInventory();
- break;
- }
- }
- }
- }
- Select_Database.setSlot(player, setSlot);
- if (Select_Database.selectItemStatus(player)) {
- Give_UseItem.onGive(player);
- }
- send.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
- } else player.sendMessage(prefix + " §4Function disabled");
- }
-
- public static void gui(Player player) {
- if (Main.guiHashMap.containsKey(SelectConfig.DefaultGUI)) {
- Object gui = Main.guiHashMap.get(SelectConfig.DefaultGUI);
- if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
- if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
- OpenGUI.openGUI(player, gui, SelectConfig.DefaultGUI);
- if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
- player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
- }
- } else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
- .replace("[perm]", "commandgui.command"));
- } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name));
- }
- }
- public static void gui(Player player, String arg){
- if (Main.guiHashMap.containsKey(arg)) {
- Object gui = Main.guiHashMap.get(arg);
- if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
- if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + gui.Command_Command) || player.hasPermission("commandgui.bypass")) {
- OpenGUI.openGUI(player, gui, arg);
- if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
- player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
- }
- } else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.Command_Command)
- .replace("[perm]", "commandgui.command." + arg.toLowerCase()));
- } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.Command_Command));
- } else player.sendMessage(SelectMessages.GUInotFound);
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Help.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Help.java
deleted file mode 100644
index 34320a1..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Help.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.cmdManagement;
-
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.Objekte.Object;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import de.jatitv.commandguiv2.Util;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.replace.Replace;
-import org.bukkit.command.CommandSender;
-
-public class Help {
- private static String prefix = Util.Prefix;
- public static void sendHelp(CommandSender sender, String Prefix) {
- send.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
- if (sender.hasPermission("commandgui.command")) {
- Object gui = Main.guiHashMap.get(SelectConfig.DefaultGUI);
- send.sender(sender, Prefix + " " + SelectMessages.HelpCgui.replace("[gui]", Replace.replace(prefix,gui.GUI_Name)));
- for (String alias : Main.allAliases) {
- if (Main.guiHashMap.get(alias).GUI_Enable || sender.hasPermission("commandgui.bypass")) {
- send.sender(sender, Prefix + " " + SelectMessages.HelpOpen.replace("[gui]", alias).replace("[guiname]", Replace.replace(prefix,Main.guiHashMap.get(alias).GUI_Name)));
- }
- }
- send.sender(sender, Prefix + " " + SelectMessages.HelpHelp);
- }
- if (sender.hasPermission("commandgui.useitem.toggle")) {
- send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_on);
- send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_off);
- send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_Slot);
- }
- if (sender.hasPermission("commandgui.command.info")) {
- send.sender(sender, Prefix + " " + SelectMessages.HelpInfo);
- }
- // if (sender.hasPermission("commandgui.command.give")) {
- // send.sender(sender, Prefix + " " + Select_msg.HelpGive);
- // }
- if (sender.hasPermission("commandgui.admin")) {
- send.sender(sender, Prefix + " " + SelectMessages.HelpCreateDefaultGUI.replace("[directory]", Main.getPath()+ "\\GUIs\\default.yml"));
- send.sender(sender, Prefix + " " + SelectMessages.HelpReload);
- }
- send.sender(sender, Prefix + " §8-------------------------");
- }
-
- public static void sendGUIItemHelp(CommandSender sender, String Prefix) {
- if (sender.hasPermission("commandgui.useitem.toggle")) {
- send.sender(sender, Prefix + " §8------ §4Command§9GUI§2Item §chelp §8------");
- send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_on);
- send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_off);
- send.sender(sender, Prefix + " " + SelectMessages.GUIItemHelp_Slot);
- send.sender(sender, Prefix + " §8------------------------------");
- }
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/AliasRegister.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/AliasRegister.java
deleted file mode 100644
index b942040..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/AliasRegister.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.cmdManagement.register;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-
-import de.jatitv.commandguiv2.Util;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
-import org.bukkit.Bukkit;
-import org.bukkit.plugin.Plugin;
-
-import java.io.File;
-
-
-public class AliasRegister {
- public static void onRegister() {
- Plugin plugin = Main.plugin;
- send.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
- File f = new File(Main.getPath() + "/GUIs/");
- File[] fileArray = f.listFiles();
- if (Main.allAliases.toString().equals("[]")) {
- send.console(Util.Prefix + " §4No GUI files available");
- return;
- }
- for (String alias : Main.allAliases) {
- if (Main.guiHashMap.get(alias) != null) {
- if (Main.guiHashMap.get(alias).Command_Alias_Enable) {
- String version;
- if (NMSVersion.v1_8_R1) {
- send.debug(plugin, "Alias register 1.8_R1");
- org.bukkit.craftbukkit.v1_8_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_8_R2) {
- send.debug(plugin, "Alias register 1.8_R2");
- org.bukkit.craftbukkit.v1_8_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R2.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_8_R3) {
- send.debug(plugin, "Alias register 1.8_R3");
- org.bukkit.craftbukkit.v1_8_R3.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R3.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_9_R1) {
- send.debug(plugin, "Alias register 1.9_R1");
- org.bukkit.craftbukkit.v1_9_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_9_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_9_R2) {
- send.debug(plugin, "Alias register 1.9_R2");
- org.bukkit.craftbukkit.v1_9_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_9_R2.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_10_R1) {
- send.debug(plugin, "Alias register 1.10_R1");
- org.bukkit.craftbukkit.v1_10_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_10_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_11_R1) {
- send.debug(plugin, "Alias register 1.11_R1");
- org.bukkit.craftbukkit.v1_11_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_11_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_12_R1) {
- send.debug(plugin, "Alias register 1.12_R1");
- org.bukkit.craftbukkit.v1_12_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_12_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_13_R1) {
- send.debug(plugin, "Alias register 1.13_R1");
- org.bukkit.craftbukkit.v1_13_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_13_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_13_R2) {
- send.debug(plugin, "Alias register 1.13_R2");
- org.bukkit.craftbukkit.v1_13_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_13_R2.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_14_R1) {
- send.debug(plugin, "Alias register 1.14_R1");
- org.bukkit.craftbukkit.v1_14_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_14_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_15_R1) {
- send.debug(plugin, "Alias register 1.15_R1");
- org.bukkit.craftbukkit.v1_15_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_15_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_16_R1) {
- send.debug(plugin, "Alias register 1.16_R1");
- org.bukkit.craftbukkit.v1_16_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_16_R2) {
- send.debug(plugin, "Alias register 1.16_R2");
- org.bukkit.craftbukkit.v1_16_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R2.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_16_R3) {
- send.debug(plugin, "Alias register 1.16_R3");
- org.bukkit.craftbukkit.v1_16_R3.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R3.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_17_R1) {
- send.debug(plugin, "Alias register 1.17_R1");
- org.bukkit.craftbukkit.v1_17_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_17_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- if (NMSVersion.v1_18_R1) {
- send.debug(plugin, "Alias register 1.18_R1");
- org.bukkit.craftbukkit.v1_18_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_18_R1.CraftServer) plugin.getServer();
- craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
- }
- }
- }
- }
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/RegisterCommand.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/RegisterCommand.java
deleted file mode 100644
index 5e1f00a..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/RegisterCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.cmdManagement.register;
-
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.Objekte.Object;
-import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-public class RegisterCommand extends Command {
- private String alias;
-
- public RegisterCommand(String alias) {
- super(alias);
- this.alias = alias;
- }
-
- @Override
- public boolean execute(CommandSender sender, String commandLabel, String[] args) {
-
- if (sender instanceof Player) {
- Player player = (Player) sender;
- Object gui = Main.guiHashMap.get(alias);
- if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
- if (!gui.Command_Permission_Enable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
- OpenGUI.openGUI(player, gui, alias);
- if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {
- player.playSound(player.getLocation(), SelectConfig.Sound_OpenInventory, 3, 1);
- }
- } else player.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
- .replace("[perm]", "commandgui.command." + alias));
- } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", gui.GUI_Name));
- } else sender.sendMessage("§8[§6Command§9GUI§8] §cThis command is only for players!");
- return true;
- }
-}
-
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java
deleted file mode 100644
index fc779f2..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java
+++ /dev/null
@@ -1,187 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.gui;
-
-import com.mojang.authlib.GameProfile;
-import com.mojang.authlib.properties.Property;
-import de.jatitv.commandguiv2.Spigot.Listener.GUI_Listener;
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import de.jatitv.commandguiv2.Spigot.Objekte.Object;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import de.jatitv.commandguiv2.Util;
-import io.github.solyze.plugmangui.inventories.PluginListGUI;
-import net.t2code.lib.Spigot.Lib.items.ItemVersion;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
-import net.t2code.lib.Spigot.Lib.replace.Replace;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.inventory.meta.SkullMeta;
-import org.bukkit.plugin.Plugin;
-
-import java.lang.reflect.Field;
-import java.util.UUID;
-
-public class OpenGUI {
- private static Plugin plugin = Main.plugin;
- private static String prefix = Util.Prefix;
-
- public static void openGUI(Player player, Object gui, String guiString) {
- Long long_ = Long.valueOf(System.currentTimeMillis());
- switch (guiString) {
- //case "plugin.PlotSquaredGUI":
- // if (Main.PlotSquaredGUI) {
- // PlotSquaredGUIapi.openMainGUI(player);
- // } else {
- // if (player.hasPermission("commandgui.admin")) {
- // send.player(player, prefix + " §4PlotSquaredGUI could not be found! §9Please download it here: " +
- // "§6https://spigotmc.org/resources/plotsquaredgui.77506/");
- // }
- // }
- // return; todo
- case "plugin.PlugManGUI":
- if (Main.PlugManGUI) {
- player.openInventory((new PluginListGUI(54, 1)).getInventory());
- } else {
- if (player.hasPermission("commandgui.admin")) {
- send.player(player, prefix + " §4PlugManGUI could not be found! §9Please download it here: " +
- "§6https://spigotmc.org/resources/plugmangui.87599/");
- }
- }
- return;
- }
-
- if (MCVersion.minecraft1_13) {
- GUI_Listener.GUICode = "";
- } else GUI_Listener.GUICode = "§6§8§9§r";
- if (gui.GUI_Enable || player.hasPermission("commandgui.bypass")) {
- Inventory inventory;
- if (Main.PaPi) {
- inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.GUI_Lines, (Replace.replace(prefix, player, GUI_Listener.GUICode + gui.GUI_Name)));
- } else inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.GUI_Lines, (Replace.replace(prefix, GUI_Listener.GUICode + gui.GUI_Name)));
-
- if (gui.GUI_FillItem_Enable) {
- ItemStack glass;
- if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
- glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.valueOf(gui.GUI_FillItem_Item));
- } else glass = new ItemStack(Material.valueOf(gui.GUI_FillItem_Item.toUpperCase().replace(".", "_")));
- ItemMeta itemMetaglass = glass.getItemMeta();
- itemMetaglass.setDisplayName(" ");
- glass.setItemMeta(itemMetaglass);
- glass.setAmount(1);
- for (int i = 0; i < 9 * gui.GUI_Lines; i++) {
- inventory.setItem(i, glass);
- }
- }
- for (Slot slot : gui.GUI_Slots) {
- if (slot.Enable) {
- if (slot.Empty) {
- ItemStack air = new ItemStack(Material.AIR);
- inventory.setItem(slot.Slot, air);
- } else {
- if (slot.PlayerHead_Enable) {
- if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
- send.player(player, prefix + "§c Playerheads are only available from version §61.13§c! §7- §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
- send.error(plugin, "Playerheads are only available from version 1.13!");
- send.console(prefix + " §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
- } else {
-
- if (slot.Base64_Enable) {
- ItemStack item = ItemVersion.getHeadIS();
- SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
- if (Main.PaPi) {
- itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
- } else {
- itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
- }
- GameProfile profile = new GameProfile(UUID.randomUUID(), "");
- profile.getProperties().put("textures", new Property("textures", slot.Base64Value));
- Field profileField = null;
- try {
- profileField = itemMeta.getClass().getDeclaredField("profile");
- profileField.setAccessible(true);
- profileField.set(itemMeta, profile);
- } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
- e.printStackTrace();
- }
- item.setItemMeta(itemMeta);
- Integer am;
- if (slot.ItemAmount == 0) {
- am = 1;
- } else am = slot.ItemAmount;
- item.setAmount(am);
- inventory.setItem(slot.Slot, item);
- } else {
- if (slot.PlayerWhoHasOpenedTheGUI) {
- ItemStack item = ItemVersion.getHeadIS();
- SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
- if (Main.PaPi) {
- itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
- } else {
- itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
- }
- itemMeta.setOwner(player.getName());
- item.setItemMeta(itemMeta);
- Integer am;
- if (slot.ItemAmount == 0) {
- am = 1;
- } else am = slot.ItemAmount;
- item.setAmount(am);
- inventory.setItem(slot.Slot, item);
- } else {
- ItemStack item = ItemVersion.getHeadIS();
- SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
- if (Main.PaPi) {
- itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
- } else {
- itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
- }
- itemMeta.setOwner(slot.PlayerName);
- item.setItemMeta(itemMeta);
- Integer am;
- if (slot.ItemAmount == 0) {
- am = 1;
- } else am = slot.ItemAmount;
- item.setAmount(am);
- inventory.setItem(slot.Slot, item);
- }
- }
- }
- } else {
- ItemStack item = new ItemStack(Material.valueOf(slot.Item.toUpperCase().replace(".", "_")));
- ItemMeta itemMeta = item.getItemMeta();
- if (Main.PaPi) {
- itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
- } else {
- itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
- }
- item.setItemMeta(itemMeta);
- Integer am;
- if (slot.ItemAmount == 0) {
- am = 1;
- } else am = slot.ItemAmount;
- item.setAmount(am);
- inventory.setItem(slot.Slot, item);
- }
- }
- }
- }
-
- player.openInventory(inventory);
- send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.GUI_Name) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
- } else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.GUI_Name)));
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Bungee_Sender_Reciver.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Bungee_Sender_Reciver.java
deleted file mode 100644
index 8bb6b12..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Bungee_Sender_Reciver.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.system;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.messaging.PluginMessageListener;
-
-import java.io.*;
-
-public class Bungee_Sender_Reciver implements PluginMessageListener {
-
- public static void sendToBungee(Player player,String channel, String information) {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- DataOutputStream output = new DataOutputStream(stream);
- try {
- output.writeUTF(channel);
- output.writeUTF(information);
- } catch (IOException e) {
- e.printStackTrace();
- }
- player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
- }
-
- @Override
- public void onPluginMessageReceived(String channel, Player player, byte[] message) {
- DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
- try {
- String subChannel = stream.readUTF();
- String input = stream.readUTF();
- switch (subChannel) {
- case "join":
- Main.bungeeplayers.add(input);
- Main.bungeejoinplayers.add(input);
- break;
- case "left":
- Main.bungeeplayers.remove(input);
- Main.bungeejoinplayers.remove(input);
- break;
- case "clear":
- Main.bungeeplayers.clear();
- Main.bungeejoinplayers.clear();
- break;
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Debug.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Debug.java
deleted file mode 100644
index 98f3fba..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Debug.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.system;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import org.bukkit.Bukkit;
-import org.bukkit.command.CommandSender;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.Plugin;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.List;
-
-public class Debug {
-
- private static Plugin plugin = Main.plugin;
- public static void debugmsg() {
-
-
- send.debug(plugin,"§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- send.debug(plugin,"§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
- send.debug(plugin,"§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
- send.debug(plugin,"§3Version: §e" + Bukkit.getVersion());
- send.debug(plugin,"§3Java: §e" + System.getProperty("java.version"));
- send.debug(plugin,"§3Worlds: §e" +String.valueOf(Bukkit.getServer().getWorlds()));
- send.debug(plugin,String.valueOf(Main.plugins));
- send.debug(plugin,"§5----------------------------------");
- if (new File(Main.getPath(), "config.yml").exists()) {
- File f = new File(String.valueOf(Main.getPath()));
- File f2 = new File(String.valueOf(Main.getPath() + "/GUIs/"));
- File f3 = new File(String.valueOf(Main.getPath() + "/languages/"));
- File[] fileArray = f.listFiles();
- File[] fileArray2 = f2.listFiles();
- File[] fileArray3 = f3.listFiles();
- for (File config : fileArray) {
- send.debug(plugin,String.valueOf(config).replace("plugins/CommandGUI/", ""));
- }
- for (File config2 : fileArray2) {
- send.debug(plugin,String.valueOf(config2).replace("plugins/CommandGUI/", ""));
- }
- for (File config3 : fileArray3) {
- send.debug(plugin,String.valueOf(config3).replace("plugins/CommandGUI/", ""));
- }
- }
- send.debug(plugin,"§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-
- }
-
- public static void onDebugFile(CommandSender sender){
- String timeStamp = new SimpleDateFormat("dd_MM_yyyy_HH_mm_ss").format(Calendar.getInstance().getTime());
- String timeStampcfg = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(Calendar.getInstance().getTime());
- send.sender(sender, Main.prefix + " §5Debug file was createt: §e" + Main.getPath() + "\\debug\\commandgui_debug_"+ timeStamp +".yml");
- File debug = new File(Main.getPath(), "debug/commandgui_debug_"+ timeStamp +".yml");
- YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(debug);
-
- set("Time", timeStampcfg, yamlConfiguration);
- set("CommandGUI.Version", String.valueOf(plugin.getDescription().getVersion()), yamlConfiguration);
-
- set("Server.Bukkit_Version", String.valueOf(Bukkit.getBukkitVersion()), yamlConfiguration);
- set("Server.NMS_Version", String.valueOf(Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", "")), yamlConfiguration);
- set("Server.Version", String.valueOf(Bukkit.getVersion()), yamlConfiguration);
- set("Server.Java", String.valueOf(System.getProperty("java.version")), yamlConfiguration);
- set("Server.Worlds", String.valueOf(Bukkit.getServer().getWorlds()), yamlConfiguration);
- set("Server.Plugins", String.valueOf(Main.plugins) , yamlConfiguration);
-
- try {
- yamlConfiguration.save(debug);
- } catch (IOException e) {
- send.warning(plugin,e.getMessage());
- e.printStackTrace();
- }
- }
-
- private static void set(String path, String value, YamlConfiguration config){
- if (!config.contains(path)) {
- config.set(path, value);
- }
- }
- private static void set(String path, Integer value, YamlConfiguration config){
- if (!config.contains(path)) {
- config.set(path, value);
- }
- }
- private static void set(String path, Boolean value, YamlConfiguration config){
- if (!config.contains(path)) {
- config.set(path, value);
- }
- }
- private static void set(String path, List value, YamlConfiguration config){
- if (!config.contains(path)) {
- config.set(path, value);
- }
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Give_UseItem.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Give_UseItem.java
deleted file mode 100644
index aba390a..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Give_UseItem.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.system;
-
-import com.mojang.authlib.GameProfile;
-import com.mojang.authlib.properties.Property;
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
-import de.jatitv.commandguiv2.Util;
-import net.t2code.lib.Spigot.Lib.items.ItemVersion;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
-import net.t2code.lib.Spigot.Lib.replace.Replace;
-import org.bukkit.Material;
-import org.bukkit.entity.Item;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.inventory.meta.SkullMeta;
-
-import java.lang.reflect.Field;
-import java.util.UUID;
-
-public class Give_UseItem {
- private static String prefix = Util.Prefix;
-
-
- public static void onGive(Player player) {
- Integer slot;
- if (Select_Database.selectSlot(player) == null) {
- slot = SelectConfig.UseItem_InventorySlot;
- } else {
- slot = Select_Database.selectSlot(player);
- }
- if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
- player.getInventory().addItem(itemStack(player));
- } else player.getInventory().setItem(slot - 1, itemStack(player));
- }
-
- public static void onGiveADD(Player player) {
- if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
- player.getInventory().addItem(itemStack(player));
- } else player.getInventory().addItem(itemStack(player));
- }
-
- private static ItemStack itemStack(Player player) {
- ItemStack item = null;
- if (SelectConfig.UseItem_PlayerHead_Enable) {
- if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
- send.player(player, Main.prefix + "§c Playerheads for UseItem are only available from version §61.13§c!");
- send.error(Main.plugin, "Playerheads for UseItem are only available from version 1.13!");
- } else {
- item = ItemVersion.getHeadIS();
- SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
- playerheadmeta.setDisplayName(SelectConfig.UseItem_Name);
- if (SelectConfig.UseItem_Base64_Enable) {
- if (Main.PaPi) {
- playerheadmeta.setLore(Replace.replace(prefix, player, SelectConfig.UseItem_Lore));
- } else playerheadmeta.setLore(Replace.replace(prefix, SelectConfig.UseItem_Lore));
- GameProfile profile = new GameProfile(UUID.randomUUID(), "");
- profile.getProperties().put("textures", new Property("textures", SelectConfig.UseItem_Base64value));
- Field profileField = null;
- try {
- profileField = playerheadmeta.getClass().getDeclaredField("profile");
- profileField.setAccessible(true);
- profileField.set(playerheadmeta, profile);
- } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
- e.printStackTrace();
- }
- } else {
- String p;
- if (SelectConfig.UseItem_PlayerWhoHasOpenedTheGUI) {
- p = player.getName();
- } else p = SelectConfig.UseItem_PlayerName;
- playerheadmeta.setOwner(p);
- if (Main.PaPi) {
- playerheadmeta.setLore(Replace.replace(prefix, player, SelectConfig.UseItem_Lore));
- } else playerheadmeta.setLore(Replace.replace(prefix, SelectConfig.UseItem_Lore));
- }
- item.setItemMeta(playerheadmeta);
- }
- } else {
- item = new ItemStack(Material.valueOf(SelectConfig.UseItem_Material));
- ItemMeta itemMeta = item.getItemMeta();
- itemMeta.setDisplayName(SelectConfig.UseItem_Name);
- if (Main.PaPi) {
- itemMeta.setLore(Replace.replace(prefix, player, SelectConfig.UseItem_Lore));
- } else itemMeta.setLore(Replace.replace(prefix, SelectConfig.UseItem_Lore));
- item.setItemMeta(itemMeta);
- item.setAmount(1);
- }
- return item;
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java
deleted file mode 100644
index de9e984..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package de.jatitv.commandguiv2.Spigot.system;
-
-import de.jatitv.commandguiv2.Spigot.Listener.GUI_Listener;
-import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events_from1_10;
-import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_Admin;
-import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
-import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
-import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
-import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
-import de.jatitv.commandguiv2.Spigot.system.config.DefaultGUICreate;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.LanguagesCreate;
-import de.jatitv.commandguiv2.Spigot.system.config.languages.SelectMessages;
-import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
-import de.jatitv.commandguiv2.Spigot.Listener.PluginEvent;
-import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.Objekte.Obj_Select;
-import de.jatitv.commandguiv2.Spigot.system.config.config.ConfigCreate;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
-import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
-import org.bukkit.Bukkit;
-import org.bukkit.plugin.Plugin;
-
-import java.io.*;
-import java.util.List;
-
-public class Load {
- static Plugin plugin = Main.plugin;
-
- public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
-
- Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
- try {
- Debug.debugmsg();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- send.console(prefix + " §8-------------------------------");
-
-
- if (!new File(Main.getPath(), "config.yml").exists()) {
- try {
- DefaultGUICreate.configCreate();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- try {
- ConfigCreate.configCreate();
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- SelectConfig.onSelect();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- if (SelectConfig.Bungee) {
- if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin,"cgui:bungee")){
- send.debug(plugin, "registerIncomingPluginChannel §ecgui:bungee");
- Bukkit.getMessenger().registerOutgoingPluginChannel(plugin,"cgui:bungee");
- }
- }
-
- try {
- LanguagesCreate.langCreate();
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- Obj_Select.onSelect();
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- CmdExecuter_GUI.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- SelectMessages.onSelect(prefix);
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- SelectConfig.sound(prefix);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- send.console(prefix + " §8-------------------------------");
- if (SelectConfig.Storage.equals("MYSQL")) {
- MySQL.main();
- try {
- MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
- " `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
- " `Name` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
- " `Status` INT(1) NOT NULL DEFAULT '1'," +
- " `Slot` INT(1) NULL DEFAULT NULL," +
- " UNIQUE INDEX `UUID` (`UUID`)" +
- ")" +
- "COLLATE='utf8mb4_general_ci'" +
- "ENGINE=InnoDB" +
- ";");
- MySQL.query("ALTER TABLE `gui-item` ADD COLUMN IF NOT EXISTS `Slot` INT(1) NULL DEFAULT NULL AFTER `Status`;");
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- } else {
- if (SelectConfig.Debug) send.console(prefix + " §6Storage medium §2YML §6is used.");
- }
- if (Main.PaPi) {
- send.console(prefix + " §2PlaceholderAPI successfully connected!");
- } else {
- send.console(prefix + " §4PlaceholderAPI could not be connected / found!");
- }
-
- try {
- RegisterPermissions.onPermRegister();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- // Main.plugin.getCommand("commandguiadmin").setExecutor(new CmdExecuter_Admin());
- // send.debug(plugin, "Commandregister: commandguiadmin");
-
- if (SelectConfig.HelpAlias) {
- Main.plugin.getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
- send.debug(plugin, "Commandregister: commandguihelp");
- }
- Main.plugin.getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
- send.debug(plugin, "Commandregister: commandgui");
- Main.plugin.getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
- send.debug(plugin, "Commandregister: commandgui-item");
-
- try {
- AliasRegister.onRegister();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
-
- Bukkit.getServer().getPluginManager().registerEvents(new GUI_Listener(), plugin);
- Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
-
- Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.plugin);
-
- if (!MCVersion.minecraft1_8 && !MCVersion.minecraft1_9) {
- Bukkit.getServer().getPluginManager().registerEvents(new Events_from1_10(), plugin);
- }
-
-
- UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
- Metrics.Bstats();
- Main.addonLoad();
- T2CodeTemplate.onLoadFooter(prefix, long_);
- }
-}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Metrics.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Metrics.java
deleted file mode 100644
index 06c1fbe..0000000
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Metrics.java
+++ /dev/null
@@ -1,850 +0,0 @@
-// This claas was created by JaTiTV
-
-
-package de.jatitv.commandguiv2.Spigot.system;
-
-import de.jatitv.commandguiv2.Spigot.Main;
-import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import javax.net.ssl.HttpsURLConnection;
-import java.io.*;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-import java.util.logging.Level;
-import java.util.stream.Collectors;
-import java.util.zip.GZIPOutputStream;
-
-public class Metrics {
-
- public static void Bstats() {
- int pluginId = Main.bstatsID; // <-- Replace with the id of your plugin!
- Metrics metrics = new Metrics(Main.plugin, pluginId);
- metrics.addCustomChart(new Metrics.SimplePie("updatecheckonjoin", () -> String.valueOf(SelectConfig.UpdateCheckOnJoin)));
- metrics.addCustomChart(new Metrics.SimplePie("storage_type_mysql", () -> SelectConfig.Storage));
- }
-
- private final Plugin plugin;
-
- private final MetricsBase metricsBase;
-
- /**
- * Creates a new Metrics instance.
- *
- * @param plugin Your plugin instance.
- * @param serviceId The id of the service. It can be found at What is my plugin id?
- */
- public Metrics(JavaPlugin plugin, int serviceId) {
- this.plugin = plugin;
- // Get the config file
- File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
- File configFile = new File(bStatsFolder, "config.yml");
- YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
- if (!config.isSet("serverUuid")) {
- config.addDefault("enabled", true);
- config.addDefault("serverUuid", UUID.randomUUID().toString());
- config.addDefault("logFailedRequests", false);
- config.addDefault("logSentData", false);
- config.addDefault("logResponseStatusText", false);
- // Inform the server owners about bStats
- config
- .options()
- .header(
- "bStats (https://bStats.org) collects some basic information for plugin authors, like how\n"
- + "many people use their plugin and their total player count. It's recommended to keep bStats\n"
- + "enabled, but if you're not comfortable with this, you can turn this setting off. There is no\n"
- + "performance penalty associated with having metrics enabled, and data sent to bStats is fully\n"
- + "anonymous.")
- .copyDefaults(true);
- try {
- config.save(configFile);
- } catch (IOException ignored) {
- }
- }
- // Load the data
- boolean enabled = config.getBoolean("enabled", true);
- String serverUUID = config.getString("serverUuid");
- boolean logErrors = config.getBoolean("logFailedRequests", false);
- boolean logSentData = config.getBoolean("logSentData", false);
- boolean logResponseStatusText = config.getBoolean("logResponseStatusText", false);
- metricsBase =
- new MetricsBase(
- "bukkit",
- serverUUID,
- serviceId,
- enabled,
- this::appendPlatformData,
- this::appendServiceData,
- submitDataTask -> Bukkit.getScheduler().runTask(plugin, submitDataTask),
- plugin::isEnabled,
- (message, error) -> this.plugin.getLogger().log(Level.WARNING, message, error),
- (message) -> this.plugin.getLogger().log(Level.INFO, message),
- logErrors,
- logSentData,
- logResponseStatusText);
- }
-
- /**
- * Adds a custom chart.
- *
- * @param chart The chart to add.
- */
- public void addCustomChart(CustomChart chart) {
- metricsBase.addCustomChart(chart);
- }
-
- private void appendPlatformData(JsonObjectBuilder builder) {
- builder.appendField("playerAmount", getPlayerAmount());
- builder.appendField("onlineMode", Bukkit.getOnlineMode() ? 1 : 0);
- builder.appendField("bukkitVersion", Bukkit.getVersion());
- builder.appendField("bukkitName", Bukkit.getName());
- builder.appendField("javaVersion", System.getProperty("java.version"));
- builder.appendField("osName", System.getProperty("os.name"));
- builder.appendField("osArch", System.getProperty("os.arch"));
- builder.appendField("osVersion", System.getProperty("os.version"));
- builder.appendField("coreCount", Runtime.getRuntime().availableProcessors());
- }
-
- private void appendServiceData(JsonObjectBuilder builder) {
- builder.appendField("pluginVersion", plugin.getDescription().getVersion());
- }
-
- private int getPlayerAmount() {
- try {
- // Around MC 1.8 the return type was changed from an array to a collection,
- // This fixes java.lang.NoSuchMethodError:
- // org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
- Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
- return onlinePlayersMethod.getReturnType().equals(Collection.class)
- ? ((Collection>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
- : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
- } catch (Exception e) {
- // Just use the new method if the reflection failed
- return Bukkit.getOnlinePlayers().size();
- }
- }
-
- public static class MetricsBase {
-
- /** The version of the Metrics class. */
- public static final String METRICS_VERSION = "2.2.1";
-
- private static final ScheduledExecutorService scheduler =
- Executors.newScheduledThreadPool(1, task -> new Thread(task, "bStats-Metrics"));
-
- private static final String REPORT_URL = "https://bStats.org/api/v2/data/%s";
-
- private final String platform;
-
- private final String serverUuid;
-
- private final int serviceId;
-
- private final Consumer appendPlatformDataConsumer;
-
- private final Consumer appendServiceDataConsumer;
-
- private final Consumer submitTaskConsumer;
-
- private final Supplier checkServiceEnabledSupplier;
-
- private final BiConsumer errorLogger;
-
- private final Consumer infoLogger;
-
- private final boolean logErrors;
-
- private final boolean logSentData;
-
- private final boolean logResponseStatusText;
-
- private final Set customCharts = new HashSet<>();
-
- private final boolean enabled;
-
- /**
- * Creates a new MetricsBase class instance.
- *
- * @param platform The platform of the service.
- * @param serviceId The id of the service.
- * @param serverUuid The server uuid.
- * @param enabled Whether or not data sending is enabled.
- * @param appendPlatformDataConsumer A consumer that receives a {@code JsonObjectBuilder} and
- * appends all platform-specific data.
- * @param appendServiceDataConsumer A consumer that receives a {@code JsonObjectBuilder} and
- * appends all service-specific data.
- * @param submitTaskConsumer A consumer that takes a runnable with the submit task. This can be
- * used to delegate the data collection to a another thread to prevent errors caused by
- * concurrency. Can be {@code null}.
- * @param checkServiceEnabledSupplier A supplier to check if the service is still enabled.
- * @param errorLogger A consumer that accepts log message and an error.
- * @param infoLogger A consumer that accepts info log messages.
- * @param logErrors Whether or not errors should be logged.
- * @param logSentData Whether or not the sent data should be logged.
- * @param logResponseStatusText Whether or not the response status text should be logged.
- */
- public MetricsBase(
- String platform,
- String serverUuid,
- int serviceId,
- boolean enabled,
- Consumer appendPlatformDataConsumer,
- Consumer appendServiceDataConsumer,
- Consumer submitTaskConsumer,
- Supplier checkServiceEnabledSupplier,
- BiConsumer errorLogger,
- Consumer infoLogger,
- boolean logErrors,
- boolean logSentData,
- boolean logResponseStatusText) {
- this.platform = platform;
- this.serverUuid = serverUuid;
- this.serviceId = serviceId;
- this.enabled = enabled;
- this.appendPlatformDataConsumer = appendPlatformDataConsumer;
- this.appendServiceDataConsumer = appendServiceDataConsumer;
- this.submitTaskConsumer = submitTaskConsumer;
- this.checkServiceEnabledSupplier = checkServiceEnabledSupplier;
- this.errorLogger = errorLogger;
- this.infoLogger = infoLogger;
- this.logErrors = logErrors;
- this.logSentData = logSentData;
- this.logResponseStatusText = logResponseStatusText;
- checkRelocation();
- if (enabled) {
- startSubmitting();
- }
- }
-
- public void addCustomChart(CustomChart chart) {
- this.customCharts.add(chart);
- }
-
- private void startSubmitting() {
- final Runnable submitTask =
- () -> {
- if (!enabled || !checkServiceEnabledSupplier.get()) {
- // Submitting data or service is disabled
- scheduler.shutdown();
- return;
- }
- if (submitTaskConsumer != null) {
- submitTaskConsumer.accept(this::submitData);
- } else {
- this.submitData();
- }
- };
- // Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution
- // of requests on the
- // bStats backend. To circumvent this problem, we introduce some randomness into the initial
- // and second delay.
- // WARNING: You must not modify and part of this Metrics class, including the submit delay or
- // frequency!
- // WARNING: Modifying this code will get your plugin banned on bStats. Just don't do it!
- long initialDelay = (long) (1000 * 60 * (3 + Math.random() * 3));
- long secondDelay = (long) (1000 * 60 * (Math.random() * 30));
- scheduler.schedule(submitTask, initialDelay, TimeUnit.MILLISECONDS);
- scheduler.scheduleAtFixedRate(
- submitTask, initialDelay + secondDelay, 1000 * 60 * 30, TimeUnit.MILLISECONDS);
- }
-
- private void submitData() {
- final JsonObjectBuilder baseJsonBuilder = new JsonObjectBuilder();
- appendPlatformDataConsumer.accept(baseJsonBuilder);
- final JsonObjectBuilder serviceJsonBuilder = new JsonObjectBuilder();
- appendServiceDataConsumer.accept(serviceJsonBuilder);
- JsonObjectBuilder.JsonObject[] chartData =
- customCharts.stream()
- .map(customChart -> customChart.getRequestJsonObject(errorLogger, logErrors))
- .filter(Objects::nonNull)
- .toArray(JsonObjectBuilder.JsonObject[]::new);
- serviceJsonBuilder.appendField("id", serviceId);
- serviceJsonBuilder.appendField("customCharts", chartData);
- baseJsonBuilder.appendField("service", serviceJsonBuilder.build());
- baseJsonBuilder.appendField("serverUUID", serverUuid);
- baseJsonBuilder.appendField("metricsVersion", METRICS_VERSION);
- JsonObjectBuilder.JsonObject data = baseJsonBuilder.build();
- scheduler.execute(
- () -> {
- try {
- // Send the data
- sendData(data);
- } catch (Exception e) {
- // Something went wrong! :(
- if (logErrors) {
- errorLogger.accept("Could not submit bStats metrics data", e);
- }
- }
- });
- }
-
- private void sendData(JsonObjectBuilder.JsonObject data) throws Exception {
- if (logSentData) {
- infoLogger.accept("Sent bStats metrics data: " + data.toString());
- }
- String url = String.format(REPORT_URL, platform);
- HttpsURLConnection connection = (HttpsURLConnection) new URL(url).openConnection();
- // Compress the data to save bandwidth
- byte[] compressedData = compress(data.toString());
- connection.setRequestMethod("POST");
- connection.addRequestProperty("Accept", "application/json");
- connection.addRequestProperty("Connection", "close");
- connection.addRequestProperty("Content-Encoding", "gzip");
- connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
- connection.setRequestProperty("Content-Type", "application/json");
- connection.setRequestProperty("User-Agent", "Metrics-Service/1");
- connection.setDoOutput(true);
- try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
- outputStream.write(compressedData);
- }
- StringBuilder builder = new StringBuilder();
- try (BufferedReader bufferedReader =
- new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
- String line;
- while ((line = bufferedReader.readLine()) != null) {
- builder.append(line);
- }
- }
- if (logResponseStatusText) {
- infoLogger.accept("Sent data to bStats and received response: " + builder);
- }
- }
-
- /** Checks that the class was properly relocated. */
- private void checkRelocation() {
- // You can use the property to disable the check in your test environment
- if (System.getProperty("bstats.relocatecheck") == null
- || !System.getProperty("bstats.relocatecheck").equals("false")) {
- // Maven's Relocate is clever and changes strings, too. So we have to use this little
- // "trick" ... :D
- final String defaultPackage =
- new String(new byte[] {'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's'});
- final String examplePackage =
- new String(new byte[] {'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
- // We want to make sure no one just copy & pastes the example and uses the wrong package
- // names
- if (MetricsBase.class.getPackage().getName().startsWith(defaultPackage)
- || MetricsBase.class.getPackage().getName().startsWith(examplePackage)) {
- throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
- }
- }
- }
-
- /**
- * Gzips the given string.
- *
- * @param str The string to gzip.
- * @return The gzipped string.
- */
- private static byte[] compress(final String str) throws IOException {
- if (str == null) {
- return null;
- }
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- try (GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) {
- gzip.write(str.getBytes(StandardCharsets.UTF_8));
- }
- return outputStream.toByteArray();
- }
- }
-
- public static class AdvancedBarChart extends CustomChart {
-
- private final Callable