Merge pull request '2.8.0-Voting' (#12) from 2.8.0-Voting into main

Reviewed-on: JaTiTV/CommandGUI#12
This commit is contained in:
JaTiTV 2022-06-07 20:16:33 +02:00
commit 7f2b346f7b
23 changed files with 442 additions and 146 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId>
<version>2.7.7</version>
<version>2.8.0</version>
<packaging>jar</packaging>
<name>CommandGUI</name>
@ -85,7 +85,7 @@
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>11.9</version>
<version>12.0</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>

View File

@ -72,7 +72,8 @@ public final class Main extends JavaPlugin {
if (PluginCheck.plotSquaredGUI()) {
PlotSquaredGUI = true;
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
}if (PluginCheck.luckyBox()) {
}
if (PluginCheck.luckyBox()) {
LuckyBox = true;
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
}
@ -114,7 +115,7 @@ public final class Main extends JavaPlugin {
}
}
public static void sendTryCatch(Class c, StackTraceElement line){
public static void sendTryCatch(Class c, StackTraceElement line) {
send.error(plugin, c.getName() + " Line: " + line.getLineNumber());
}

View File

@ -1,6 +1,7 @@
package de.jatitv.commandguiv2.Spigot.cmdManagement;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.gui.CreateGUI;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Util;
@ -29,7 +30,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
Player player = (Player) sender;
Commands.gui(player);
} else {
if (args[0].equals("admin")) {
if (args[0].equals(SelectConfig.adminSubCommand)) {
if (args.length == 1) {
Help.sendHelp(sender, prefix);
return false;
@ -105,7 +106,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
List<String> list = new ArrayList<>();
Tab.tab(list, sender, 0, args, arg1);
Tab.tab(list, sender, 0, "admin", 1, args, arg2);
Tab.tab(list, sender, 0, SelectConfig.adminSubCommand, 1, args, arg2);
Tab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
// if (args.length == 1) {

View File

@ -212,6 +212,6 @@ public class Commands {
} else send.player(player,SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.key)
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
} else send.player(player,SelectMessages.GUIIsDisabled.replace("[gui]", gui.key));
} else send.player(player,SelectMessages.GUInotFound);
} else send.player(player,SelectMessages.guiNotFound);
}
}

View File

