Compare commits

...

29 Commits
2.7.2 ... main

Author SHA1 Message Date
JaTiTV 2f114cca41 Update guiDeclaration.yml 2 days ago
JaTiTV d0277deeb8 Update guiDeclaration.yml 2 days ago
JaTiTV a6dff7e243 2.8.4 | Minor code changes 3 days ago
JaTiTV e2e649aef2 Revert "„README.md“ ändern" 3 weeks ago
JaTiTV 7c7cd51cec „README.md“ ändern 3 weeks ago
JaTiTV e7f5b00b31 Bugfix 3 weeks ago
JaTiTV 57ba6e6687 add new defaultconfigs 3 weeks ago
JaTiTV d168a7afec fix 3 weeks ago
JaTiTV 92d3e9a2d8 files with explanations 3 weeks ago
JaTiTV b45895dff8 Update Util.java 3 weeks ago
JaTiTV c43a5fd90c 2.8.2 3 weeks ago
JaTiTV 48c06696ef 2.8.1 3 weeks ago
JaTiTV 16123ec578 2.8.1 3 weeks ago
JaTiTV 7f2b346f7b Merge pull request '2.8.0-Voting' (#12) from 2.8.0-Voting into main 3 weeks ago
JaTiTV c590255d38 Update pom.xml 3 weeks ago
JaTiTV 5d646fce48 2.8.0 | VotePoints for payment, Items for payment and other new features 3 weeks ago
JaTiTV 5b089a57d8 rename folder 3 weeks ago
JaTiTV 87d0f75a4c Merge branch 'main' of https://git.t2code.net/JaTiTV/CommandGUI 4 weeks ago
JaTiTV 6f3da3e3f4 2.7.7 4 weeks ago
JaTiTV 80255a60eb Merge pull request 'mysql-crash' (#11) from mysql-crash into main 4 weeks ago
JaTiTV f6860e9ab5 2.7.6 4 weeks ago
JaTiTV ebbec1f660 2.7.6_DEV 4 weeks ago
JaTiTV 5674b54593 Merge pull request '2.7.5' (#10) from 2.7.5 into main 4 weeks ago
JaTiTV 381afeba89 2.7.5 4 weeks ago
JaTiTV 19822f7024 2.7.4 | MySQL Bugfix 1 month ago
JaTiTV ed810f31d7 Update pom.xml 1 month ago
JaTiTV b0286e597f Merge branch 'main' of https://git.t2code.net/JaTiTV/CommandGUI 1 month ago
JaTiTV ddfea4eba6 2.7.3 1 month ago
JaTiTV ed86e7b143 „README.md“ ändern 1 month ago
  1. 52
      CommandGUI V2/pom.xml
  2. 40
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BConfig.java
  3. 1
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BListener.java
  4. 40
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BMain.java
  5. 7
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BMetrics.java
  6. 107
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BMySQL.java
  7. 277
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java
  8. 79
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/PluginEvent.java
  9. 67
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Main.java
  10. 39
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java
  11. 10
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUIItem.java
  12. 80
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java
  13. 115
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Help.java
  14. 4
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/AliasRegister.java
  15. 5
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/register/RegisterCommand.java
  16. 89
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/ConfigCreate.java
  17. 586
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/SelectConfig.java
  18. 9
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/configConverter/ConfigConverterUnderV5.java
  19. 51
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/functions/CreateFunctions.java
  20. 5
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/gui/CreateGUI.java
  21. 72
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/languages/LanguagesCreate.java
  22. 79
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/languages/MSG.java
  23. 68
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/languages/SelectMessages.java
  24. 74
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/database/MySQL.java
  25. 2
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/database/SQLITE.java
  26. 49
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/database/SelectDatabase.java
  27. 4
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/database/YML.java
  28. 7
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/enums/EcoEnum.java
  29. 6
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/enums/FunctionItemEnum.java
  30. 5
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/enums/FunctionVoteEnum.java
  31. 10
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/enums/SoundEnum.java
  32. 7
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/enums/StorageEnum.java
  33. 361
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/GUIListener.java
  34. 32
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/GuiBuilder.java
  35. 93
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java
  36. 2
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/listener/Bungee_Sender_Reciver.java
  37. 23
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/listener/PluginEvent.java
  38. 3
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/listener/ServerChange.java
  39. 160
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java
  40. 36
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/functions/Function.java
  41. 60
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/sound/Sound.java
  42. 93
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Debug.java
  43. 89
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java
  44. 4
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Metrics.java
  45. 51
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Papi.java
  46. 62
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Placeholder.java
  47. 7
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/database/StorageType.java
  48. 154
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/useItem/Events.java
  49. 16
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/useItem/EventsFrom110.java
  50. 41
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/useItem/ItemChange.java
  51. 74
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/useItem/UseItem.java
  52. 9
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Util.java
  53. 13
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/api/CGuiAPI.java
  54. 158
      CommandGUI V2/src/main/resources/Functions/functionDeclaration.yml
  55. 51
      CommandGUI V2/src/main/resources/GUIs/guiDeclaration.yml
  56. 313
      CommandGUI V2/src/main/resources/configDeclaration.yml
  57. 58
      CommandGUI V2/src/main/resources/plugin.yml
  58. 11
      Defaultconfig/Functions/SupportDiscord.yml
  59. 11
      Defaultconfig/Functions/UseItem.yml
  60. 158
      Defaultconfig/Functions/functionDeclaration.yml
  61. 8
      Defaultconfig/GUIs/default.yml
  62. 51
      Defaultconfig/GUIs/guiDeclaration.yml
  63. BIN
      Defaultconfig/Storage/data.db
  64. 158
      Defaultconfig/config.yml
  65. 313
      Defaultconfig/configDeclaration.yml
  66. 37
      Defaultconfig/languages/english_messages.yml
  67. 38
      Defaultconfig/languages/german_messages.yml
  68. 34
      Defaultconfig/languages/norwegian_messages.yml
  69. 1
      README.md

52
CommandGUI V2/pom.xml

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId>
<version>2.7.2</version>
<version>2.8.4</version>
<packaging>jar</packaging>
<name>CommandGUI</name>
@ -53,10 +53,7 @@ @@ -53,10 +53,7 @@
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<!-- repo.t2code / T2Code -->
<repository>
<id>Builders-Paradise</id>
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
@ -65,6 +62,7 @@ @@ -65,6 +62,7 @@
<id>T2Code</id>
<url>https://repo.t2code.net/repository/T2Code/</url>
</repository>
<!-- placeholderAPI -->
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
@ -72,11 +70,27 @@ @@ -72,11 +70,27 @@
</repositories>
<dependencies>
<!-- repo.t2code / T2Code -->
<dependency>
<groupId>net.t2code</groupId>
<artifactId>bungee</artifactId>
<version>1615</version>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_16.r2</groupId>
<artifactId>spigot</artifactId>
<version>1.16r2</version>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_10.r1</groupId>
<artifactId>spigot</artifactId>
<version>1.10r1</version>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_8.r1</groupId>
<artifactId>spigot</artifactId>
<version>1.8r1</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>PlugmanGUI</artifactId>
@ -85,28 +99,21 @@ @@ -85,28 +99,21 @@
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>11.6</version>
<version>12.1</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>LuckyBox-API</artifactId>
<version>4.2.2</version>
</dependency>
<!-- placeholderAPI -->
<dependency>
<groupId>net.t2code.minecraft.1_16.r2</groupId>
<artifactId>spigot</artifactId>
<version>1.16r2</version>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_10.r1</groupId>
<artifactId>spigot</artifactId>
<version>1.10r1</version>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_8.r1</groupId>
<artifactId>spigot</artifactId>
<version>1.8r1</version>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
@ -122,11 +129,6 @@ @@ -122,11 +129,6 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.22</version>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

40
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BConfig.java

@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
package de.jatitv.commandguiv2.Bungee;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import java.io.File;
import java.io.IOException;
public class BConfig {
public static void create() throws IOException {
File config = new File(BMain.plugin.getDataFolder(), "config.yml");
if (!BMain.plugin.getDataFolder().exists()) BMain.plugin.getDataFolder().mkdir();
if (!config.exists()) {
config.createNewFile();
}
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
configuration.set("MySQL.Enable", false);
configuration.set("MySQL.IP", "localhost");
configuration.set("MySQL.Port", 3306);
configuration.set("MySQL.Database", "database");
configuration.set("MySQL.User", "user");
configuration.set("MySQL.Password", "");
configuration.set("MySQL.SSL", false);
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config);
BMySQL.Enable = configuration.getBoolean("MySQL.Enable");
BMySQL.ip = configuration.getString("MySQL.IP");
BMySQL.port = configuration.getInt("MySQL.Port");
BMySQL.database = configuration.getString("MySQL.Database");
BMySQL.user = configuration.getString("MySQL.User");
BMySQL.password = configuration.getString("MySQL.Password");
BMySQL.SSL = configuration.getBoolean("MySQL.SSL");
}
}

1
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BListener.java

@ -8,7 +8,6 @@ import net.md_5.bungee.api.event.PluginMessageEvent; @@ -8,7 +8,6 @@ import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import net.t2code.lib.Bungee.Lib.messages.Bsend;
import java.io.*;
import java.util.logging.Logger;

40
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BMain.java

@ -5,7 +5,6 @@ import net.md_5.bungee.api.ProxyServer; @@ -5,7 +5,6 @@ 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.util.logging.Level;
public final class BMain extends Plugin {
@ -42,31 +41,11 @@ public final class BMain extends Plugin { @@ -42,31 +41,11 @@ public final class BMain extends Plugin {
Bsend.console(prefix + " §2Version: §6" + version);
Bsend.console(prefix + " §2Spigot: §6" + spigot);
Bsend.console(prefix + " §2Discord: §6" + discord);
/* try {
BConfig.create();
} catch (IOException e) {
e.printStackTrace();
}
*/
plugin.getProxy().registerChannel("cgui:bungee");
plugin.getProxy().getPluginManager().registerListener(plugin, new BListener());
BListener.sendToSpigotDeleteAll();
BMetrics metrics = new BMetrics(this, bstatsID);
/*
if (BMySQL.Enable){
BMySQL.main();
BMySQL.query("CREATE TABLE IF NOT EXISTS `gui-bungeeplayer` (" +
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
" `Name` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
" `Online` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
" UNIQUE INDEX `UUID` (`UUID`)" +
")" +
"COLLATE='utf8mb4_general_ci'" +
"ENGINE=InnoDB" +
";");
}
*/
BMetrics.Bstats();
Bsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
Bsend.console(prefix + "§4==============================================================================");
@ -90,7 +69,7 @@ public final class BMain extends Plugin { @@ -90,7 +69,7 @@ public final class BMain extends Plugin {
Bsend.console(prefix + "§4==============================================================================");
}
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
if (ProxyServer.getInstance().getPluginManager().getPlugin(pl) == null) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
@ -99,10 +78,19 @@ public final class BMain extends Plugin { @@ -99,10 +78,19 @@ public final class BMain extends Plugin {
BMain.plugin.onDisable();
return true;
} else {
if (Double.parseDouble(ProxyServer.getInstance().getPluginManager().getPlugin(pl).getDescription().getVersion()) < ver) {
String plVer = ProxyServer.getInstance().getPluginManager().getPlugin(pl).getDescription().getVersion();
if (ver.contains("_")) {
if (!plVer.equals(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2" + ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
return true;
}
return false;
}
String[] split = plVer.split("_");
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
ProxyServer.getInstance().getConsole().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() + ".");
// BMain.plugin.getPluginLoader().disablePlugin(BMain.plugin);
BMain.plugin.onDisable();
return true;
}

7
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BMetrics.java

@ -27,6 +27,8 @@ import java.util.logging.Level; @@ -27,6 +27,8 @@ import java.util.logging.Level;
import java.util.stream.Collectors;
import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HttpsURLConnection;
import de.jatitv.commandguiv2.Util;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
@ -34,6 +36,11 @@ import net.md_5.bungee.config.YamlConfiguration; @@ -34,6 +36,11 @@ import net.md_5.bungee.config.YamlConfiguration;
public class BMetrics {
public static void Bstats() {
int pluginId = Util.getBstatsID(); // <-- Replace with the id of your plugin!
BMetrics metrics = new BMetrics(BMain.plugin, pluginId);
}
private final Plugin plugin;
private final MetricsBase metricsBase;

107
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Bungee/BMySQL.java

@ -1,107 +0,0 @@ @@ -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<String> selectAll(String query) {
ArrayList<String> 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;
}
}

277
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java

@ -1,277 +0,0 @@ @@ -1,277 +0,0 @@
package de.jatitv.commandguiv2.Spigot.Listener;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.system.Bungee_Sender_Reciver;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.Main;
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.replace.Replace;
import net.t2code.lib.Spigot.Lib.vault.Vault;
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.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
import java.io.IOException;
public class GUIListener implements Listener {
private static String prefix = Util.getPrefix();
public static String GUICode;
private static Plugin plugin = Main.plugin;
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
Player player = (Player) e.getWhoClicked();
JavaPlugin plugin = Main.plugin;
if (e.getInventory() == null) return;
if (e.getCurrentItem() == null) return;
for (Gui gui : Main.guiHashMap.values()) {
if (player.getOpenInventory().getTitle().equals(Replace.replace(prefix, GUICode + gui.guiName))
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(Replace.replace(prefix, player, GUICode + gui.guiName)))) {
e.setCancelled(true);
for (Slot slot : gui.slots) {
Function function = Main.functionHashMap.get(slot.function);
if (e.getSlot() != slot.slot) continue;
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name))
.replace("[perm]", slot.permissionToUse));
continue;
}
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == ItemVersion.getGreenWool().getType() ||
e.getCurrentItem().getType() == ItemVersion.getRedWool().getType() ||
e.getCurrentItem().getType() == Material.valueOf(function.item.toUpperCase().replace(".", "_"))) {
if (!slot.enable) continue;
if (function.cost_Enable) {
if (function.command_Enable || function.message_Enable || function.openGUI_Enable || function.serverChange) {
if (!Vault.buy(prefix, player, function.price)) {
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 {
player.sendMessage(SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
.replace("[price]", function.price + " " + SelectConfig.Currency));
execute(function, slot, player, e, gui);
}
}
} else {
execute(function, slot, player, e, gui);
}
}
}
}
}
}
private static void execute(Function function, Slot slot, Player player, InventoryClickEvent e, Gui gui) {
if (function.togglePermission) togglePerm(function, gui, player);
if (function.toggleUseItem) toggleUseItem(player, gui);
if (function.command_Enable) command(function, player);
if (function.openGUI_Enable) openGUI(function, player);
if (function.message_Enable) message(function, player);
if (function.serverChange) serverChange(function, player);
if (function.setConfigEnable) setConfig(function, player, e);
if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) sound(function, slot, player, gui);
}
private static void command(Function slot, Player player) {
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, cmd.replace("[player]", player.getName()), slot.commandAsConsole);
}
} 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 {
for (String cmd : slot.command) {
if (slot.commandAsConsole) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
} else player.chat("/" + cmd.replace("[player]", player.getName()));
}
}
}
}.runTaskLater(plugin, 2L);
}
private static void openGUI(Function slot, Player player) {
player.closeInventory();
new BukkitRunnable() {
@Override
public void run() {
OpenGUI.openGUI(player, slot.openGUI, true);
}
}.runTaskLater(plugin, 1L);
}
private static void message(Function slot, Player player) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
for (String msg : slot.message) {
if (Main.PaPi) {
if (slot.cost_Enable) {
player.sendMessage(Replace.replacePrice(prefix, player, msg, slot.price + " " + SelectConfig.Currency));
} else player.sendMessage(Replace.replace(prefix, player, msg.replace("[prefix]", prefix)));
} else {
if (slot.cost_Enable) {
player.sendMessage(Replace.replacePrice(prefix, msg, slot.price + " " + SelectConfig.Currency));
} else player.sendMessage(Replace.replace(prefix, msg.replace("[prefix]", prefix)));
}
}
}
private static void serverChange(Function slot, Player player) {
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);
}
private static void setConfig(Function slot, Player player, InventoryClickEvent e) {
File config = new File(slot.configFilePath);
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (e.getClick() == ClickType.LEFT) {
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.getClick() == ClickType.RIGHT) {
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);
}
private static void sound(Function function, Slot slot, Player player, Gui gui) {
if (function.customSound_Enable) {
if (!function.customSound_NoSound) {
try {
player.playSound(player.getLocation(), Sound.valueOf(function.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.guiName) + "§r §6Slot: §e" + slot.slot + " §6CustomSound: §9" + function.customSound_Sound));
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
}
}
} else player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
}
private static void togglePerm(Function function, Gui gui, Player player) {
if (player.hasPermission(function.togglePermissionPerm)) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.togglePermFalse.replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
OpenGUI.openGUI(player, gui.key, false);
}
}.runTaskLater(plugin, 4L);
} else
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.togglePermTrue.replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
OpenGUI.openGUI(player, gui.key, false);
}
}.runTaskLater(plugin, 4L);
}
private static void toggleUseItem(Player player, Gui gui) {
if (Events.useItemHashMap.get(player.getName())) {
Commands.itemOff(player);
} else {
Commands.itemOn(player);
}
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
OpenGUI.openGUI(player, gui.key, false);
}
}.runTaskLater(plugin, 2L);
}
}

