api changes & clean code

This commit is contained in:
JaTiTV 2022-04-22 19:05:34 +02:00
parent 35a9930017
commit f3feddd317
7 changed files with 25 additions and 32 deletions

View File

@ -69,7 +69,6 @@
<id>placeholderapi</id> <id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url> <url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
@ -113,12 +112,6 @@
<artifactId>HikariCP</artifactId> <artifactId>HikariCP</artifactId>
<version>4.0.3</version> <version>4.0.3</version>
</dependency> </dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId> <artifactId>slf4j-jdk14</artifactId>
@ -129,5 +122,11 @@
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.22</version> <version>1.7.22</version>
</dependency> </dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -11,7 +11,7 @@ import de.jatitv.commandguiv2.Spigot.config.config.ConfigCreate;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig; import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.LanguagesCreate; import de.jatitv.commandguiv2.Spigot.config.languages.LanguagesCreate;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages; import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.RegisterPermissions; import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase; import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import de.jatitv.commandguiv2.Util; import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.items.ItemVersion; import net.t2code.lib.Spigot.Lib.items.ItemVersion;
@ -85,7 +85,7 @@ public class Commands {
e.printStackTrace(); e.printStackTrace();
} }
try { try {
RegisterPermissions.onPermRegister(); Permissions.onPermRegister();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -29,11 +29,9 @@ public class SelectConfig {
public static Boolean HelpAlias; public static Boolean HelpAlias;
public static String language; public static String language;
public static String Currency; public static String Currency;
public static List<String> mainCommands;
public static String storage; public static String storage;
public static Boolean Bungee; public static Boolean Bungee;
public static String thisServer; public static String thisServer;

View File

@ -46,7 +46,6 @@ public class Load {
send.console(prefix + " §8-------------------------------"); send.console(prefix + " §8-------------------------------");
if (!new File(Main.getPath(), "config.yml").exists()) { if (!new File(Main.getPath(), "config.yml").exists()) {
try { try {
CreateGUI.configCreate(); CreateGUI.configCreate();
@ -122,7 +121,7 @@ public class Load {
} }
try { try {
RegisterPermissions.onPermRegister(); Permissions.onPermRegister();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -7,7 +7,7 @@ import net.t2code.lib.Spigot.Lib.register.Register;
import org.bukkit.permissions.PermissionDefault; import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class RegisterPermissions { public class Permissions {
private static final Plugin plugin = Main.plugin; private static final Plugin plugin = Main.plugin;
public static final String key = "commandgui."; public static final String key = "commandgui.";

View File

@ -29,8 +29,6 @@ public class SelectDatabase {
SQLITE.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';"); SQLITE.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
break; break;
} }
} }
public static void setSlot(Player player, Integer slot) { public static void setSlot(Player player, Integer slot) {

View File

@ -8,6 +8,7 @@ import de.jatitv.commandguiv2.Spigot.cmdManagement.Help;
import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI; import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig; import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages; 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.system.database.SelectDatabase;
import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -73,26 +74,24 @@ public class CGuiAPI {
} }
public static void sendPluginInfo(CommandSender sender) { public static void sendPluginInfo(CommandSender sender) {
if (sender.hasPermission("commandgui.command.info")) { if (sender.hasPermission(Permissions.info)) {
Commands.info(sender); Commands.info(sender);
} else sender.sendMessage(SelectMessages.NoPermissionForCommand } else sender.sendMessage(SelectMessages.NoPermissionForCommand
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.command.info")); .replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.info));
} }
public static void createDefaultGUI(CommandSender sender) { public static void createDefaultGUI(CommandSender sender) {
if (sender.hasPermission("commandgui.admin")) { if (sender.hasPermission(Permissions.admin)) {
CreateGUI.configCreate(); CreateGUI.configCreate();
sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml")); sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
} else sender.sendMessage(SelectMessages.NoPermissionForCommand } else sender.sendMessage(SelectMessages.NoPermissionForCommand
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin")); .replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
} }
public static void reload(CommandSender sender) { public static void reload(CommandSender sender) {
if (sender.hasPermission("commandgui.admin")) { if (sender.hasPermission(Permissions.admin)) {
Commands.reload(sender); Commands.reload(sender);
} else sender.sendMessage(SelectMessages.NoPermissionForCommand } else sender.sendMessage(SelectMessages.NoPermissionForCommand
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin")); .replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
} }
} }