2.8.4 | Minor code changes

In this update minor code changes were made to better structure the interaction with T2CodeLib
This commit is contained in:
JaTiTV 2022-06-28 08:25:23 +02:00
parent e2e649aef2
commit a6dff7e243
8 changed files with 64 additions and 76 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId>
<version>2.8.3</version>
<version>2.8.4</version>
<packaging>jar</packaging>
<name>CommandGUI</name>
@ -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 @@
<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,26 +70,12 @@
</repositories>
<dependencies>
<!-- repo.t2code / T2Code -->
<dependency>
<groupId>net.t2code</groupId>
<artifactId>bungee</artifactId>
<version>1615</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>PlugmanGUI</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>12.1</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>LuckyBox-API</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_16.r2</groupId>
<artifactId>spigot</artifactId>
@ -107,6 +91,29 @@
<artifactId>spigot</artifactId>
<version>1.8r1</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>PlugmanGUI</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>12.1</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>LuckyBox-API</artifactId>
<version>4.2.2</version>
</dependency>
<!-- placeholderAPI -->
<dependency>
<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 @@
<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>

View File

@ -1,8 +1,5 @@
package de.jatitv.commandguiv2.Bungee;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.Obj_Select;
import de.jatitv.commandguiv2.Util;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -35,7 +32,6 @@ public class BListener implements Listener {
}
}
} catch (IOException e) {
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
e.printStackTrace();
}
}

View File

@ -69,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: " +
@ -78,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;
}

View File

@ -85,27 +85,32 @@ public final class Main extends JavaPlugin {
send.console(Util.getPrefix() + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
}
public static Boolean pluginNotFound(String pl, Integer spigotID) {
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(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 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(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.");
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 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 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(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;
}

View File

@ -136,18 +136,5 @@ public class CmdExecuter_GUI 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;
}
}

View File

@ -1,5 +1,6 @@
package de.jatitv.commandguiv2.Spigot.gui;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
@ -66,7 +67,7 @@ public class OpenGUI {
if (MCVersion.minecraft1_13) {
GUIListener.GUICode = "";
} else GUIListener.GUICode = "§6§8§9§r";
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (gui.guiEnable || player.hasPermission(Permissions.updatemsg)) {
Inventory inventory;
if (Main.PaPi) {
inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (Replace.replace(prefix, player, GUIListener.GUICode + gui.guiName)));

View File

@ -64,16 +64,4 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
}
}
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());
}
}

View File

@ -4,13 +4,13 @@ import net.t2code.lib.Spigot.system.T2CodeMain;
public class Util {
private static Integer configVersion = 5;
private static double requiredT2CodeLibVersion = 12.1;
private static String requiredT2CodeLibVersion = "12.1";
private static String Prefix = "§8[§4C§9GUI§8]";
private static Integer SpigotID = 90671;
private static Integer BstatsID = 10840;
private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
public static double getRequiredT2CodeLibVersion() {
public static String getRequiredT2CodeLibVersion() {
return requiredT2CodeLibVersion;
}