79
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/PluginEvent.java

@ -1,79 +0,0 @@ @@ -1,79 +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.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import de.jatitv.commandguiv2.Util;
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();
SelectDatabase.nameCheck(player);
UpdateAPI.join(Main.plugin,prefix, "commandgui.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord());
}
@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, false);
}
}

67
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Main.java

@ -4,10 +4,12 @@ package de.jatitv.commandguiv2.Spigot; @@ -4,10 +4,12 @@ package de.jatitv.commandguiv2.Spigot;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.system.Load;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
import de.jatitv.commandguiv2.Spigot.database.MySQL;
import de.jatitv.commandguiv2.Util;
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.minecraftVersion.NMSVersion;
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
@ -16,7 +18,6 @@ import org.bukkit.plugin.java.JavaPlugin; @@ -16,7 +18,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public final class Main extends JavaPlugin {
@ -27,17 +28,14 @@ public final class Main extends JavaPlugin { @@ -27,17 +28,14 @@ public final class Main extends JavaPlugin {
}
private static Boolean enable = false;
public static String prefix = "§8[§4C§9GUI§8]";
public static Boolean legacy = false;
public static String version;
public static List<String> autor;
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 LuckyBox = false;
@ -50,31 +48,33 @@ public final class Main extends JavaPlugin { @@ -50,31 +48,33 @@ public final class Main extends JavaPlugin {
@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 (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15 || NMSVersion.v1_16_R1) {
legacy = true;
}
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
if (PluginCheck.papi()) {
PaPi = true;
}
Load.onLoad(prefix, autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
enable = true;
}
public static void addonLoad() {
if (PluginCheck.plotSquaredGUI()) {
PlotSquaredGUI = true;
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
}if (PluginCheck.luckyBox()) {
}
if (PluginCheck.luckyBox()) {
LuckyBox = true;
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
}
if (PluginCheck.plugManGUI()) {
PlugManGUI = true;
addonEnable(Bukkit.getPluginManager().getPlugin("PlugManGUI"));
@ -82,30 +82,35 @@ public final class Main extends JavaPlugin { @@ -82,30 +82,35 @@ public final class Main extends JavaPlugin {
}
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;
send.console(Util.getPrefix() + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
}
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
public static Boolean pluginNotFound(String pl, Integer spigotID, String 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.");
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §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) {
String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
if (ver.contains("_")) {
if (!plVer.equals(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
+ ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
+ pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
return true;
}
return false;
}
String[] split = plVer.split("_");
if (Double.parseDouble(split[0]) < Double.parseDouble(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() + ".");
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §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;
}
@ -113,10 +118,14 @@ public final class Main extends JavaPlugin { @@ -113,10 +118,14 @@ public final class Main extends JavaPlugin {
}
}
public static void sendTryCatch(Class c, StackTraceElement line) {
send.error(plugin, c.getName() + " Line: " + line.getLineNumber());
}
@Override
public void onDisable() {
// Plugin shutdown logic
if (enable) T2CodeTemplate.onDisable(prefix, autor, version, Util.getSpigot(), Util.getDiscord());
if (enable) T2CodeTemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
MySQL.close();
}
}

39
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUITab.java → CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUI.java

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.system.Debug;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Util;
@ -17,7 +17,7 @@ import java.util.ArrayList; @@ -17,7 +17,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
private static String prefix = Util.getPrefix();
@Override
@ -30,7 +30,7 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter { @@ -30,7 +30,7 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
Player player = (Player) sender;
Commands.gui(player);
} else {
if (args[0].equals("admin")) {
if (args[0].equals(SelectConfig.getAdminSubCommand())) {
if (args.length == 1) {
Help.sendHelp(sender, prefix);
return false;
@ -61,24 +61,6 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter { @@ -61,24 +61,6 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
} 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")) {
@ -124,7 +106,7 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter { @@ -124,7 +106,7 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
List<String> list = new ArrayList<>();
Tab.tab(list, sender, 0, args, arg1);
Tab.tab(list, sender, 0, "admin", 1, args, arg2);
Tab.tab(list, sender, 0, SelectConfig.getAdminSubCommand(), 1, args, arg2);
Tab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
// if (args.length == 1) {
@ -154,18 +136,5 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter { @@ -154,18 +136,5 @@ public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
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;
}
}

10
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/CmdExecuter_GUIItem.java

@ -22,13 +22,13 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter { @@ -22,13 +22,13 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
Player player = (Player) sender;
if (sender.hasPermission("commandgui.useitem.toggle")) {
if (args.length == 0) {
if (SelectConfig.UseItem_AllowToggle) {
Help.sendGUIItemHelp(sender, prefix);
if (SelectConfig.getUseItem_AllowToggle()) {
Help.sendGUIItemHelp(sender);
} else send.sender(sender, "§4UseItem toggle is disabled!");// todo
} else {
if (args.length == 1 || args.length == 2) {
if (sender instanceof Player) {
if (SelectConfig.UseItem_AllowToggle) {
if (SelectConfig.getUseItem_AllowToggle()) {
switch (args[0].toLowerCase()) {
case "on":
Commands.itemOn(player);
@ -65,7 +65,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter { @@ -65,7 +65,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
put("on", "commandgui.useitem.toggle");
put("off", "commandgui.useitem.toggle");
if (SelectConfig.UseItem_AllowSetSlot) {
if (SelectConfig.getUseItem_AllowSetSlot()) {
put("slot", "commandgui.useitem.toggle");
}
}};
@ -74,7 +74,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter { @@ -74,7 +74,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
List<String> list = new ArrayList<>();
if (sender instanceof Player) {
if (SelectConfig.UseItem_AllowToggle) {
if (SelectConfig.getUseItem_AllowToggle()) {
Player p = (Player) sender;
if (args.length == 1) {
for (String command : arg1.keySet()) {

80
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java

@ -1,27 +1,25 @@ @@ -1,27 +1,25 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.system.UseItem;
import de.jatitv.commandguiv2.Spigot.config.config.ConfigCreate;
import de.jatitv.commandguiv2.Spigot.useItem.UseItem;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.LanguagesCreate;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.sound.Sound;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
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.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 java.util.Objects;
@ -62,15 +60,15 @@ public class Commands { @@ -62,15 +60,15 @@ public class Commands {
send.console(Util.getPrefix() + "§8-------------------------------");
send.console(Util.getPrefix() + " §6Plugin reload...");
send.console(Util.getPrefix() + "§8-------------------------------");
CmdExecuter_GUITab.arg1.clear();
CmdExecuter_GUITab.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
SelectConfig.onSelect();
Main.plugin.reloadConfig();
if (!Objects.equals(SelectDatabase.getStorage().toString(), SelectConfig.storage)) {
CmdExecuter_GUI.arg1.clear();
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
if (!Objects.equals(SelectDatabase.getStorage().toString(), SelectConfig.getStorage())) {
if (sender instanceof Player) send.sender(sender, "You have changed the storage medium! To apply this change, you must restart the server!");
send.console("You have changed the storage medium! To apply this change, you must restart the server!");
send.warning(Main.plugin, "You have changed the storage medium! To apply this change, you must restart the server!");
}
LanguagesCreate.langCreate();
@ -90,7 +88,7 @@ public class Commands { @@ -90,7 +88,7 @@ public class Commands {
e.printStackTrace();
}
if (SelectConfig.Bungee) {
if (SelectConfig.getBungee()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "commandgui:bungee");
}
@ -104,31 +102,22 @@ public class Commands { @@ -104,31 +102,22 @@ public class Commands {
public static void give(CommandSender sender, Player target) {
if (Bukkit.getPlayer(target.getName()) != null) {
UseItem.giveUseItem(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);
}
send.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
send.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
Sound.play(target, SoundEnum.Give);
} 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);
}
if (sender instanceof Player) Sound.play((Player) sender, SoundEnum.PlayerNotFound);
}
}
public static void itemOn(Player player) {
UseItem.removeItem(player);
Integer slot = null;
if (SelectConfig.UseItem_InventorySlotEnforce) {
slot = SelectConfig.UseItem_InventorySlot;
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
slot = SelectConfig.getUseItem_InventorySlot();
} else {
if (Events.useItemSlotHashMap.get(player.getName()) == null) {
slot = SelectConfig.UseItem_InventorySlot;
} else {
slot = Events.useItemSlotHashMap.get(player.getName());
}
slot = Events.useItemSlotHashMap.get(player.getName());
}
send.debug(Main.plugin, String.valueOf(slot));
if (player.getInventory().getItem(slot - 1) == null) {
@ -147,10 +136,8 @@ public class Commands { @@ -147,10 +136,8 @@ public class Commands {