Compare commits
6 Commits
2f114cca41
...
abe9cfbe76
Author | SHA1 | Date | |
---|---|---|---|
|
abe9cfbe76 | ||
f947025afa | |||
da4bd4975a | |||
621f626707 | |||
78a0bd5f7e | |||
bdb6711907 |
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>CommandGUI_V2</artifactId>
|
||||
<version>2.8.4</version>
|
||||
<version>2.8.7</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandGUI</name>
|
||||
@ -99,7 +99,7 @@
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>12.1</version>
|
||||
<version>12.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
|
@ -34,7 +34,7 @@ public final class Main extends JavaPlugin {
|
||||
|
||||
public static List<String> autor;
|
||||
|
||||
public static Main plugin;
|
||||
private static Main plugin;
|
||||
|
||||
public static Boolean PaPi = false;
|
||||
public static Boolean PlotSquaredGUI = false;
|
||||
@ -50,12 +50,24 @@ public final class Main extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
version = plugin.getDescription().getVersion();
|
||||
autor = this.getDescription().getAuthors();
|
||||
version = this.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;
|
||||
if (PluginCheck.pluginCheck("CommandGUI")) {
|
||||
send.error(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.error(this, "");
|
||||
send.error(this, "An older version of the plugin T2C-CommandGUI was found!");
|
||||
send.error(this, "This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
|
||||
send.error(this, "Please remove the older version (CommandGUI)!");
|
||||
send.error(this, this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
|
||||
send.error(this, "");
|
||||
send.error(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return;
|
||||
}
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
if (PluginCheck.papi()) {
|
||||
PaPi = true;
|
||||
@ -128,4 +140,8 @@ public final class Main extends JavaPlugin {
|
||||
if (enable) T2CodeTemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
MySQL.close();
|
||||
}
|
||||
|
||||
public static Main getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
|
@ -30,10 +30,10 @@ public class Commands {
|
||||
send.player(player, Util.getPrefix() + "§4======= §8[§4Command§9GUI§8] §4=======");
|
||||
send.player(player, Util.getPrefix() + " §2Autor: §6" + String.valueOf(Main.autor).replace("[", "").replace("]", ""));
|
||||
|
||||
if (UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion.equalsIgnoreCase(Main.version)) {
|
||||
if (UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion.equalsIgnoreCase(Main.version)) {
|
||||
send.player(player, Util.getPrefix() + " §2Version: §6" + Main.version);
|
||||
} else {
|
||||
UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion, player);
|
||||
UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion, player);
|
||||
}
|
||||
|
||||
send.player(player, Util.getPrefix() + " §2Spigot: §6" + Util.getSpigot());
|
||||
@ -43,10 +43,10 @@ public class Commands {
|
||||
send.sender(sender, Util.getPrefix() + "§4======= §8[§4Command§9GUI§8] §4=======");
|
||||
send.sender(sender, Util.getPrefix() + " §2String.valueOf(Main.autor): §6" + String.valueOf(String.valueOf(Main.autor)).replace("[", "").replace("]", ""));
|
||||
|
||||
if (UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion.equalsIgnoreCase(Main.version)) {
|
||||
if (UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion.equalsIgnoreCase(Main.version)) {
|
||||
send.sender(sender, Util.getPrefix() + " §2Version: §6" + Main.version);
|
||||
} else {
|
||||
UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||
UpdateAPI.sendUpdateMsg(Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.version, UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion);
|
||||
}
|
||||
|
||||
send.sender(sender, Util.getPrefix() + " §2Spigot: §6" + Util.getSpigot());
|
||||
@ -61,14 +61,14 @@ public class Commands {
|
||||
send.console(Util.getPrefix() + " §6Plugin reload...");
|
||||
send.console(Util.getPrefix() + "§8-------------------------------");
|
||||
SelectConfig.onSelect();
|
||||
Main.plugin.reloadConfig();
|
||||
Main.getPlugin().reloadConfig();
|
||||
|
||||
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.warning(Main.plugin, "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||
send.warning(Main.getPlugin(), "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||
}
|
||||
|
||||
LanguagesCreate.langCreate();
|
||||
@ -89,7 +89,7 @@ public class Commands {
|
||||
}
|
||||
|
||||
if (SelectConfig.getBungee()) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "commandgui:bungee");
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.getPlugin(), "commandgui:bungee");
|
||||
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ public class Commands {
|
||||
} else {
|
||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||
}
|
||||
send.debug(Main.plugin, String.valueOf(slot));
|
||||
send.debug(Main.getPlugin(), String.valueOf(slot));
|
||||
if (player.getInventory().getItem(slot - 1) == null) {
|
||||
SelectDatabase.setItemStatusTrue(player);
|
||||
UseItem.giveUseItem(player);
|
||||
|
@ -13,7 +13,7 @@ import java.lang.reflect.Field;
|
||||
|
||||
public class AliasRegister {
|
||||
public static void onRegister() {
|
||||
Plugin plugin = Main.plugin;
|
||||
Plugin plugin = Main.getPlugin();
|
||||
send.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
|
||||
if (Main.allAliases.toString().equals("[]")) {
|
||||
send.console(Util.getPrefix() + " §4No GUI files available");
|
||||
@ -24,15 +24,12 @@ public class AliasRegister {
|
||||
if (Main.guiHashMap.get(alias).commandAliasEnable) {
|
||||
try {
|
||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
|
||||
bukkitCommandMap.setAccessible(true);
|
||||
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
||||
|
||||
commandMap.register(alias, new RegisterCommand(alias));
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//Register.register(alias, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class ConfigCreate {
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
if (Main.getPlugin().getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
} else send.console(Util.getPrefix() + " §4config.yml are created...");
|
||||
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
|
@ -12,9 +12,53 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigConverterUnderV5 {
|
||||
public static void renameMainFolder() {
|
||||
if (new File("plugins/CommandGUI").exists()) {
|
||||
File oldF = new File("plugins/CommandGUI");
|
||||
File newF = new File("plugins/T2C-CommandGUI");
|
||||
|
||||
if (oldF.renameTo(newF)) {
|
||||
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.error(Main.getPlugin(), "");
|
||||
send.warning(Main.getPlugin(), "File renamed successfully");
|
||||
send.warning(Main.getPlugin(), "The plugin folder has been renamed from 'CommandGUI' to 'T2C-CommandGUI");
|
||||
send.error(Main.getPlugin(), "");
|
||||
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
} else {
|
||||
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.error(Main.getPlugin(), "");
|
||||
send.error(Main.getPlugin(), "Failed to rename file");
|
||||
send.error(Main.getPlugin(), "An error occurred while renaming the plugin folder from 'CommandGUI' to 'T2C-CommandGUI'! Please report on our Discord: " + Util.getDiscord());
|
||||
send.error(Main.getPlugin(), "");
|
||||
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void noPermLore(YamlConfiguration yamlConfiguration, File config) {
|
||||
yamlConfiguration.set("Slots.Function.NoPermission.Message.Enable", true);
|
||||
yamlConfiguration.set("Slots.Function.NoPermission.Message.CustomNoPermMessage", "");
|
||||
yamlConfiguration.set("Slots.Function.NoPermission.Item.Lore.Enable", true);
|
||||
yamlConfiguration.set("Slots.Function.NoPermission.Item.Lore.Lore", Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"));
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
send.error(Main.getPlugin(), "");
|
||||
send.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Message.Enable' was added to the function " + config.getName() + "!");
|
||||
send.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Message.CustomNoPermMessage' was added to the function " + config.getName() + "!");
|
||||
send.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Item.Lore.Enable' was added to the function " + config.getName() + "!");
|
||||
send.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Item.Lore.Lore' was added to the function " + config.getName() + "!");
|
||||
send.error(Main.getPlugin(), "");
|
||||
send.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
}
|
||||
|
||||
public static void convert() {
|
||||
renameFolder();
|
||||
send.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
|
||||
@ -103,11 +147,12 @@ public class ConfigConverterUnderV5 {
|
||||
|
||||
setNew(key, slotNumber, slotEnable, key, permRequired, yamlConfiguration);
|
||||
CreateFunctions.createFunction(key, empty, itemAmount, playerHeadEnable, base64Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, itemMaterial, itemName, lore,
|
||||
true, "", true, Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"),
|
||||
customSoundEnable, customSoundNoSound, customSoundSound, costEnable, "vault", "DIRT;5", 0, price, commandEnable, commandBungeeCommand, commandAsConsole, command, serverChange,
|
||||
serverChangeServer, openGUIEnable, openGUI, togglePermission, togglePermissionPerm, toggleUseItem, messageEnable, message, setConfigEnable, configFilePath,
|
||||
configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft, configDoubleValueLeft, configListValueLeft,
|
||||
configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight, configListValueRight, pluginReloadEnable, pluginReloadCommand,
|
||||
false, FunctionVoteEnum.ADD,0,false, FunctionItemEnum.REMOVE,"DIRT;5");
|
||||
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -15,7 +15,8 @@ import java.util.List;
|
||||
public class CreateFunctions {
|
||||
public static void create() {
|
||||
createFunction("UseItem", false, 1, false, false, "", false, "", "",
|
||||
"&6Toggle UseItem", Arrays.asList("&bYou currently have the UseItem set to: %commandgui_useitem%"), false, false,
|
||||
"&6Toggle UseItem", Arrays.asList("&bYou currently have the UseItem set to: %commandgui_useitem%"), true, "", true,
|
||||
Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"), false, false,
|
||||
"", false, "VAULT", "DIRT;5", 0, 0.0, false, false, false, Arrays.asList(), false,
|
||||
"", false, "", false, "", true, true,
|
||||
Arrays.asList("&bYour UseItem was set to: %commandgui_useitem%&b."), false, "", "", "String",
|
||||
@ -27,6 +28,7 @@ public class CreateFunctions {
|
||||
false, "", "",
|
||||
"&3Support Discord", Arrays.asList("&8-----------------", "&bIf you need help setting up the plugin,", "&bfeel free to contact me on the Suport Discord.",
|
||||
"&8-----------------", "&eIf you find any errors or bugs,", "&eplease contact me so I can fix them.", "&8-----------------", "&5Discord: §7http://dc.t2code.net"),
|
||||
true, "", true, Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"),
|
||||
false, false, "", false, "VAULT", "DIRT;5", 0, 0.0, false, false,
|
||||
false, Arrays.asList(), false, "", false, "", false, "",
|
||||
false, true, Arrays.asList("&6You can find more information on Discord: &ehttp://dc.t2code.net"), false, "",
|
||||
@ -36,7 +38,7 @@ public class CreateFunctions {
|
||||
}
|
||||
|
||||
public static void createFunction(String fileName, Boolean empty, Integer itemAmount, Boolean playerHeadEnable, Boolean base64Enable, String base64Value, Boolean playerWhoHasOpenedTheGUI,
|
||||
String playerName, String itemMaterial, String name, List<String> lore, Boolean customSoundEnable, Boolean customSoundNoSound, String customSoundSound,
|
||||
String playerName, String itemMaterial, String name, List<String> lore, Boolean noPermMessageEnable, String customNoPermMessage, Boolean noPermLoreEnable, List<String> noPermLore, Boolean customSoundEnable, Boolean customSoundNoSound, String customSoundSound,
|
||||
Boolean costEnable, String ecoModule, String ecoItem, Integer ecoVotePoints, Double ecoPrice, Boolean commandEnable, Boolean commandBungeeCommand,
|
||||
Boolean commandAsConsole, List<String> command, Boolean serverChange, String serverChangeServer, Boolean openGUIEnable, String openGUI,
|
||||
Boolean togglePermission, String togglePermissionPerm, Boolean toggleUseItem, Boolean messageEnable, List<String> message, Boolean setConfigEnable,
|
||||
@ -70,6 +72,10 @@ public class CreateFunctions {
|
||||
set("Slots.Function.Item.Material", itemMaterial == null ? "" : itemMaterial, yamlConfiguration);
|
||||
set("Slots.Function.Item.Name", name == null ? "" : name, yamlConfiguration);
|
||||
set("Slots.Function.Item.Lore", lore, yamlConfiguration);
|
||||
set("Slots.Function.NoPermission.Message.Enable", noPermMessageEnable, yamlConfiguration);
|
||||
set("Slots.Function.NoPermission.Message.CustomNoPermMessage", customNoPermMessage, yamlConfiguration);
|
||||
set("Slots.Function.NoPermission.Item.Lore.Enable", noPermLoreEnable, yamlConfiguration);
|
||||
set("Slots.Function.NoPermission.Item.Lore.Lore", noPermLore, yamlConfiguration);
|
||||
set("Slots.Function.CustomSound.Enable", customSoundEnable, yamlConfiguration);
|
||||
set("Slots.Function.CustomSound.NoSound", customSoundNoSound, yamlConfiguration);
|
||||
set("Slots.Function.CustomSound.Sound", customSoundSound == null ? "" : customSoundSound, yamlConfiguration);
|
||||
|
@ -10,7 +10,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class LanguagesCreate {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static void langCreate() {
|
||||
send.debug(plugin,"§4Language files are created / updated...");
|
||||
|
@ -83,7 +83,7 @@ public class SelectMessages {
|
||||
|
||||
public static void onSelect(String Prefix) {
|
||||
|
||||
send.debug(Main.plugin, "§4Select language...");
|
||||
send.debug(Main.getPlugin(), "§4Select language...");
|
||||
long long_ = System.currentTimeMillis();
|
||||
|
||||
File msg;
|
||||
|
@ -22,7 +22,7 @@ public class MySQL {
|
||||
long long_ = System.currentTimeMillis();
|
||||
Calendar now = Calendar.getInstance();
|
||||
ZoneId timeZone = now.getTimeZone().toZoneId();
|
||||
send.debug(Main.plugin, "Server TimeZone is : " + timeZone);
|
||||
send.debug(Main.getPlugin(), "Server TimeZone is : " + timeZone);
|
||||
try {
|
||||
config.setJdbcUrl("jdbc:mysql://" + SelectConfig.getMysqlIp() + ":" + SelectConfig.getMysqlPort() + "/" + SelectConfig.getMysqlDatabase()
|
||||
+ "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone
|
||||
@ -36,20 +36,20 @@ public class MySQL {
|
||||
send.console(Util.getPrefix() + " §2MYSQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} catch (Exception ex) {
|
||||
send.console(Util.getPrefix() + " §4MYSQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
send.error(Main.plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
||||
send.error(Main.getPlugin(), ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
if (SelectConfig.getDebug() || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
|
||||
try {
|
||||
send.error(Main.plugin, "MySQL DEBUG:");
|
||||
send.error(Main.getPlugin(), "MySQL DEBUG:");
|
||||
Connection con = ds.getConnection();
|
||||
DatabaseMetaData dbmd = con.getMetaData();
|
||||
send.debugmsg(Main.plugin, "§6Metadata of the database:");
|
||||
send.debugmsg(Main.plugin, "§6DB: §e" + dbmd.getDatabaseProductName());
|
||||
send.debugmsg(Main.plugin, "§6Version: §e" + dbmd.getDatabaseProductVersion());
|
||||
send.debugmsg(Main.plugin, "§6Driver: §e" + dbmd.getDriverName());
|
||||
send.debugmsg(Main.plugin, "§6Driver MajorVersion: §e" + dbmd.getDriverMajorVersion() + "." + dbmd.getDriverMinorVersion());
|
||||
send.debugmsg(Main.plugin, "§6Driver Version: §e" + dbmd.getDriverVersion());
|
||||
send.debugmsg(Main.getPlugin(), "§6Metadata of the database:");
|
||||
send.debugmsg(Main.getPlugin(), "§6DB: §e" + dbmd.getDatabaseProductName());
|
||||
send.debugmsg(Main.getPlugin(), "§6Version: §e" + dbmd.getDatabaseProductVersion());
|
||||
send.debugmsg(Main.getPlugin(), "§6Driver: §e" + dbmd.getDriverName());
|
||||
send.debugmsg(Main.getPlugin(), "§6Driver MajorVersion: §e" + dbmd.getDriverMajorVersion() + "." + dbmd.getDriverMinorVersion());
|
||||
send.debugmsg(Main.getPlugin(), "§6Driver Version: §e" + dbmd.getDriverVersion());
|
||||
con.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -65,7 +65,7 @@ public class MySQL {
|
||||
if (ds == null) {
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
Connection con = ds.getConnection();
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute(query);
|
||||
@ -75,7 +75,7 @@ public class MySQL {
|
||||
|
||||
|
||||
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
@ -97,7 +97,7 @@ public class MySQL {
|
||||
}
|
||||
|
||||
public static String select(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
String Ausgabe = "";
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
@ -114,7 +114,7 @@ public class MySQL {
|
||||
}
|
||||
|
||||
public static int count(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
int count = 0;
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
@ -131,7 +131,7 @@ public class MySQL {
|
||||
}
|
||||
|
||||
public static ArrayList<String> selectRow(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
ArrayList<String> Result = new ArrayList<>();
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
|
@ -20,7 +20,7 @@ public class SQLITE {
|
||||
if (!directory.exists()) {
|
||||
directory.mkdir();
|
||||
}
|
||||
url = "jdbc:sqlite:" + Main.plugin.getDataFolder() + "/Storage/data.db";
|
||||
url = "jdbc:sqlite:" + Main.getPlugin().getDataFolder() + "/Storage/data.db";
|
||||
con = DriverManager.getConnection(url);
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2SQLITE successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
DatabaseMetaData dbmd = con.getMetaData();
|
||||
@ -28,7 +28,7 @@ public class SQLITE {
|
||||
|
||||
public static void query(String query) {
|
||||
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute(query);
|
||||
@ -42,7 +42,7 @@ public class SQLITE {
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
for (String query : queryList) {
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
stmt.addBatch(query);
|
||||
}
|
||||
stmt.executeBatch();
|
||||
@ -54,7 +54,7 @@ public class SQLITE {
|
||||
|
||||
|
||||
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
@ -76,7 +76,7 @@ public class SQLITE {
|
||||
}
|
||||
|
||||
public static String select(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
String Ausgabe = "";
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
@ -93,7 +93,7 @@ public class SQLITE {
|
||||
}
|
||||
|
||||
public static int count(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
int count = 0;
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
@ -110,7 +110,7 @@ public class SQLITE {
|
||||
}
|
||||
|
||||
public static ArrayList<String> selectRow(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
send.debug(Main.getPlugin(), query);
|
||||
ArrayList<String> Result = new ArrayList<>();
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
|
@ -12,7 +12,7 @@ import java.io.IOException;
|
||||
|
||||
public class YML {
|
||||
|
||||
private static final Plugin plugin = Main.plugin;
|
||||
private static final Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static File storage = new File(Main.getPath(), "Storage/gui-item.yml");
|
||||
public static YamlConfiguration yamlConfigurationStorage = YamlConfiguration.loadConfiguration(storage);
|
||||
|
@ -37,12 +37,12 @@ public class GUIListener implements Listener {
|
||||
|
||||
private static String prefix = Util.getPrefix();
|
||||
public static String GUICode;
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static Plugin plugin = Main.getPlugin();
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
JavaPlugin plugin = Main.plugin;
|
||||
JavaPlugin plugin = Main.getPlugin();
|
||||
if (e.getInventory() == null) return;
|
||||
if (e.getCurrentItem() == null) return;
|
||||
for (Gui gui : Main.guiHashMap.values()) {
|
||||
@ -61,8 +61,14 @@ public class GUIListener implements Listener {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) return;
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
|
||||
send.player(player, SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name))
|
||||
.replace("[perm]", slot.permissionToUse));
|
||||
if (function.noPermMessageEnable) {
|
||||
if (function.customNoPermMessage == null || function.customNoPermMessage.equals("")) {
|
||||
send.player(player, SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name))
|
||||
.replace("[perm]", slot.permissionToUse));
|
||||
} else send.player(player, function.customNoPermMessage.replace("[item]", Replace.replace(prefix, function.name))
|
||||
.replace("[perm]", slot.permissionToUse));
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == ItemVersion.getGreenWool().getType() ||
|
||||
@ -167,7 +173,7 @@ public class GUIListener implements Listener {
|
||||
public void run() {
|
||||
ServerChange.send(player, slot.serverChangeServer);
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 20L);
|
||||
}.runTaskLater(Main.getPlugin(), 20L);
|
||||
}
|
||||
|
||||
private static void setConfig(Function slot, Player player, InventoryClickEvent e) {
|
||||
@ -316,7 +322,7 @@ public class GUIListener implements Listener {
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
send.player(player, SelectMessages.noMoneyItem.replace("[item]", item[0]).replace("[amount]", item[1]));
|
||||
Sound.play(player,SoundEnum.NoMoney);
|
||||
Sound.play(player, SoundEnum.NoMoney);
|
||||
} else {
|
||||
send.player(player, SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
|
||||
.replace("[price]", item[1] + " " + item[0]));
|
||||
@ -332,7 +338,7 @@ public class GUIListener implements Listener {
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
send.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
|
||||
Sound.play(player,SoundEnum.NoMoney);
|
||||
Sound.play(player, SoundEnum.NoMoney);
|
||||
} else {
|
||||
send.player(player, SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
|
||||
.replace("[price]", function.votePoints + " VotePoints"));
|
||||
@ -349,7 +355,7 @@ public class GUIListener implements Listener {
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
send.player(player, Replace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
|
||||
Sound.play(player,SoundEnum.NoMoney);
|
||||
Sound.play(player, SoundEnum.NoMoney);
|
||||
} else {
|
||||
send.player(player, SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
|
||||
.replace("[price]", function.price + " " + SelectConfig.getCurrency()));
|
||||
|
@ -6,7 +6,7 @@ import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Papi;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Placeholder;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
@ -26,63 +26,71 @@ public class GuiBuilder {
|
||||
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
protected static void item(Function function, Integer slot, Player player, Inventory inventory) {
|
||||
protected static void item(Slot slot, Player player, Inventory inventory) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
ItemStack item;
|
||||
if (Main.legacy && function.item.toUpperCase().contains(",")) {
|
||||
String[] split = function.item.toUpperCase().split(",");
|
||||
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
|
||||
} else item = new ItemStack(Material.valueOf(function.item.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
setDisplayNameAndLore(itemMeta, player, function);
|
||||
setDisplayNameAndLore(itemMeta, player, slot);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (function.itemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = function.itemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot, item);
|
||||
inventory.setItem(slot.slot, item);
|
||||
}
|
||||
|
||||
protected static void item(String material, Function function, Integer slot, Player player, Inventory inventory) {
|
||||
protected static void item(String material, Slot slot, Player player, Inventory inventory) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
ItemStack item;
|
||||
if (Main.legacy && material.contains(",")) {
|
||||
String[] split = material.split(",");
|
||||
item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
|
||||
} else item = new ItemStack(Material.valueOf(material));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
setDisplayNameAndLore(itemMeta, player, function);
|
||||
setDisplayNameAndLore(itemMeta, player, slot);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (function.itemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = function.itemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot, item);
|
||||
inventory.setItem(slot.slot, item);
|
||||
}
|
||||
|
||||
|
||||
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Function slot) {
|
||||
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Slot slot) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, Placeholder.replace(slot.name, player)));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, Placeholder.replace(slot.lore, player), slot.price + " " + SelectConfig.getCurrency()));
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, Placeholder.replace(function.name, player)));
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
} else itemMeta.setLore(Replace.replacePrice(prefix, player, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, Placeholder.replace(slot.name,player)));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, Placeholder.replace(slot.lore,player), slot.price + " " + SelectConfig.getCurrency()));
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, Placeholder.replace(function.name, player)));
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
} else itemMeta.setLore(Replace.replacePrice(prefix, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||
}
|
||||
}
|
||||
|
||||
protected static void base64(String base64Value, Function function, Integer slot, Player player, Inventory inventory) {
|
||||
protected static void base64(String base64Value, Slot slot, Player player, Inventory inventory) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
ItemStack item = ItemVersion.getHeadIS();
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
setBase64(itemMeta, base64Value);
|
||||
setDisplayNameAndLore(itemMeta, player, function);
|
||||
setDisplayNameAndLore(itemMeta, player, slot);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (function.itemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = function.itemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot, item);
|
||||
inventory.setItem(slot.slot, item);
|
||||
}
|
||||
|
||||
private static void setBase64(ItemMeta itemMeta, String base64Value) {
|
||||
@ -98,14 +106,16 @@ public class GuiBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
protected static void base64(Function function, Integer slot, Player player, Inventory inventory) {
|
||||
base64(function.base64Value, function, slot, player, inventory);
|
||||
protected static void base64(Slot slot, Player player, Inventory inventory) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
base64(function.base64Value, slot, player, inventory);
|
||||
}
|
||||
|
||||
protected static void playerHead(Function function, Integer slot, Player player, Inventory inventory, String skullName) {
|
||||
protected static void playerHead(Slot slot, Player player, Inventory inventory, String skullName) {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
ItemStack item = ItemVersion.getHeadIS();
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
setDisplayNameAndLore(itemMeta, player, function);
|
||||
setDisplayNameAndLore(itemMeta, player, slot);
|
||||
itemMeta.setOwner(skullName);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
@ -113,7 +123,7 @@ public class GuiBuilder {
|
||||
am = 1;
|
||||
} else am = function.itemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot, item);
|
||||
inventory.setItem(slot.slot, item);
|
||||
}
|
||||
|
||||
public static void fillItem(Inventory inventory, Gui gui) {
|
||||
|
@ -25,7 +25,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class OpenGUI {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static Plugin plugin = Main.getPlugin();
|
||||
private static String prefix = Util.getPrefix();
|
||||
|
||||
public static void openGUI(Player player, String guiString, Boolean sound) {
|
||||
@ -46,7 +46,7 @@ public class OpenGUI {
|
||||
if (Main.PlugManGUI) {
|
||||
player.openInventory((new PluginListGUI(54, 1)).getInventory());
|
||||
} else {
|
||||
if (player.hasPermission("commandgui.admin")) {
|
||||
if (player.hasPermission(Permissions.admin)) {
|
||||
send.player(player, prefix + " §4PlugManGUI could not be found! §9Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/plugmangui.87599/");
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class OpenGUI {
|
||||
if (Main.LuckyBox) {
|
||||
LuckyBoxAPI.openShop(player);
|
||||
} else {
|
||||
if (player.hasPermission("commandgui.admin")) {
|
||||
if (player.hasPermission(Permissions.admin)) {
|
||||
send.player(player, prefix + " §4T2C-LuckyBox could not be found! §9Please download it here: " +
|
||||
"§6https://www.spigotmc.org/resources/luckybox.98154/");
|
||||
}
|
||||
@ -80,7 +80,7 @@ public class OpenGUI {
|
||||
try {
|
||||
Function function = Main.functionHashMap.get(slot.function);
|
||||
if (function == null) {
|
||||
send.error(Main.plugin, "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
||||
send.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
||||
continue;
|
||||
}
|
||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
|
||||
@ -93,35 +93,34 @@ public class OpenGUI {
|
||||
} else {
|
||||
if (function.togglePermission) {
|
||||
if (player.hasPermission(function.togglePermissionPerm)) {
|
||||
toggleOn(function, slot.slot, player, inventory);
|
||||
toggleOn(function, slot, player, inventory);
|
||||
} else {
|
||||
toggleOff(function, slot.slot, player, inventory);
|
||||
toggleOff(function, slot, player, inventory);
|
||||
}
|
||||
} else if (function.toggleUseItem) {
|
||||
if (Events.useItemHashMap.get(player.getName())) {
|
||||
toggleOn(function, slot.slot, player, inventory);
|
||||
toggleOn(function, slot, player, inventory);
|
||||
} else {
|
||||
toggleOff(function, slot.slot, player, inventory);
|
||||
toggleOff(function, slot, player, inventory);
|
||||
}
|
||||
} else {
|
||||
if (function.playerHead_Enable) {
|
||||
if (function.base64_Enable) {
|
||||
GuiBuilder.base64(function, slot.slot, player, inventory);
|
||||
GuiBuilder.base64(slot, player, inventory);
|
||||
} else {
|
||||
if (function.playerWhoHasOpenedTheGUI) {
|
||||
GuiBuilder.playerHead(function, slot.slot, player, inventory, player.getName());
|
||||
GuiBuilder.playerHead(slot, player, inventory, player.getName());
|
||||
} else {
|
||||
GuiBuilder.playerHead(function, slot.slot, player, inventory, function.playerName);
|
||||
GuiBuilder.playerHead(slot, player, inventory, function.playerName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GuiBuilder.item(function, slot.slot, player, inventory);
|
||||
GuiBuilder.item(slot, player, inventory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
ItemStack air = new ItemStack(Material.AIR);
|
||||
inventory.setItem(slot.slot, air);
|
||||
@ -133,18 +132,18 @@ public class OpenGUI {
|
||||
}
|
||||
player.openInventory(inventory);
|
||||
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else send.player(player,SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.guiName)));
|
||||
} else send.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.guiName)));
|
||||
}
|
||||
|
||||
private static void toggleOn(Function function, Integer slot, Player player, Inventory inventory) {
|
||||
private static void toggleOn(Function function, Slot slot, Player player, Inventory inventory) {
|
||||
if (SelectConfig.getToggleItemOnOrYesBase64()) {
|
||||
GuiBuilder.base64(SelectConfig.getToggleItemOnOrYesBase64Value(), function, slot, player, inventory);
|
||||
} else GuiBuilder.item(SelectConfig.getToggleItemOnOrYesMaterial(), function, slot, player, inventory);
|
||||
GuiBuilder.base64(SelectConfig.getToggleItemOnOrYesBase64Value(), slot, player, inventory);
|
||||
} else GuiBuilder.item(SelectConfig.getToggleItemOnOrYesMaterial(), slot, player, inventory);
|
||||
}
|
||||
|
||||
private static void toggleOff(Function function, Integer slot, Player player, Inventory inventory) {
|
||||
private static void toggleOff(Function function, Slot slot, Player player, Inventory inventory) {
|
||||
if (SelectConfig.getToggleItemOffOrNoBase64()) {
|
||||
GuiBuilder.base64(SelectConfig.getToggleItemOffOrNoBase64Value(), function, slot, player, inventory);
|
||||
} else GuiBuilder.item(SelectConfig.getToggleItemOffOrNoMaterial(), function, slot, player, inventory);
|
||||
GuiBuilder.base64(SelectConfig.getToggleItemOffOrNoBase64Value(), slot, player, inventory);
|
||||
} else GuiBuilder.item(SelectConfig.getToggleItemOffOrNoMaterial(), slot, player, inventory);
|
||||
}
|
||||
}
|
||||
|
@ -30,10 +30,10 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
|
||||
}
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||
player.sendPluginMessage(Main.getPlugin(), "cgui:bungee", stream.toByteArray());
|
||||
}else {
|
||||
for(Player player : Bukkit.getOnlinePlayers()){
|
||||
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||
player.sendPluginMessage(Main.getPlugin(), "cgui:bungee", stream.toByteArray());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -42,12 +42,12 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
||||
send.debug(Main.plugin,"stream: "+stream.toString());
|
||||
send.debug(Main.getPlugin(),"stream: "+stream.toString());
|
||||
try {
|
||||
String subChannel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
send.debug(Main.plugin,"subChannel: " +subChannel);
|
||||
send.debug(Main.plugin,"input: " +input);
|
||||
send.debug(Main.getPlugin(),"subChannel: " +subChannel);
|
||||
send.debug(Main.getPlugin(),"input: " +input);
|
||||
switch (subChannel) {
|
||||
case "join":
|
||||
Main.bungeejoinplayers.add(input);
|
||||
|
@ -18,6 +18,6 @@ public class PluginEvent implements Listener {
|
||||
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());
|
||||
UpdateAPI.join(Main.getPlugin(),prefix, "commandgui.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord());
|
||||
}
|
||||
}
|
@ -17,6 +17,6 @@ public class ServerChange {
|
||||
} catch (IOException i) {
|
||||
i.printStackTrace();
|
||||
}
|
||||
player.sendPluginMessage(Main.plugin, "BungeeCord", b.toByteArray());
|
||||
player.sendPluginMessage(Main.getPlugin(), "BungeeCord", b.toByteArray());
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package de.jatitv.commandguiv2.Spigot.objects;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
||||
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
||||
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
|
||||
@ -64,7 +65,7 @@ public class Obj_Select {
|
||||
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
|
||||
Function functionCheck = Main.functionHashMap.get(function);
|
||||
if (functionCheck == null) {
|
||||
send.error(Main.plugin, "The Function " + function + " in the GUI " + key + " does not exist!");
|
||||
send.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
|
||||
}
|
||||
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Permission.Required");
|
||||
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
|
||||
@ -100,7 +101,7 @@ public class Obj_Select {
|
||||
File[] fileArray = f.listFiles();
|
||||
|
||||
for (File config : fileArray) {
|
||||
if (config.getName().equals("functionDeclaration.yml")) return;
|
||||
if (config.getName().equals("functionDeclaration.yml")) continue;
|
||||
String sub = config.getName().substring(config.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
@ -116,6 +117,13 @@ public class Obj_Select {
|
||||
String item = yamlConfiguration.getString("Slots.Function.Item.Material");
|
||||
String name = yamlConfiguration.getString("Slots.Function.Item.Name");
|
||||
List<String> lore = yamlConfiguration.getStringList("Slots.Function.Item.Lore");
|
||||
if (yamlConfiguration.get("Slots.Function.NoPermission") == null) {
|
||||
ConfigConverterUnderV5.noPermLore(yamlConfiguration, config);
|
||||
}
|
||||
Boolean noPermMessageEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Message.Enable");
|
||||
String customNoPermMessage = yamlConfiguration.getString("Slots.Function.NoPermission.Message.CustomNoPermMessage");
|
||||
Boolean noPermLoreEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Item.Lore.Enable");
|
||||
List<String> noPermLore = yamlConfiguration.getStringList("Slots.Function.NoPermission.Item.Lore.Lore");
|
||||
Boolean customSound_Enable = yamlConfiguration.getBoolean("Slots.Function.CustomSound.Enable");
|
||||
Boolean customSound_NoSound = yamlConfiguration.getBoolean("Slots.Function.CustomSound.NoSound");
|
||||
String customSound_Sound = yamlConfiguration.getString("Slots.Function.CustomSound.Sound");
|
||||
@ -125,7 +133,7 @@ public class Obj_Select {
|
||||
try {
|
||||
ecoModule = EcoEnum.valueOf(yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
send.error(Main.plugin, "The EcoModule " + yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase() + " in the function file "
|
||||
send.error(Main.getPlugin(), "The EcoModule " + yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase() + " in the function file "
|
||||
+ config.getName() + " does not exist. Please use one of the supported modules. (VAULT, ITEM, VOTEPOINTS)");
|
||||
}
|
||||
} else ecoModule = EcoEnum.VAULT;
|
||||
@ -174,7 +182,7 @@ public class Obj_Select {
|
||||
try {
|
||||
functionVotePointsMode = FunctionVoteEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
send.error(Main.plugin, "The VotePoints Mode " + yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase() + " in the function file "
|
||||
send.error(Main.getPlugin(), "The VotePoints Mode " + yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase() + " in the function file "
|
||||
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
||||
}
|
||||
}
|
||||
@ -186,13 +194,14 @@ public class Obj_Select {
|
||||
try {
|
||||
functionItemMode = FunctionItemEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
send.error(Main.plugin, "The Item Mode " + yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase() + " in the function file "
|
||||
send.error(Main.getPlugin(), "The Item Mode " + yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase() + " in the function file "
|
||||
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
||||
}
|
||||
}
|
||||
String functionItemItem = yamlConfiguration.getString("Slots.Function.FunctionItem.Item");
|
||||
|
||||
Function function = new Function(key, empty, itemAmount, playerHead_Enable, base64_Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, item, name, lore,
|
||||
noPermMessageEnable, customNoPermMessage, noPermLoreEnable, noPermLore,
|
||||
customSound_Enable, customSound_NoSound, customSound_Sound, cost_Enable, ecoModule, ecoItem, votePoints, price, command_Enable, command_BungeeCommand,
|
||||
commandAsConsole, command, serverChange, serverChangeServer, openGUI_Enable, openGUI, togglePermission, togglePermissionPerm, toggleUseItem, message_Enable,
|
||||
message, setConfigEnable, configFilePath, configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft,
|
||||
|
@ -19,6 +19,10 @@ public class Function {
|
||||
public String item;
|
||||
public String name;
|
||||
public List<String> lore;
|
||||
public Boolean noPermMessageEnable;
|
||||
public String customNoPermMessage;
|
||||
public Boolean noPermLoreEnable;
|
||||
public List<String> noPermLore;
|
||||
public Boolean customSound_Enable;
|
||||
public Boolean customSound_NoSound;
|
||||
public String customSound_Sound;
|
||||
@ -44,7 +48,6 @@ public class Function {
|
||||
public String configFilePath;
|
||||
public String configOptionPath;
|
||||
public String configOptionPremat;
|
||||
// public Boolean ConfigChatInput;
|
||||
|
||||
public String configStringValueLeft;
|
||||
public Boolean configBooleanValueLeft;
|
||||
@ -79,6 +82,10 @@ public class Function {
|
||||
String item,
|
||||
String name,
|
||||
List<String> lore,
|
||||
Boolean noPermMessageEnable,
|
||||
String customNoPermMessage,
|
||||
Boolean noPermLoreEnable,
|
||||
List<String> noPermLore,
|
||||
Boolean customSound_Enable,
|
||||
Boolean customSound_NoSound,
|
||||
String customSound_Sound,
|
||||
@ -136,6 +143,10 @@ public class Function {
|
||||
this.item = item;
|
||||
this.name = name;
|
||||
this.lore = lore;
|
||||
this.noPermMessageEnable = noPermMessageEnable;
|
||||
this.customNoPermMessage = customNoPermMessage;
|
||||
this.noPermLoreEnable = noPermLoreEnable;
|
||||
this.noPermLore = noPermLore;
|
||||
this.customSound_Enable = customSound_Enable;
|
||||
this.customSound_NoSound = customSound_NoSound;
|
||||
this.customSound_Sound = customSound_Sound;
|
||||
|
@ -28,14 +28,17 @@ public class Sound {
|
||||
break;
|
||||
case Click:
|
||||
if (!SelectConfig.getSound_Click_Enable()) return;
|
||||
if (!function.customSound_Enable) player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||
if (!function.customSound_Enable) {
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (function.customSound_NoSound) return;
|
||||
try {
|
||||
player.playSound(player.getLocation(), org.bukkit.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));
|
||||
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
|
||||
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||
}
|
||||
break;
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||
|
||||
public class Debug {
|
||||
|
||||
private static final Plugin plugin = Main.plugin;
|
||||
private static final Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static void debugmsg() {
|
||||
send.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
@ -25,7 +25,7 @@ public class Debug {
|
||||
send.debug(plugin, "§3Version: §e" + Bukkit.getVersion());
|
||||
send.debug(plugin, "§3Java: §e" + System.getProperty("java.version"));
|
||||
send.debug(plugin, "§3Worlds: §e" + String.valueOf(Bukkit.getServer().getWorlds()));
|
||||
send.debug(plugin, String.valueOf(Arrays.asList(Main.plugin.getServer().getPluginManager().getPlugins())));
|
||||
send.debug(plugin, String.valueOf(Arrays.asList(Main.getPlugin().getServer().getPluginManager().getPlugins())));
|
||||
send.debug(plugin, "§5----------------------------------");
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
File f = new File(String.valueOf(Main.getPath()));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
|
||||
import de.jatitv.commandguiv2.Spigot.gui.GUIListener;
|
||||
import de.jatitv.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
||||
import de.jatitv.commandguiv2.Spigot.useItem.EventsFrom110;
|
||||
@ -34,7 +35,7 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
public class Load {
|
||||
static Plugin plugin = Main.plugin;
|
||||
static Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
||||
|
||||
@ -46,6 +47,12 @@ public class Load {
|
||||
}
|
||||
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
try {
|
||||
ConfigConverterUnderV5.renameMainFolder();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
if (!new File(Main.getPath(), "config.yml").exists()) {
|
||||
try {
|
||||
@ -53,16 +60,6 @@ public class Load {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
plugin.saveResource("GUIs/guiDeclaration.yml", false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
plugin.saveResource("Functions/functionDeclaration.yml", false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CreateGUI.configCreate();
|
||||
} catch (Exception e) {
|
||||
@ -74,6 +71,7 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ConfigCreate.configCreate();
|
||||
} catch (Exception e) {
|
||||
@ -84,6 +82,16 @@ public class Load {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
plugin.saveResource("GUIs/guiDeclaration.yml", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
plugin.saveResource("Functions/functionDeclaration.yml", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
SelectConfig.setConfigVersion();
|
||||
|
||||
@ -124,7 +132,7 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), Permissions.admin+";"+Permissions.giveItemOther+";"+Permissions.info);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -146,12 +154,12 @@ public class Load {
|
||||
}
|
||||
|
||||
if (SelectConfig.getHelpAlias()) {
|
||||
Main.plugin.getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
||||
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
||||
send.debug(plugin, "CommandRegister: commandguihelp");
|
||||
}
|
||||
Main.plugin.getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
|
||||
Main.getPlugin().getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
|
||||
send.debug(plugin, "CommandRegister: commandgui");
|
||||
Main.plugin.getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
||||
Main.getPlugin().getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
||||
send.debug(plugin, "CommandRegister: commandgui-item");
|
||||
|
||||
try {
|
||||
@ -163,7 +171,7 @@ public class Load {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new GUIListener(), plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.getPlugin());
|
||||
|
||||
if (!MCVersion.minecraft1_8 && !MCVersion.minecraft1_9) {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new EventsFrom110(), plugin);
|
||||
@ -179,8 +187,8 @@ public class Load {
|
||||
try {
|
||||
SelectDatabase.setStorage(StorageEnum.valueOf(SelectConfig.getStorage()));
|
||||
} catch (Exception ignored) {
|
||||
send.error(Main.plugin, "The storage medium " + SelectConfig.getStorage() + " is not supported!");
|
||||
send.error(Main.plugin, "Storage medium " + StorageEnum.SQLITE + " is used.");
|
||||
send.error(Main.getPlugin(), "The storage medium " + SelectConfig.getStorage() + " is not supported!");
|
||||
send.error(Main.getPlugin(), "Storage medium " + StorageEnum.SQLITE + " is used.");
|
||||
SelectDatabase.setStorage(StorageEnum.SQLITE);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class Metrics {
|
||||
|
||||
public static void Bstats() {
|
||||
int pluginId = Util.getBstatsID(); // <-- Replace with the id of your plugin!
|
||||
Metrics metrics = new Metrics(Main.plugin, pluginId);
|
||||
Metrics metrics = new Metrics(Main.getPlugin(), pluginId);
|
||||
metrics.addCustomChart(new DrilldownPie("storage_type_mysql", () -> {
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
String storage = SelectDatabase.getStorage().toString();
|
||||
|
@ -15,12 +15,12 @@ public class Papi extends PlaceholderExpansion {
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
return Main.plugin.getDescription().getAuthors().toString();
|
||||
return Main.getPlugin().getDescription().getAuthors().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return Main.plugin.getDescription().getVersion();
|
||||
return Main.getPlugin().getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class Permissions {
|
||||
private static final Plugin plugin = Main.plugin;
|
||||
private static final Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static final String key = "commandgui.";
|
||||
public static final String command = key + "command";
|
||||
@ -17,6 +17,7 @@ public class Permissions {
|
||||
public static final String useitemToggle = key + "useitem.toggle";
|
||||
public static final String useitem = key + "useitem";
|
||||
public static final String getGuiItemAtLogin = key + "get.guiitem.at.login";
|
||||
public static final String giveItemOther = key + "giveitem.other";
|
||||
public static final String updatemsg = key + "updatemsgupdatemsg";
|
||||
|
||||
public static final String player = key + "player";
|
||||
@ -30,6 +31,7 @@ public class Permissions {
|
||||
Register.permissionDescription(command, "Required permission to open GUIs via command", plugin);
|
||||
|
||||
Register.permission(getGuiItemAtLogin, op, plugin);
|
||||
Register.permission(giveItemOther, op, plugin);
|
||||
Register.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
|
||||
|
||||
Register.permission(useitem, op, plugin);
|
||||
@ -45,27 +47,28 @@ public class Permissions {
|
||||
Register.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
|
||||
|
||||
Register.permission(info, notOp, plugin);
|
||||
Register.permissionDescription(info, "Permission to view CommandGUI info", plugin);
|
||||
Register.permissionDescription(info, "Permission to view T2C-CommandGUI info", plugin);
|
||||
|
||||
Register.permission(player, op, command, true, plugin);
|
||||
Register.permission(player, op, getGuiItemAtLogin, true, plugin);
|
||||
Register.permission(player, op, useitem, true, plugin);
|
||||
Register.permission(player, op, useitemToggle, true, plugin);
|
||||
Register.permissionDescription(player, "All permissions from CommandGUI for Player", plugin);
|
||||
Register.permissionDescription(player, "All permissions from T2C-CommandGUI for Player", plugin);
|
||||
|
||||
Register.permission(admin, op, command, true, plugin);
|
||||
Register.permission(admin, op, getGuiItemAtLogin, true, plugin);
|
||||
Register.permission(admin, op, giveItemOther, true, plugin);
|
||||
Register.permission(admin, op, useitem, true, plugin);
|
||||
Register.permission(admin, op, useitemToggle, true, plugin);
|
||||
Register.permission(admin, op, updatemsg, true, plugin);
|
||||
Register.permission(admin, op, bypass, true, plugin);
|
||||
Register.permission(admin, op, info, true, plugin);
|
||||
Register.permissionDescription(admin, "All permissions from CommandGUI", plugin);
|
||||
Register.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
|
||||
|
||||
|
||||
for (Gui gui : Main.guiHashMap.values()) {
|
||||
Register.permission("commandgui.command." + gui.key, op, plugin);
|
||||
Register.permission(admin, op, "commandgui.command." + gui.key, true, plugin);
|
||||
Register.permission(command + "." + gui.key, op, plugin);
|
||||
Register.permission(admin, op, command + "." + gui.key, true, plugin);
|
||||
for (Slot slot : gui.slots) {
|
||||
Register.permission(slot.permissionToUse, op, plugin);
|
||||
Register.permission(admin, op, slot.permissionToUse, true, plugin);
|
||||
|
@ -44,17 +44,17 @@ public class Events implements Listener {
|
||||
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
|
||||
|
||||
if (CGuiAPI.JoinDisable) {
|
||||
send.debug(Main.plugin, "JoinDisable");
|
||||
send.debug(Main.getPlugin(), "JoinDisable");
|
||||
return;
|
||||
}
|
||||
if (e.getPlayer().hasPermission("commandgui.get.guiitem.at.login")) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
send.debug(Main.plugin, "itemChange: " + e.getPlayer().getName());
|
||||
send.debug(Main.getPlugin(), "itemChange: " + e.getPlayer().getName());
|
||||
ItemChange.itemChange(e.getPlayer(), true);
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 20L * 1);
|
||||
}.runTaskLater(Main.getPlugin(), 20L * 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class Events implements Listener {
|
||||
// public void run() {
|
||||
// Give_UseItem.onGive(player);
|
||||
// }
|
||||
// }.runTaskLater(Main.plugin, 20L * 1);
|
||||
// }.runTaskLater(Main.getPlugin(), 20L * 1);
|
||||
// }
|
||||
// } else {
|
||||
// new BukkitRunnable() {
|
||||
@ -102,7 +102,7 @@ public class Events implements Listener {
|
||||
// public void run() {
|
||||
// Give_UseItem.onGive(player);
|
||||
// }
|
||||
// }.runTaskLater(Main.plugin, 20L * 1);
|
||||
// }.runTaskLater(Main.getPlugin(), 20L * 1);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
@ -119,7 +119,7 @@ public class Events implements Listener {
|
||||
public void run() {
|
||||
ItemChange.itemChange(player, false);
|
||||
}
|
||||
}.runTaskLater(Main.plugin, SelectConfig.getUseItemGameModeChangeDelayInTicks() * 1L);
|
||||
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemGameModeChangeDelayInTicks() * 1L);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -133,7 +133,7 @@ public class Events implements Listener {
|
||||
public void run() {
|
||||
ItemChange.itemChange(player, false);
|
||||
}
|
||||
}.runTaskLater(Main.plugin, SelectConfig.getUseItemWorldChangeDelayInTicks() * 1L);
|
||||
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemWorldChangeDelayInTicks() * 1L);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@ -316,7 +316,7 @@ public class Events implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L);
|
||||
}.runTaskLater(Main.getPlugin(), 1L);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -331,7 +331,7 @@ public class Events implements Listener {
|
||||
public void run() {
|
||||
clearGive(event.getPlayer());
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L);
|
||||
}.runTaskLater(Main.getPlugin(), 1L);
|
||||
}
|
||||
if (event.getMessage().toLowerCase().contains("clear " + event.getMessage().toLowerCase().replace("/", "").replace("clear ", ""))) {
|
||||
new BukkitRunnable() {
|
||||
@ -339,7 +339,7 @@ public class Events implements Listener {
|
||||
public void run() {
|
||||
clearGive(Bukkit.getPlayer(event.getMessage().toLowerCase().replace("/", "").replace("clear ", "")));
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L);
|
||||
}.runTaskLater(Main.getPlugin(), 1L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,17 +31,17 @@ public class ItemChange {
|
||||
setCursor(player, slot);
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L * 1);
|
||||
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
||||
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin() || SelectConfig.getCursor_ToGUIItem_OnLogin()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
send.debug(Main.plugin, "GiveOnlyOnFirstJoin: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
|
||||
return;
|
||||
}
|
||||
if (!SelectConfig.getUseItem_GiveOnEveryJoin()) {
|
||||
send.debug(Main.plugin, "!GiveOnEveryJoin: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
|
||||
return;
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@ -51,7 +51,7 @@ public class ItemChange {
|
||||
if (pln == null) return;
|
||||
if (!SelectConfig.getUseItem_AllowToggle() || pln) {
|
||||
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(slot - 1) == null) {
|
||||
send.debug(Main.plugin, "Give: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "Give: " + player.getName());
|
||||
UseItem.giveUseItem(player);
|
||||
if (setCursor) {
|
||||
setCursor(player, slot);
|
||||
@ -70,42 +70,42 @@ public class ItemChange {
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L * 1);
|
||||
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
||||
|
||||
}
|
||||
|
||||
private static void setCursor(Player player, int slot) {
|
||||
send.debug(Main.plugin, "setCursor 1 Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
|
||||
|
||||
if (!SelectConfig.getCursor_ToGUIItem_OnLogin()) {
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin, "setCursor 2 Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
|
||||
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin()) {
|
||||
if (!player.hasPlayedBefore()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
send.debug(Main.plugin, "setCursor 3 Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
|
||||
}
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin, "setCursor 4 Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
|
||||
if (!SelectConfig.getBungee()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
send.debug(Main.plugin, "setCursor 5 Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin, "setCursor 6 Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
|
||||
if (SelectConfig.getUseItem_ServerChange()) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
send.debug(Main.plugin, "setCursor 7 Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin, "setCursor 8 Player: " + player.getName());
|
||||
send.debug(Main.plugin, "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
|
||||
send.debug(Main.plugin, "setCursor Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor 8 Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
|
||||
send.debug(Main.getPlugin(), "setCursor Player: " + player.getName());
|
||||
if (Main.bungeejoinplayers.contains(player.getName())) {
|
||||
player.getInventory().setHeldItemSlot(slot - 1);
|
||||
send.debug(Main.plugin, "setCursor 9 Player: " + player.getName());
|
||||
send.debug(Main.getPlugin(), "setCursor 9 Player: " + player.getName());
|
||||
Main.bungeejoinplayers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class UseItem {
|
||||
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||
player.getInventory().addItem(itemStack(player));
|
||||
} else {
|
||||
send.debug(Main.plugin, "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
|
||||
send.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
|
||||
player.getInventory().setItem(slot - 1, itemStack(player));
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class UseItem {
|
||||
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
send.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
|
||||
send.error(Main.plugin, "Playerheads for UseItem are only available from version 1.13!");
|
||||
send.error(Main.getPlugin(), "Playerheads for UseItem are only available from version 1.13!");
|
||||
} else {
|
||||
item = ItemVersion.getHeadIS();
|
||||
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||
@ -126,7 +126,7 @@ public class UseItem {
|
||||
}
|
||||
|
||||
public static void removeItem(Player player) {
|
||||
send.debug(Main.plugin, "World disabled: " + player.getName() + " " + player.getWorld().toString());
|
||||
send.debug(Main.getPlugin(), "World disabled: " + player.getName() + " " + player.getWorld().toString());
|
||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||
ItemStack itm = player.getInventory().getItem(iam);
|
||||
if (itm != null) {
|
||||
|
@ -4,7 +4,7 @@ import net.t2code.lib.Spigot.system.T2CodeMain;
|
||||
|
||||
public class Util {
|
||||
private static Integer configVersion = 5;
|
||||
private static String requiredT2CodeLibVersion = "12.1";
|
||||
private static String requiredT2CodeLibVersion = "12.4";
|
||||
private static String Prefix = "§8[§4C§9GUI§8]";
|
||||
private static Integer SpigotID = 90671;
|
||||
private static Integer BstatsID = 10840;
|
||||
|
@ -40,7 +40,7 @@ public class CGuiAPI {
|
||||
}
|
||||
|
||||
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
||||
send.debug(Main.plugin, "CGuiAPI: " + disableItemGiveOnJoin);
|
||||
send.debug(Main.getPlugin(), "CGuiAPI: " + disableItemGiveOnJoin);
|
||||
JoinDisable = disableItemGiveOnJoin;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,40 @@ Slots:
|
||||
- '&bLine 1'
|
||||
- '&bLine 2'
|
||||
- '&8-----------------'
|
||||
NoPermission:
|
||||
Message:
|
||||
# Here you can define if a message should be displayed when clicking on the function but not having a permission
|
||||
Enable: true
|
||||
# Here you can set a custom No Permission message for this function. If you want to use the default message, just leave this blank.
|
||||
#
|
||||
# You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes
|
||||
# You can use the hover module from T2Code:
|
||||
# You can add a hover and/or clickable feature to all messages sent to players.
|
||||
# Use /*/ to separate the message.
|
||||
# Use [nl] to set a line break in a message or hover.
|
||||
# Hover message: <message >/*/<hover>
|
||||
# Message with hover and click function: <message >/*/<hover>/*/<action>/*/<actionValue>
|
||||
# Message only with click function: <message >/*//*/<action>/*/<actionValue>
|
||||
# Action:
|
||||
# - OPEN_URL - Opens a URL under the path specified in ActionValue.
|
||||
# - OPEN_FILE - Opens a file under the path specified by ActionValue.
|
||||
# - RUN_COMMAND - Runs the command specified by ActionValue.
|
||||
# - SUGGEST_COMMAND - Inserts the string specified in ActionValue into the player text box.
|
||||
# - CHANGE_PAGE - Changes to the page number in a book specified by ActionValue.
|
||||
# - COPY_TO_CLIPBOARD - Copies the string specified by ActionValue to the player's clipboard.
|
||||
# You can also use MiniMessage:
|
||||
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html
|
||||
# WebUI: https://webui.adventure.kyori.net
|
||||
CustomNoPermMessage: ''
|
||||
Item:
|
||||
Lore:
|
||||
# Here you can select whether an extra lore should be displayed if you do not have permission for this function.
|
||||
Enable: true
|
||||
# Here you can set an extra lore that will be displayed if you do not have permission for this action.
|
||||
Lore:
|
||||
- '&8-----------------'
|
||||
- '&4No Permission for this Function'
|
||||
- '&8-----------------'
|
||||
CustomSound:
|
||||
# Here you can set whether a specific sound or the default sound from the config.yml should be used.
|
||||
Enable: false
|
||||
@ -98,6 +132,25 @@ Slots:
|
||||
Enable: false
|
||||
# Here you can set the messages to be sent to the player
|
||||
# Placeholder: [player] = PlayerName | [prefix] = PluginPrefix | [price] = price if function Cost is activated
|
||||
#
|
||||
# You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes
|
||||
# You can use the hover module from T2Code:
|
||||
# You can add a hover and/or clickable feature to all messages sent to players.
|
||||
# Use /*/ to separate the message.
|
||||
# Use [nl] to set a line break in a message or hover.
|
||||
# Hover message: <message >/*/<hover>
|
||||
# Message with hover and click function: <message >/*/<hover>/*/<action>/*/<actionValue>
|
||||
# Message only with click function: <message >/*//*/<action>/*/<actionValue>
|
||||
# Action:
|
||||
# - OPEN_URL - Opens a URL under the path specified in ActionValue.
|
||||
# - OPEN_FILE - Opens a file under the path specified by ActionValue.
|
||||
# - RUN_COMMAND - Runs the command specified by ActionValue.
|
||||
# - SUGGEST_COMMAND - Inserts the string specified in ActionValue into the player text box.
|
||||
# - CHANGE_PAGE - Changes to the page number in a book specified by ActionValue.
|
||||
# - COPY_TO_CLIPBOARD - Copies the string specified by ActionValue to the player's clipboard.
|
||||
# You can also use MiniMessage:
|
||||
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html
|
||||
# WebUI: https://webui.adventure.kyori.net
|
||||
Message:
|
||||
- 'Message line 1'
|
||||
- 'Message line 2'
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: CommandGUI
|
||||
name: T2C-CommandGUI
|
||||
version: ${project.version}
|
||||
main: de.jatitv.commandguiv2.Bungee.BMain
|
||||
author: JaTiTV
|
@ -1,8 +1,8 @@
|
||||
name: CommandGUI
|
||||
name: T2C-CommandGUI
|
||||
version: ${project.version}
|
||||
main: de.jatitv.commandguiv2.Spigot.Main
|
||||
api-version: 1.13
|
||||
prefix: CommandGUI
|
||||
prefix: T2C-CommandGUI
|
||||
authors: [ JaTiTV ]
|
||||
depend:
|
||||
- T2CodeLib
|
||||
|
Loading…
Reference in New Issue
Block a user