api changes & clean code
This commit is contained in:
parent
35a9930017
commit
f3feddd317
@ -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>
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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.";
|
@ -17,7 +17,7 @@ public class SelectDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void nameCheck(Player player) {
|
public static void nameCheck(Player player) {
|
||||||
switch (Storage){
|
switch (Storage) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
MySQL.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
|
MySQL.query("UPDATE `gui-item` SET Name='" + player.getName() + "' WHERE UUID='" + player.getUniqueId() + "';");
|
||||||
break;
|
break;
|
||||||
@ -26,13 +26,11 @@ public class SelectDatabase {
|
|||||||
break;
|
break;
|
||||||
case SQLITE:
|
case SQLITE:
|
||||||
default:
|
default:
|
||||||
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) {
|
||||||
switch (Storage) {
|
switch (Storage) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
@ -90,7 +88,7 @@ public class SelectDatabase {
|
|||||||
switch (Storage) {
|
switch (Storage) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
String result = MySQL.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
String result = MySQL.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||||
if(result == null || result.equals("")){
|
if (result == null || result.equals("")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return result.equals("1");
|
return result.equals("1");
|
||||||
@ -99,7 +97,7 @@ public class SelectDatabase {
|
|||||||
case SQLITE:
|
case SQLITE:
|
||||||
default:
|
default:
|
||||||
String result2 = SQLITE.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
String result2 = SQLITE.select("SELECT `Status` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||||
if(result2 == null || result2.equals("")){
|
if (result2 == null || result2.equals("")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return result2.equals("1");
|
return result2.equals("1");
|
||||||
@ -110,7 +108,7 @@ public class SelectDatabase {
|
|||||||
switch (Storage) {
|
switch (Storage) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
String result = MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
String result = MySQL.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||||
if(result == null || result.equals("")|| result.equals("null")){
|
if (result == null || result.equals("") || result.equals("null")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Integer.parseInt(result);
|
return Integer.parseInt(result);
|
||||||
@ -119,7 +117,7 @@ public class SelectDatabase {
|
|||||||
case SQLITE:
|
case SQLITE:
|
||||||
default:
|
default:
|
||||||
String result2 = SQLITE.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
String result2 = SQLITE.select("SELECT `Slot` FROM `gui-item` WHERE `UUID`='" + player.getUniqueId() + "';");
|
||||||
if(result2 == null || result2.equals("") || result2.equals("null")){
|
if (result2 == null || result2.equals("") || result2.equals("null")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Integer.parseInt(result2);
|
return Integer.parseInt(result2);
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user