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

@ -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.languages.LanguagesCreate;
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.Util;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
@ -85,7 +85,7 @@ public class Commands {
e.printStackTrace();
}
try {
RegisterPermissions.onPermRegister();
Permissions.onPermRegister();
} catch (Exception e) {
e.printStackTrace();
}

View File

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

View File

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

View File

@ -7,7 +7,7 @@ import net.t2code.lib.Spigot.Lib.register.Register;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.Plugin;
public class RegisterPermissions {
public class Permissions {
private static final Plugin plugin = Main.plugin;
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() + "';");
break;
}
}
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.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.command.CommandSender;
@ -73,26 +74,24 @@ public class CGuiAPI {
}
public static void sendPluginInfo(CommandSender sender) {
if (sender.hasPermission("commandgui.command.info")) {
if (sender.hasPermission(Permissions.info)) {
Commands.info(sender);
} 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) {
if (sender.hasPermission("commandgui.admin")) {
if (sender.hasPermission(Permissions.admin)) {
CreateGUI.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"));
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
}
public static void reload(CommandSender sender) {
if (sender.hasPermission("commandgui.admin")) {
if (sender.hasPermission(Permissions.admin)) {
Commands.reload(sender);
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
}
}