@ -32,6 +32,7 @@ public class ConfigCreate {
Config.set("Plugin.Debug", false, yamlConfiguration);
Config.set("Plugin.HelpAlias", true, yamlConfiguration);
Config.set("Plugin.AdminSubCommand", "admin", yamlConfiguration);
Config.set("Plugin.language", "english", yamlConfiguration);
Config.set("Plugin.Currency", "$", yamlConfiguration);
Config.set("Plugin.DefaultGUI", "default", yamlConfiguration);

View File

@ -19,6 +19,7 @@ import java.util.List;
public class SelectConfig {
public static Boolean Debug;
public static Boolean HelpAlias;
public static String adminSubCommand;
public static String language;
public static String Currency;
@ -129,6 +130,7 @@ public class SelectConfig {
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
HelpAlias = yamlConfiguration.getBoolean("Plugin.HelpAlias");
adminSubCommand = yamlConfiguration.getString("Plugin.AdminSubCommand");
language = yamlConfiguration.getString("Plugin.language");
Currency = yamlConfiguration.getString("Plugin.Currency");
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");

View File

@ -2,6 +2,8 @@ package de.jatitv.commandguiv2.Spigot.config.configConverter;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.functions.CreateFunctions;
import de.jatitv.commandguiv2.Spigot.system.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.system.FunctionVoteEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
@ -84,7 +86,6 @@ public class ConfigConverterUnderV5 {
String configFilePath = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.File.Path");
String configOptionPath = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Option.Path");
String configOptionPremat = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Option.Premat");
// Boolean ConfigChatInput = ;
String configStringValueLeft = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Value.LeftClick.String");
Boolean configBooleanValueLeft = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.Value.LeftClick.Boolean");
@ -103,10 +104,11 @@ public class ConfigConverterUnderV5 {
setNew(key, slotNumber, slotEnable, key, permRequired, yamlConfiguration);
CreateFunctions.createFunction(key, empty, itemAmount, playerHeadEnable, base64Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, itemMaterial, itemName, lore,
customSoundEnable, customSoundNoSound, customSoundSound, costEnable, price, commandEnable, commandBungeeCommand, commandAsConsole, command, serverChange,
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);
configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight, configListValueRight, pluginReloadEnable, pluginReloadCommand,
false, FunctionVoteEnum.ADD,0,false, FunctionItemEnum.REMOVE,"DIRT;5");
}
try {

View File

@ -1,6 +1,9 @@
package de.jatitv.commandguiv2.Spigot.config.functions;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.system.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.system.FunctionVoteEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import org.bukkit.configuration.file.YamlConfiguration;
@ -14,33 +17,35 @@ 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,
"", false, 0.0, false, false, false, Arrays.asList(), 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",
"", false, 0, 0.0, Arrays.asList(), "", false,
0, 0.0, Arrays.asList(), false, "");
0, 0.0, Arrays.asList(), false, "",
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
createFunction("SupportDiscord", false, 1, true, true, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19",
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"),
false, false, "", false, 0.0, false, false,
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, "",
"", "String", "", false, 0, 0.0, Arrays.asList(),
"", false, 0, 0.0, Arrays.asList(), false, "");
"", false, 0, 0.0, Arrays.asList(), false, "",
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
}
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,
Boolean costEnable, Double price, 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, String configFilePath, String configOptionPath,
String configOptionPremat, String configStringValueLeft, Boolean configBooleanValueLeft, Integer configIntegerValueLeft, Double configDoubleValueLeft,
List<String> configListValueLeft, String configStringValueRight, Boolean configBooleanValueRight, Integer configIntegerValueRight, Double configDoubleValueRight,
List<String> configListValueRight, Boolean pluginReloadEnable, String pluginReloadCommand) {
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,
String configFilePath, String configOptionPath, String configOptionPremat, String configStringValueLeft, Boolean configBooleanValueLeft,
Integer configIntegerValueLeft, Double configDoubleValueLeft, List<String> configListValueLeft, String configStringValueRight,
Boolean configBooleanValueRight, Integer configIntegerValueRight, Double configDoubleValueRight, List<String> configListValueRight,
Boolean pluginReloadEnable, String pluginReloadCommand, Boolean functionVotePoints, FunctionVoteEnum functionVotePointsMode,
Integer functionVotePointsAmount, Boolean functionItem, FunctionItemEnum functionItemMode, String functionItemItem) {
long long_ = System.currentTimeMillis();
File config = new File(Main.getPath(), "Functions/" + fileName + ".yml");
@ -50,7 +55,7 @@ public class CreateFunctions {
i++;
}
send.console(Main.prefix + " §4Function GUI file (Functions/" + config.getName() + ") is loaded...");
send.console(Util.getPrefix() + " §4Function GUI file (Functions/" + config.getName() + ") is loaded...");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
@ -70,7 +75,10 @@ public class CreateFunctions {
set("Slots.Function.CustomSound.NoSound", customSoundNoSound, yamlConfiguration);
set("Slots.Function.CustomSound.Sound", customSoundSound == null ? "" : customSoundSound, yamlConfiguration);
set("Slots.Function.Cost.Enable", costEnable, yamlConfiguration);
set("Slots.Function.Cost.Price", price, yamlConfiguration);
set("Slots.Function.Cost.EcoModule", ecoModule, yamlConfiguration);
set("Slots.Function.Cost.Item", ecoItem, yamlConfiguration);
set("Slots.Function.Cost.VotePoints", ecoVotePoints, yamlConfiguration);
set("Slots.Function.Cost.Price", ecoPrice, yamlConfiguration);
set("Slots.Function.Command.Enable", commandEnable, yamlConfiguration);
set("Slots.Function.Command.BungeeCommand", commandBungeeCommand, yamlConfiguration);
set("Slots.Function.Command.CommandAsConsole", commandAsConsole, yamlConfiguration);
@ -104,12 +112,20 @@ public class CreateFunctions {
set("Slots.Function.SetConfig.PluginReload.Enable", pluginReloadEnable, yamlConfiguration);
set("Slots.Function.SetConfig.PluginReload.Command", pluginReloadCommand == null ? "" : pluginReloadCommand, yamlConfiguration);
set("Slots.Function.FunctionVotePoints.Enable", functionVotePoints, yamlConfiguration);
set("Slots.Function.FunctionVotePoints.Mode", functionVotePointsMode.toString(), yamlConfiguration);
set("Slots.Function.FunctionVotePoints.Amount", functionVotePointsAmount, yamlConfiguration);
set("Slots.Function.FunctionItem.Enable", functionItem, yamlConfiguration);
set("Slots.Function.FunctionItem.Mode", functionItemMode.toString(), yamlConfiguration);
set("Slots.Function.FunctionItem.Item", functionItemItem, yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
send.console(Main.prefix + " §2Function file (Functions/" + config.getName() + ") was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
send.console(Util.getPrefix() + " §2Function file (Functions/" + config.getName() + ") was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}

View File

@ -1,6 +1,7 @@
package de.jatitv.commandguiv2.Spigot.config.languages;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
@ -46,7 +47,9 @@ public class LanguagesCreate {
set("UseItem.DisabledInWorld", MSG.EN_UseItemDisabledInWorld, yamlConfigurationEN);
set("Cost.Buy_msg", MSG.EN_Buy_msg, yamlConfigurationEN);
set("Cost.No_money", MSG.EN_No_money, yamlConfigurationEN);
set("Cost.No.Money", MSG.EN_No_money, yamlConfigurationEN);
set("Cost.No.Item", MSG.EN_No_moneyItem, yamlConfigurationEN);
set("Cost.No.Vote", MSG.EN_No_moneyVote, yamlConfigurationEN);
set("Cost.NoInventorySpace", MSG.EN_NoInventorySpace, yamlConfigurationEN);
set("ServerChange.onServerChange", MSG.EN_onServerChange, yamlConfigurationEN);
@ -60,6 +63,14 @@ public class LanguagesCreate {
set("Player.PlayerNotFond", MSG.EN_PlayerNotFond, yamlConfigurationEN);
set("Player.PlayerNoInventorySpace", MSG.EN_PlayerNoInventorySpace, yamlConfigurationEN);
set("FunctionItem.Add", MSG.EN_FunctionItemAdd,yamlConfigurationEN);
set("FunctionItem.Remove", MSG.EN_FunctionItemRemove,yamlConfigurationEN);
set("FunctionItem.RemoveError", MSG.EN_FunctionItemRemoveError,yamlConfigurationEN);
set("FunctionVote.Add", MSG.EN_FunctionVoteAdd,yamlConfigurationEN);
set("FunctionVote.Remove", MSG.EN_FunctionVoteRemove,yamlConfigurationEN);
set("FunctionVote.RemoveError", MSG.EN_FunctionVoteRemoveError,yamlConfigurationEN);
set("Help.CGUI", MSG.EN_Help_CGUI, yamlConfigurationEN);
set("Help.Help", MSG.EN_Help_Help, yamlConfigurationEN);
set("Help.Info", MSG.EN_Help_Info, yamlConfigurationEN);
@ -121,7 +132,9 @@ public class LanguagesCreate {
set("UseItem.DisabledInWorld", MSG.DE_UseItemDisabledInWorld, yamlConfigurationDE);
set("Cost.Buy_msg", MSG.DE_Buy_msg, yamlConfigurationDE);
set("Cost.No_money", MSG.DE_No_money, yamlConfigurationDE);
set("Cost.No.Money", MSG.DE_No_money, yamlConfigurationDE);
set("Cost.No.Item", MSG.DE_No_moneyItem, yamlConfigurationDE);
set("Cost.No.Vote", MSG.DE_No_moneyVote, yamlConfigurationDE);
set("Cost.NoInventorySpace", MSG.DE_NoInventorySpace, yamlConfigurationDE);
set("ServerChange.onServerChange", MSG.DE_onServerChange, yamlConfigurationDE);
@ -135,6 +148,14 @@ public class LanguagesCreate {
set("Player.PlayerNotFond", MSG.DE_PlayerNotFond, yamlConfigurationDE);
set("Player.PlayerNoInventorySpace", MSG.DE_PlayerNoInventorySpace, yamlConfigurationDE);
set("FunctionItem.Add", MSG.DE_FunctionItemAdd,yamlConfigurationDE);
set("FunctionItem.Remove", MSG.DE_FunctionItemRemove,yamlConfigurationDE);
set("FunctionItem.RemoveError", MSG.DE_FunctionItemRemoveError,yamlConfigurationDE);
set("FunctionVote.Add", MSG.DE_FunctionVoteAdd,yamlConfigurationDE);
set("FunctionVote.Remove", MSG.DE_FunctionVoteRemove,yamlConfigurationDE);
set("FunctionVote.RemoveError", MSG.DE_FunctionVoteRemoveError,yamlConfigurationDE);
set("Help.CGUI", MSG.DE_Help_CGUI, yamlConfigurationDE);
set("Help.Help", MSG.DE_Help_Help, yamlConfigurationDE);
set("Help.Info", MSG.DE_Help_Info, yamlConfigurationDE);
@ -197,7 +218,9 @@ public class LanguagesCreate {
set("UseItem.DisabledInWorld", MSG.NO_UseItemDisabledInWorld, yamlConfigurationNO);
set("Cost.Buy_msg", MSG.NO_Buy_msg, yamlConfigurationNO);
set("Cost.No_money", MSG.NO_No_money, yamlConfigurationNO);
set("Cost.No.Money", MSG.NO_No_money, yamlConfigurationNO);
set("Cost.No.Item", MSG.NO_No_moneyItem, yamlConfigurationNO);
set("Cost.No.Vote", MSG.NO_No_moneyVote, yamlConfigurationNO);
set("Cost.NoInventorySpace", MSG.NO_NoInventorySpace, yamlConfigurationNO);
set("ServerChange.onServerChange", MSG.NO_onServerChange, yamlConfigurationNO);
@ -211,6 +234,14 @@ public class LanguagesCreate {
set("Player.PlayerNotFond", MSG.NO_PlayerNotFond, yamlConfigurationNO);
set("Player.PlayerNoInventorySpace", MSG.NO_PlayerNoInventorySpace, yamlConfigurationNO);
set("FunctionItem.Add", MSG.NO_FunctionItemAdd,yamlConfigurationNO);
set("FunctionItem.Remove", MSG.NO_FunctionItemRemove,yamlConfigurationNO);
set("FunctionItem.RemoveError", MSG.NO_FunctionItemRemoveError,yamlConfigurationNO);
set("FunctionVote.Add", MSG.NO_FunctionVoteAdd,yamlConfigurationNO);
set("FunctionVote.Remove", MSG.NO_FunctionVoteRemove,yamlConfigurationNO);
set("FunctionVote.RemoveError", MSG.NO_FunctionVoteRemoveError,yamlConfigurationNO);
set("Help.CGUI", MSG.NO_Help_CGUI, yamlConfigurationNO);
set("Help.Help", MSG.NO_Help_Help, yamlConfigurationNO);
set("Help.Info", MSG.NO_Help_Info, yamlConfigurationNO);
@ -241,7 +272,7 @@ public class LanguagesCreate {
}
send.console(Main.prefix + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
send.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
}
private static void set(String path, String value, YamlConfiguration config) {

View File

@ -27,7 +27,9 @@ public class MSG {
public static String EN_NoPermissionForItem = "[prefix] &cFor &b[item] &cyou lack the permission &6[perm]&c!";
public static String EN_Buy_msg = "[prefix] &2You bought [itemname] &2for &6[price]&2.";
public static String EN_No_money = "[prefix] &cYou don't have enough money!";
public static String EN_No_money = "[prefix] &cYou don't have enough money!/*/&cYou need: &6[price]&c.";
public static String EN_No_moneyItem = "[prefix] &cYou don't have enough items of &6[item] &cin your inventory!/*/&cYou need: &6[amount]&c.";
public static String EN_No_moneyVote = "[prefix] &cYou do not have enough vote points!/*/&cYou need: &6[amount]&c.";
public static String EN_NoInventorySpace = "[prefix] &cYou have no room in your inventory!";
public static String EN_onServerChange = "[prefix] &2You will be connected to the server &e[server]§2.";
@ -50,6 +52,14 @@ public class MSG {
public static String EN_PlayerNotFond = "[prefix] &cThe player &6[player] &cwas not found or is not online!";
public static String EN_PlayerNoInventorySpace = "[prefix] &6[player] &chas no free space in his inventory!";
public static String EN_FunctionItemAdd = "[prefix] &2You have &6[amount] [item] &2placed in your inventory.";
public static String EN_FunctionItemRemove = "[prefix] &2You have been &6[amount] [item] &2removed.";
public static String EN_FunctionItemRemoveError = "[prefix] &cYou don't have so many items!/*/&cYou need &6[amount] [item]&c!";
public static String EN_FunctionVoteAdd = "[prefix] &2You were given &6[amount] &2Vote points.";
public static String EN_FunctionVoteRemove = "[prefix] &2You have been removed &6[amount] &2Vote points.";
public static String EN_FunctionVoteRemoveError = "[prefix] &cYou don't have so many VotePoints!/*/&cYou need &6[amount]&c!";
public static String EN_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &eOpen the default GUI &7(&r[gui]&7)&e.";
public static String EN_Help_Open = "&8''&b/commandgui [gui]&8'' &eOpen the GUI: &6[guiname]&e.";
public static String EN_Help_Help = "&8''&b/commandguihelp&8'' &eOpen this help.";
@ -96,7 +106,9 @@ public class MSG {
public static String DE_UseItemDisabledInWorld = "[prefix] &cDas UseItem ist in dieser Welt deaktiviert!";
public static String DE_Buy_msg = "[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft.";
public static String DE_No_money = "[prefix] &cDu hast nicht gen[ue]gend Geld!";
public static String DE_No_money = "[prefix] &cDu hast nicht gen[ue]gend Geld!/*/&cDu ben[oe]tigst [price].";
public static String DE_No_moneyItem = "[prefix] &cDu hast nicht gen[ue]gent Items von &6[item] &cim Inventar!/*/&cDu ben[oe]tigst: &6[amount]&c.";
public static String DE_No_moneyVote = "[prefix] &cDu hast nicht gen[ue]gent Vote Punkte!/*/&cDu ben[oe]tigst: &6[amount]&c.";
public static String DE_NoInventorySpace = "[prefix] &cDu hast keinen Platz in deinem Inventar!";
public static String DE_onServerChange = "[prefix] &2Du wirst auf den Server §e[server] §2verbunden.";
@ -110,6 +122,14 @@ public class MSG {
public static String DE_PlayerNotFond = "[prefix] &cDer Spieler &6[player] &cwurde nicht gefunden oder ist nicht Online!";
public static String DE_PlayerNoInventorySpace = "[prefix] &6[player] &chat keinen freien Platz in seinem Inventar!";
public static String DE_FunctionItemAdd = "[prefix] &2Dir wurden &6[amount] [item] &2in dein Inventar gelegt.";
public static String DE_FunctionItemRemove = "[prefix] &2Dir wurden &6[amount] [item] &2entfernt.";
public static String DE_FunctionItemRemoveError = "[prefix] &cDu hast nicht so viele Items!/*/&cDu benötigets &6[amount] [item]&c!";
public static String DE_FunctionVoteAdd = "[prefix] &2Dir wurden &6[amount] &2Vote Punkte gegeben.";
public static String DE_FunctionVoteRemove = "[prefix] &2Dir wurden &6[amount] &2Vote Punkte entfernt.";
public static String DE_FunctionVoteRemoveError = "[prefix] &cDu hast nicht so viele VotePunkte!/*/&cDu benötigets &6[amount]&c!";
public static String DE_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &e[OE]ffne die default GUI &7(&r[gui]&7)&e.";
public static String DE_Help_Open = "&8''&b/commandgui [gui]&8'' &e[OE]ffne die GUI: &6[guiname]&e.";
public static String DE_Help_Help = "&8''&b/commandguihelp&8'' &e[OE]ffne diese help.";
@ -135,6 +155,8 @@ public class MSG {
public static String DE_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eStelle den Slot ein, auf den du das GUIItem haben möchtest./*/SUGGEST_COMMAND/*//gui-item slot ";
// FR
@ -161,7 +183,9 @@ public class MSG {
public static String NO_UseItemDisabledInWorld = "[prefix] &cUseItem er deaktivert i denne verden!";
public static String NO_Buy_msg = "[prefix] &2Du kjøpte [itemname] &2for &6[price]&2.";
public static String NO_No_money = "[prefix] &cDu har ikke nok penger!";
public static String NO_No_money = "[prefix] &cDu har ikke nok penger!/*/&cDu trenger &6[price]&c.";
public static String NO_No_moneyItem = "[prefix] &cDu har ikke nok varer av &6[item] &ci inventaret ditt!/*/&cDu trenger: &6[amount]&c.";
public static String NO_No_moneyVote = "[prefix] &cDu har ikke nok stemmepoeng!/*/&cDu trenger: &6[amount]&c.";
public static String NO_NoInventorySpace = "[prefix] &cDu har ikke nok plass i inventaret ditt!";
public static String NO_onServerChange = "[prefix] &2Du vil bli tilkoblet serveren &e[server]&2.";
@ -175,6 +199,14 @@ public class MSG {
public static String NO_PlayerNotFond = "[prefix] &cSpilleren &6[player] &cble ikke funnet eller er ikke pålogget!";
public static String NO_PlayerNoInventorySpace = "[prefix] &6[player] &char ikke nok plass i inventaret sitt!";
public static String NO_FunctionItemAdd = "[prefix] &2Du har &6[amount] [item] &2plassert i beholdningen din.";
public static String NO_FunctionItemRemove = "[prefix] &2Du har blitt &6[amount] [item] &2fjernet.";
public static String NO_FunctionItemRemoveError = "[prefix] &cDu har ikke så mange varer!/*/&cDu trenger &6[amount] [item]&c!";
public static String NO_FunctionVoteAdd = "[prefix] &2Du fikk &6[amount] &2stemmepoeng.";
public static String NO_FunctionVoteRemove = "[prefix] &2Du har blitt fjernet &6[amount] &2Stemmepoeng.";
public static String NO_FunctionVoteRemoveError = "[prefix] &cDu har ikke så mange stemmepoeng!/*/&cDu trenger &6[amount]&c!";
public static String NO_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &eÅpne default GUIen &7(&r[gui]&7)&e.";
public static String NO_Help_Open = "&8''&b/commandgui [gui]&8'' &eÅpne GUIen: &6[guiname]&e.";
public static String NO_Help_Help = "&8''&b/commandguihelp&8'' &eSender denne hjelpe meldingen.";

View File

@ -37,12 +37,14 @@ public class SelectMessages {
public static String UseItemDisabledInWorld;
public static String Buy_msg;
public static String No_money;
public static String noMoney;
public static String noMoneyItem;
public static String noMoneyVote;
public static String NoInventorySpace;
public static String onServerChange;
public static String GUInotFound;
public static String guiNotFound;
public static String GUIIsDisabled;
public static String Give_Sender;
@ -51,6 +53,13 @@ public class SelectMessages {
public static String PlayerNotFond;
public static String PlayerNoInventorySpace;
public static String functionItemAdd;
public static String functionItemRemove;
public static String functionItemRemoveError;
public static String functionVoteAdd;
public static String functionVoteRemove;
public static String functionVoteRemoveError;
public static String HelpCgui;
public static String HelpHelp;
public static String HelpInfo;
@ -110,16 +119,19 @@ public class SelectMessages {
ItemSlotNotEmpty = select("UseItem.SlotNotEmpty", yamlConfiguration_msg);
ItemSlotAlreadySet = select("UseItem.SlotAlreadySet", yamlConfiguration_msg);
ItemSlot_wrongValue = select("UseItem.ItemSlot_wrongValue", yamlConfiguration_msg);
UseItemDisabledInGameMode =select("UseItem.DisabledInGameMode",yamlConfiguration_msg);
UseItemDisabledInWorld =select("UseItem.DisabledInWorld",yamlConfiguration_msg);
UseItemDisabledInGameMode = select("UseItem.DisabledInGameMode", yamlConfiguration_msg);
UseItemDisabledInWorld = select("UseItem.DisabledInWorld", yamlConfiguration_msg);
Buy_msg = select("Cost.Buy_msg", yamlConfiguration_msg);
No_money = select("Cost.No_money", yamlConfiguration_msg);
noMoney = select("Cost.No.Money", yamlConfiguration_msg);
noMoneyItem = select("Cost.No.Item", yamlConfiguration_msg);
noMoneyVote = select("Cost.No.Vote", yamlConfiguration_msg);
NoInventorySpace = select("Cost.NoInventorySpace", yamlConfiguration_msg);
onServerChange = select("ServerChange.onServerChange", yamlConfiguration_msg);
GUInotFound = select("GUI.GUInotFound", yamlConfiguration_msg);
guiNotFound = select("GUI.GUInotFound", yamlConfiguration_msg);
GUIIsDisabled = select("GUI.GUIisDisabled", yamlConfiguration_msg);
Give_Sender = select("Give.Sender", yamlConfiguration_msg);
@ -128,6 +140,14 @@ public class SelectMessages {
PlayerNotFond = select("Player.PlayerNotFond", yamlConfiguration_msg);
PlayerNoInventorySpace = select("Player.PlayerNoInventorySpace", yamlConfiguration_msg);
functionItemAdd = select("FunctionItem.Add", yamlConfiguration_msg);
functionItemRemove = select("FunctionItem.Remove", yamlConfiguration_msg);
functionItemRemoveError = select("FunctionItem.RemoveError", yamlConfiguration_msg);
functionVoteAdd = select("FunctionVote.Add", yamlConfiguration_msg);
functionVoteRemove = select("FunctionVote.Remove", yamlConfiguration_msg);
functionVoteRemoveError = select("FunctionVote.RemoveError", yamlConfiguration_msg);
HelpCgui = select("Help.CGUI", yamlConfiguration_msg);
HelpHelp = select("Help.Help", yamlConfiguration_msg);
HelpInfo = select("Help.Info", yamlConfiguration_msg);
@ -154,7 +174,7 @@ public class SelectMessages {
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
private static String select(String path, YamlConfiguration yamlConfiguration){
private static String select(String path, YamlConfiguration yamlConfiguration) {
return Replace.replace(Util.getPrefix(), Objects.requireNonNull(yamlConfiguration.getString(path)));
}
}

View File

@ -75,6 +75,7 @@ public class OpenGUI {
GuiBuilder.fillItem(inventory, gui);
}
for (Slot slot : gui.slots) {
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!");
@ -118,6 +119,12 @@ public class OpenGUI {
}
}
} catch (Exception ex){
ex.printStackTrace();
ItemStack air = new ItemStack(Material.AIR);
inventory.setItem(slot.slot, air);
}
}
if (sound) {
if (SelectConfig.Sound_Enable && SelectConfig.Sound_OpenInventory_Enable) {

View File

@ -10,12 +10,13 @@ import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.system.FunctionVoteEnum;
import de.jatitv.commandguiv2.Spigot.system.Placeholder;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.eco.Eco;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.replace.Replace;
import net.t2code.lib.Spigot.Lib.vault.Vault;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -25,12 +26,14 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
public class GUIListener implements Listener {
@ -56,11 +59,11 @@ public class GUIListener implements Listener {
}
private static void execute(InventoryClickEvent e, Slot slot, Player player, Gui gui) {
Function function = Main.functionHashMap.get(slot.function);
if (e.getSlot() != slot.slot) return;
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))
send.player(player, SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name))
.replace("[perm]", slot.permissionToUse));
return;
}
@ -69,28 +72,25 @@ public class GUIListener implements Listener {
e.getCurrentItem().getType() == Material.valueOf(function.item.toUpperCase().replace(".", "_"))) {
if (!slot.enable) return;
if (function.cost_Enable) {
if (function.command_Enable || function.message_Enable || function.openGUI_Enable || function.serverChange) {
if (functions(function)) {
eco(e, slot, player, gui, function);
}
} else {
execute(function, slot, player, e, gui);
}
}
}
if (!Vault.buy(prefix, player, function.price)) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
send.player(player,SelectMessages.No_money);
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable)
player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
} else {
send.player(player,SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
.replace("[price]", function.price + " " + SelectConfig.Currency));
execute(function, slot, player, e, gui);
}
}
} else {
execute(function, slot, player, e, gui);
}
}
private static boolean functions(Function function) {
if (function.togglePermission) return true;
if (function.toggleUseItem) return true;
if (function.command_Enable) return true;
if (function.openGUI_Enable) return true;
if (function.message_Enable) return true;
if (function.serverChange) return true;
if (function.setConfigEnable) return true;
if (function.functionVotePoints) return true;
return function.functionItem;
}
private static void execute(Function function, Slot slot, Player player, InventoryClickEvent e, Gui gui) {
@ -101,16 +101,13 @@ public class GUIListener implements Listener {
if (function.message_Enable) message(function, player);
if (function.serverChange) serverChange(function, player);
if (function.setConfigEnable) setConfig(function, player, e);
if (function.functionVotePoints) votePoints(e, function, player);
if (function.functionItem) item(function, player);
if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) sound(function, slot, player, gui);
}
private static void command(Function slot, Player player) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
new BukkitRunnable() {
@Override
public void run() {
@ -145,12 +142,7 @@ public class GUIListener implements Listener {
}
private static void message(Function slot, Player player) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
for (String msg : slot.message) {
if (Main.PaPi) {
if (slot.cost_Enable) {
@ -185,33 +177,49 @@ public class GUIListener implements Listener {
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (e.getClick() == ClickType.LEFT) {
if (slot.configOptionPremat.equals("String")) {
switch (slot.configOptionPremat) {
case "String":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueLeft);
} else if (slot.configOptionPremat.equals("Boolean")) {
break;
case "Boolean":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueLeft);
} else if (slot.configOptionPremat.equals("Integer")) {
break;
case "Integer":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueLeft);
} else if (slot.configOptionPremat.equals("Double")) {
break;
case "Double":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueLeft);
} else if (slot.configOptionPremat.equals("List")) {
break;
case "List":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueLeft);
} else {
send.player(player,"§cCheck the Option §6SetConfig/Option/Premat"); //todo
break;
default:
send.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
break;
}
}
if (e.getClick() == ClickType.RIGHT) {
if (slot.configOptionPremat.equals("String")) {
switch (slot.configOptionPremat) {
case "String":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueRight);
} else if (slot.configOptionPremat.equals("Boolean")) {
break;
case "Boolean":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueRight);
} else if (slot.configOptionPremat.equals("Integer")) {
break;
case "Integer":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueRight);
} else if (slot.configOptionPremat.equals("Double")) {
break;
case "Double":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueRight);
} else if (slot.configOptionPremat.equals("List")) {
break;
case "List":
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueRight);
} else {
send.player(player,"§cCheck the Option §6SetConfig/Option/Premat"); //todo
break;
default:
send.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
break;
}
}
try {
@ -279,4 +287,94 @@ public class GUIListener implements Listener {
}
}.runTaskLater(plugin, 2L);
}
private static void votePoints(InventoryClickEvent e, Function function, Player player) {
player.closeInventory();
switch (function.functionVotePointsMode) {
case ADD:
Eco.votePointsAdd(prefix, player, function.functionVotePointsAmount);
send.player(player, SelectMessages.functionVoteAdd.replace("[amount]", function.functionVotePointsAmount.toString()));
break;
case REMOVE:
if (Eco.votePointsRemove(prefix, player, function.functionVotePointsAmount)) {
send.player(player, SelectMessages.functionVoteRemove.replace("[amount]", function.functionVotePointsAmount.toString()));
} else send.player(player, SelectMessages.functionVoteRemoveError.replace("[amount]", function.functionVotePointsAmount.toString()));
break;
}
}
private static void item(Function function, Player player) {
String[] item = function.functionItemItem.split(";");
player.closeInventory();
switch (function.functionItemMode) {
case ADD:
Eco.itemAdd(player, item[0], Integer.parseInt(item[1]));
send.player(player, SelectMessages.functionItemAdd.replace("[amount]", item[1]).replace("[item]", item[0]));
break;
case REMOVE:
if (Eco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
send.player(player, SelectMessages.functionItemRemove.replace("[amount]", item[1]).replace("[item]", item[0]));
} else send.player(player, SelectMessages.functionItemRemoveError.replace("[amount]", item[1]));
break;
}
}
private static void eco(InventoryClickEvent e, Slot slot, Player player, Gui gui, Function function) {
switch (function.ecoModule) {
case ITEM:
String[] item = function.ecoItem.split(";");
if (!Eco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
send.player(player, SelectMessages.noMoneyItem.replace("[item]", item[0]).replace("[amount]", item[1]));
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable)
player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
} else {
send.player(player, SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
.replace("[price]", item[1] + " " + item[0]));
execute(function, slot, player, e, gui);
}
break;
case VOTEPOINTS:
if (!Eco.votePointsRemove(prefix, player, function.votePoints)) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
send.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable)
player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
} else {
send.player(player, SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
.replace("[price]", function.votePoints + " VotePoints"));
execute(function, slot, player, e, gui);
}
break;
case VAULT:
case MONEY:
if (!Eco.moneyRemove(prefix, player, function.price)) {
new BukkitRunnable() {
@Override
public void run() {
player.closeInventory();
}
}.runTaskLater(plugin, 1L);
send.player(player, Replace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable)
player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
} else {
send.player(player, SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name))
.replace("[price]", function.price + " " + SelectConfig.Currency));
execute(function, slot, player, e, gui);
}
break;
}
}
}

View File

@ -17,7 +17,7 @@ import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.scheduler.BukkitRunnable;
public class PluginEvent implements Listener {
private static String prefix = Main.prefix;
private static String prefix = Util.getPrefix();
@EventHandler
public void onJoinEvent(PlayerLoginEvent event) {

View File

@ -5,6 +5,10 @@ import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.system.Debug;
import de.jatitv.commandguiv2.Spigot.system.EcoEnum;
import de.jatitv.commandguiv2.Spigot.system.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.system.FunctionVoteEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
@ -117,6 +121,18 @@ public class Obj_Select {
Boolean customSound_NoSound = yamlConfiguration.getBoolean("Slots.Function.CustomSound.NoSound");
String customSound_Sound = yamlConfiguration.getString("Slots.Function.CustomSound.Sound");
Boolean cost_Enable = yamlConfiguration.getBoolean("Slots.Function.Cost.Enable");
EcoEnum ecoModule = null;
if (yamlConfiguration.get("Slots.Function.Cost.EcoModule") != null) {
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 "
+ config.getName() + " does not exist. Please use one of the supported modules. (VAULT, ITEM, VOTEPOINTS)");
}
} else ecoModule = EcoEnum.VAULT;
String ecoItem = yamlConfiguration.getString("Slots.Function.Cost.Item");
Integer votePoints = yamlConfiguration.getInt("Slots.Function.Cost.VotePoints");
Double price = yamlConfiguration.getDouble("Slots.Function.Cost.Price");
Boolean command_Enable = yamlConfiguration.getBoolean("Slots.Function.Command.Enable");
Boolean command_BungeeCommand = yamlConfiguration.getBoolean("Slots.Function.Command.BungeeCommand");
@ -153,13 +169,32 @@ public class Obj_Select {
Boolean pluginReloadEnable = yamlConfiguration.getBoolean("Slots.Function.SetConfig.PluginReload.Enable");
String pluginReloadCommand = yamlConfiguration.getString("Slots.Function.SetConfig.PluginReload.Command");
Boolean functionVotePoints = yamlConfiguration.getBoolean("Slots.Function.FunctionVotePoints.Enable");
FunctionVoteEnum functionVotePointsMode = null;
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 "
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
}
Integer functionVotePointsAmount = yamlConfiguration.getInt("Slots.Function.FunctionVotePoints.Amount");
Boolean functionItem = yamlConfiguration.getBoolean("Slots.Function.FunctionItem.Enable");
FunctionItemEnum functionItemMode = null;
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 "
+ 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,
customSound_Enable, customSound_NoSound, customSound_Sound, cost_Enable, 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,
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,
configDoubleValueLeft, configListValueLeft, configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight,
configListValueRight, pluginReloadEnable, pluginReloadCommand);
configListValueRight, pluginReloadEnable, pluginReloadCommand, functionVotePoints, functionVotePointsMode, functionVotePointsAmount,
functionItem, functionItemMode, functionItemItem);
Main.functionHashMap.put(key, function);
try {

View File

@ -1,5 +1,9 @@
package de.jatitv.commandguiv2.Spigot.objects.functions;
import de.jatitv.commandguiv2.Spigot.system.EcoEnum;
import de.jatitv.commandguiv2.Spigot.system.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.system.FunctionVoteEnum;
import java.util.List;
public class Function {
@ -14,11 +18,14 @@ public class Function {
public String playerName;
public String item;
public String name;
public List lore;
public List<String> lore;
public Boolean customSound_Enable;
public Boolean customSound_NoSound;
public String customSound_Sound;
public Boolean cost_Enable;
public EcoEnum ecoModule;
public String ecoItem;
public Integer votePoints;
public Double price;
public Boolean command_Enable;
public Boolean command_BungeeCommand;
@ -54,6 +61,12 @@ public class Function {
public Boolean pluginReloadEnable;
public String pluginReloadCommand;
public Boolean functionVotePoints;
public FunctionVoteEnum functionVotePointsMode;
public Integer functionVotePointsAmount;
public Boolean functionItem;
public FunctionItemEnum functionItemMode;
public String functionItemItem;
public Function(String key,
Boolean empty,
@ -70,6 +83,9 @@ public class Function {
Boolean customSound_NoSound,
String customSound_Sound,
Boolean cost_Enable,
EcoEnum ecoModule,
String ecoItem,
Integer votePoints,
Double price,
Boolean command_Enable,
Boolean command_BungeeCommand,
@ -102,7 +118,13 @@ public class Function {
List<String> configListValueRight,
Boolean pluginReloadEnable,
String pluginReloadCommand) {
String pluginReloadCommand,
Boolean functionVotePoints,
FunctionVoteEnum functionVotePointsMode,
Integer functionVotePointsAmount,
Boolean functionItem,
FunctionItemEnum functionItemMode,
String functionItemItem) {
this.key = key;
this.empty = empty;
this.itemAmount = itemAmount;
@ -118,6 +140,9 @@ public class Function {
this.customSound_NoSound = customSound_NoSound;
this.customSound_Sound = customSound_Sound;
this.cost_Enable = cost_Enable;
this.ecoModule = ecoModule;
this.ecoItem = ecoItem;
this.votePoints = votePoints;
this.price = price;
this.command_Enable = command_Enable;
this.command_BungeeCommand = command_BungeeCommand;
@ -154,6 +179,13 @@ public class Function {
this.pluginReloadEnable = pluginReloadEnable;
this.pluginReloadCommand = pluginReloadCommand;
this.functionVotePoints = functionVotePoints;
this.functionVotePointsMode = functionVotePointsMode;
this.functionVotePointsAmount = functionVotePointsAmount;
this.functionItem = functionItem;
this.functionItemMode = functionItemMode;
this.functionItemItem = functionItemItem;
}
}

View File

@ -0,0 +1,7 @@
package de.jatitv.commandguiv2.Spigot.system;
public enum EcoEnum {
VAULT, MONEY,
ITEM,
VOTEPOINTS
}

View File

@ -0,0 +1,6 @@
package de.jatitv.commandguiv2.Spigot.system;
public enum FunctionItemEnum {
REMOVE, ADD
}

View File

@ -0,0 +1,5 @@
package de.jatitv.commandguiv2.Spigot.system;
public enum FunctionVoteEnum {
REMOVE, ADD
}

View File

@ -50,7 +50,7 @@ public class UseItem {
ItemStack item = null;
if (SelectConfig.UseItem_PlayerHead_Enable) {
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
send.player(player, Main.prefix + "§c Playerheads for UseItem are only available from version §61.13§c!");
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!");
} else {
item = ItemVersion.getHeadIS();

View File

@ -4,6 +4,7 @@ import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.Bukkit;
@ -37,9 +38,9 @@ public class MySQL {
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
ds = new HikariDataSource(config);
send.console(Main.prefix + " §2MYSQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
send.console(Util.getPrefix() + " §2MYSQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} catch (Exception ex) {
send.console(Main.prefix + " §4MYSQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
send.console(Util.getPrefix() + " §4MYSQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
send.error(Main.plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
}

View File

@ -1,10 +1,8 @@
package de.jatitv.commandguiv2;
import net.t2code.lib.Spigot.Lib.messages.send;
public class Util {
private static Integer configVersion = 5;
private static double requiredT2CodeLibVersion = 11.9;
private static double requiredT2CodeLibVersion = 12.0;
private static String Prefix = "§8[§4C§9GUI§8]";
private static Integer SpigotID = 90671;
private static Integer BstatsID = 10840;

View File

@ -10,6 +10,7 @@ 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 de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -70,7 +71,7 @@ public class CGuiAPI {
}
public static void sendHelp(CommandSender sender) {
Help.sendHelp(sender, Main.prefix);
Help.sendHelp(sender, Util.getPrefix());
}
public static void sendPluginInfo(CommandSender sender) {