-	Add „Plugin.Prefix“ in cofig.yml
-	Add Function: „Slots.Function.CloseGUI.Enable“ – With this function you can create a button to close the GUI
This commit is contained in:
JaTiTV 2024-05-17 01:17:29 +02:00
parent 7768530c19
commit 36e6702e8b
12 changed files with 84 additions and 23 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId> <artifactId>CommandGUI_V2</artifactId>
<version>2.8.16</version> <version>2.8.18</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>T2C-CommandGUI</name> <name>T2C-CommandGUI</name>
@ -76,7 +76,7 @@
<dependency> <dependency>
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId> <artifactId>T2CodeLib</artifactId>
<version>16.2</version> <version>16.4</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -37,6 +37,7 @@ public class ConfigCreate {
T2Cconfig.set("Plugin.language", "english", yamlConfiguration); T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
T2Cconfig.set("Plugin.Currency", "$", yamlConfiguration); T2Cconfig.set("Plugin.Currency", "$", yamlConfiguration);
T2Cconfig.set("Plugin.DefaultGUI", "default", yamlConfiguration); T2Cconfig.set("Plugin.DefaultGUI", "default", yamlConfiguration);
T2Cconfig.set("Plugin.Prefix", "&8[&4C&9GUI&8]", yamlConfiguration);
if (Main.legacy){ if (Main.legacy){
T2Cconfig.set("Storage.Type", "YML", yamlConfiguration); T2Cconfig.set("Storage.Type", "YML", yamlConfiguration);

View File

@ -4,6 +4,7 @@ import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter; import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages; import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Util; import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace; import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion; import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
@ -14,6 +15,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
public class SelectConfig { public class SelectConfig {
public static void onSelect() { public static void onSelect() {
@ -32,6 +34,9 @@ public class SelectConfig {
if (yamlConfiguration.getInt("ConfigVersion") < 6) { if (yamlConfiguration.getInt("ConfigVersion") < 6) {
ConfigConverter.removeBungeeOption(); ConfigConverter.removeBungeeOption();
} }
if (yamlConfiguration.getInt("ConfigVersion") < 7) {
ConfigConverter.convert7();
}
} }
Debug = yamlConfiguration.getBoolean("Plugin.Debug"); Debug = yamlConfiguration.getBoolean("Plugin.Debug");
@ -43,6 +48,7 @@ public class SelectConfig {
language = yamlConfiguration.getString("Plugin.language"); language = yamlConfiguration.getString("Plugin.language");
Currency = yamlConfiguration.getString("Plugin.Currency"); Currency = yamlConfiguration.getString("Plugin.Currency");
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI"); DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");
prefix = T2Creplace.replace("", Objects.requireNonNull(yamlConfiguration.getString("Plugin.Prefix")));
storage = yamlConfiguration.getString("Storage.Type").toUpperCase(); storage = yamlConfiguration.getString("Storage.Type").toUpperCase();
@ -191,7 +197,7 @@ public class SelectConfig {
Sound_OpenInventory = sound_OpenInventory; Sound_OpenInventory = sound_OpenInventory;
} }
} catch (Exception e) { } catch (Exception e) {
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix) T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
.replace("[sound]", "§8OpenInventory: §6" + Sound_OpenInventory_input) + "§4\n§4\n§4\n"); .replace("[sound]", "§8OpenInventory: §6" + Sound_OpenInventory_input) + "§4\n§4\n§4\n");
Sound_OpenInventory = Sound.valueOf(soundOpenInventory); Sound_OpenInventory = Sound.valueOf(soundOpenInventory);
} }
@ -285,6 +291,7 @@ public class SelectConfig {
private static Boolean mysqlSSL; private static Boolean mysqlSSL;
private static String DefaultGUI; private static String DefaultGUI;
private static String prefix;
private static Boolean UseItem_Enable; private static Boolean UseItem_Enable;
private static Boolean UseItem_AllowToggle; private static Boolean UseItem_AllowToggle;
@ -432,6 +439,10 @@ public class SelectConfig {
return DefaultGUI; return DefaultGUI;
} }
public static String getPrefix() {
return prefix;
}
public static Boolean getUseItem_Enable() { public static Boolean getUseItem_Enable() {
return UseItem_Enable; return UseItem_Enable;
} }

View File

@ -1,5 +1,6 @@
package net.t2code.commandguiv2.Spigot.config.configConverter; package net.t2code.commandguiv2.Spigot.config.configConverter;
import com.sun.org.apache.xpath.internal.operations.Bool;
import net.t2code.commandguiv2.Spigot.Main; import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.functions.CreateFunctions; import net.t2code.commandguiv2.Spigot.config.functions.CreateFunctions;
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum; import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
@ -17,7 +18,7 @@ import java.util.List;
public class ConfigConverter { public class ConfigConverter {
public static void removeBungeeOption(){ public static void removeBungeeOption() {
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
@ -30,6 +31,7 @@ public class ConfigConverter {
} }
} }
public static void renameMainFolder() { public static void renameMainFolder() {
if (new File("plugins/CommandGUI").exists() && !Main.getPath().exists()) { if (new File("plugins/CommandGUI").exists() && !Main.getPath().exists()) {
File oldF = new File("plugins/CommandGUI"); File oldF = new File("plugins/CommandGUI");
@ -134,6 +136,7 @@ public class ConfigConverter {
String serverChangeServer = yamlConfigurationOld.getString("Slots." + key + ".ServerChange.Server"); String serverChangeServer = yamlConfigurationOld.getString("Slots." + key + ".ServerChange.Server");
Boolean openGUIEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".OpenGUI.Enable"); Boolean openGUIEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".OpenGUI.Enable");
String openGUI = yamlConfigurationOld.getString("Slots." + key + ".OpenGUI.GUI"); String openGUI = yamlConfigurationOld.getString("Slots." + key + ".OpenGUI.GUI");
Boolean closeGUI = yamlConfiguration.getBoolean("Slots.Function.CloseGUI.Enable");
Boolean togglePermission = yamlConfigurationOld.getBoolean("Slots." + key + ".Toggle.Permission.Enable"); Boolean togglePermission = yamlConfigurationOld.getBoolean("Slots." + key + ".Toggle.Permission.Enable");
String togglePermissionPerm = yamlConfigurationOld.getString("Slots." + key + ".Toggle.Permission.Permission"); String togglePermissionPerm = yamlConfigurationOld.getString("Slots." + key + ".Toggle.Permission.Permission");
Boolean toggleUseItem = yamlConfigurationOld.getBoolean("Slots." + key + ".Toggle.UseItem.Enable"); Boolean toggleUseItem = yamlConfigurationOld.getBoolean("Slots." + key + ".Toggle.UseItem.Enable");
@ -163,7 +166,7 @@ public class ConfigConverter {
CreateFunctions.createFunction(key, empty, itemAmount, playerHeadEnable, base64Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, itemMaterial, itemName, lore, CreateFunctions.createFunction(key, empty, itemAmount, playerHeadEnable, base64Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, itemMaterial, itemName, lore,
true, "", true, Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"), 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, customSoundEnable, customSoundNoSound, customSoundSound, costEnable, "vault", "DIRT;5", 0, price, commandEnable, commandBungeeCommand, commandAsConsole, command, serverChange,
serverChangeServer, openGUIEnable, openGUI, togglePermission, togglePermissionPerm, toggleUseItem, messageEnable, message, setConfigEnable, configFilePath, serverChangeServer, openGUIEnable, openGUI,closeGUI, togglePermission, togglePermissionPerm, toggleUseItem, messageEnable, message, setConfigEnable, configFilePath,
configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft, configDoubleValueLeft, configListValueLeft, 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"); false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
@ -233,4 +236,36 @@ public class ConfigConverter {
config.set(path, value); config.set(path, value);
} }
} }
public static void convert7() {
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4Config conversion to the new config structure starts!");
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
File f = new File(Main.getPath() + "/Functions/");
File[] fileArray = f.listFiles();
for (File config : fileArray) {
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);
yamlConfiguration.set("Slots.Function.CloseGUI.Enable",false);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
}
}
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4The conversion to the new config structure is completed!");
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7]");
T2Csend.console(Util.getPrefix() + " §7[§5ConfigConvert§7] §4----------------------");
}
} }

View File

@ -18,7 +18,7 @@ public class CreateFunctions {
"&6Toggle UseItem", Arrays.asList("&bYou currently have the UseItem set to: %commandgui_useitem%"), true, "", true, "&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, 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, "VAULT", "DIRT;5", 0, 0.0, false, false, false, Arrays.asList(), false,
"", false, "", false, "", true, true, "", false, "", false,false, "", true, true,
Arrays.asList("&bYour UseItem was set to: %commandgui_useitem%&b."), false, "", "", "String", Arrays.asList("&bYour UseItem was set to: %commandgui_useitem%&b."), false, "", "", "String",
"", false, 0, 0.0, Arrays.asList(), "", false, "", false, 0, 0.0, Arrays.asList(), "", false,
0, 0.0, Arrays.asList(), false, "", 0, 0.0, Arrays.asList(), false, "",
@ -30,7 +30,7 @@ public class CreateFunctions {
"&8-----------------", "&eIf you find any errors or bugs,", "&eplease contact me so I can fix them.", "&8-----------------", "&5Discord: §7http://dc.t2code.net"), "&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-----------------"), true, "", true, Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"),
false, false, "", false, "VAULT", "DIRT;5", 0, 0.0, false, false, false, false, "", false, "VAULT", "DIRT;5", 0, 0.0, false, false,
false, Arrays.asList(), false, "", false, "", false, "", false, Arrays.asList(), false, "", false, "", false,false, "",
false, true, Arrays.asList("&6You can find more information on Discord: &ehttp://dc.t2code.net"), false, "", false, true, Arrays.asList("&6You can find more information on Discord: &ehttp://dc.t2code.net"), false, "",
"", "String", "", false, 0, 0.0, Arrays.asList(), "", "String", "", false, 0, 0.0, Arrays.asList(),
"", false, 0, 0.0, Arrays.asList(), false, "", "", false, 0, 0.0, Arrays.asList(), false, "",
@ -40,7 +40,7 @@ public class CreateFunctions {
public static void createFunction(String fileName, Boolean empty, Integer itemAmount, Boolean playerHeadEnable, Boolean base64Enable, String base64Value, Boolean playerWhoHasOpenedTheGUI, 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 noPermMessageEnable, String customNoPermMessage, Boolean noPermLoreEnable, List<String> noPermLore, 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 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 commandAsConsole, List<String> command, Boolean serverChange, String serverChangeServer, Boolean openGUIEnable, String openGUI,Boolean closeGUI,
Boolean togglePermission, String togglePermissionPerm, Boolean toggleUseItem, Boolean messageEnable, List<String> message, Boolean setConfigEnable, Boolean togglePermission, String togglePermissionPerm, Boolean toggleUseItem, Boolean messageEnable, List<String> message, Boolean setConfigEnable,
String configFilePath, String configOptionPath, String configOptionPremat, String configStringValueLeft, Boolean configBooleanValueLeft, String configFilePath, String configOptionPath, String configOptionPremat, String configStringValueLeft, Boolean configBooleanValueLeft,
Integer configIntegerValueLeft, Double configDoubleValueLeft, List<String> configListValueLeft, String configStringValueRight, Integer configIntegerValueLeft, Double configDoubleValueLeft, List<String> configListValueLeft, String configStringValueRight,
@ -92,6 +92,7 @@ public class CreateFunctions {
set("Slots.Function.ServerChange.Server", serverChangeServer == null ? "" : serverChangeServer, yamlConfiguration); set("Slots.Function.ServerChange.Server", serverChangeServer == null ? "" : serverChangeServer, yamlConfiguration);
set("Slots.Function.OpenGUI.Enable", openGUIEnable, yamlConfiguration); set("Slots.Function.OpenGUI.Enable", openGUIEnable, yamlConfiguration);
set("Slots.Function.OpenGUI.GUI", openGUI == null ? "" : openGUI, yamlConfiguration); set("Slots.Function.OpenGUI.GUI", openGUI == null ? "" : openGUI, yamlConfiguration);
set("Slots.Function.CloseGUI.Enable", closeGUI, yamlConfiguration);
set("Slots.Function.Toggle.Permission.Enable", togglePermission, yamlConfiguration); set("Slots.Function.Toggle.Permission.Enable", togglePermission, yamlConfiguration);
set("Slots.Function.Toggle.Permission.Permission", togglePermissionPerm == null ? "" : togglePermissionPerm, yamlConfiguration); set("Slots.Function.Toggle.Permission.Permission", togglePermissionPerm == null ? "" : togglePermissionPerm, yamlConfiguration);

View File

@ -174,6 +174,6 @@ public class SelectMessages {
} }
private static String select(String path, YamlConfiguration yamlConfiguration) { private static String select(String path, YamlConfiguration yamlConfiguration) {
return T2Creplace.replace(Util.getPrefix(), Objects.requireNonNull(yamlConfiguration.getString(path))); return T2Creplace.replace(SelectConfig.getPrefix(), Objects.requireNonNull(yamlConfiguration.getString(path)));
} }
} }

View File

@ -1,6 +1,5 @@
package net.t2code.commandguiv2.Spigot.gui; package net.t2code.commandguiv2.Spigot.gui;
import net.t2code.commandguiv2.Spigot.cmdManagement.Help;
import net.t2code.commandguiv2.Spigot.listener.ServerChange; import net.t2code.commandguiv2.Spigot.listener.ServerChange;
import net.t2code.commandguiv2.Spigot.useItem.Events; import net.t2code.commandguiv2.Spigot.useItem.Events;
import net.t2code.commandguiv2.Spigot.objects.functions.Function; import net.t2code.commandguiv2.Spigot.objects.functions.Function;
@ -64,6 +63,7 @@ public class GUIListener implements Listener {
if (e.getSlot() != slot.slot) return; if (e.getSlot() != slot.slot) return;
Function function = Main.functionHashMap.get(slot.function); Function function = Main.functionHashMap.get(slot.function);
if (slot.permission && !player.hasPermission(slot.permissionToSee)) return; if (slot.permission && !player.hasPermission(slot.permissionToSee)) return;
if (function.closeGUI_Enable) closeGUI(player);
if (slot.permission && !player.hasPermission(slot.permissionToUse)) { if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
if (function.noPermMessageEnable) { if (function.noPermMessageEnable) {
if (function.customNoPermMessage == null || function.customNoPermMessage.equals("")) { if (function.customNoPermMessage == null || function.customNoPermMessage.equals("")) {
@ -94,6 +94,7 @@ public class GUIListener implements Listener {
if (function.toggleUseItem) return true; if (function.toggleUseItem) return true;
if (function.command_Enable) return true; if (function.command_Enable) return true;
if (function.openGUI_Enable) return true; if (function.openGUI_Enable) return true;
if (function.closeGUI_Enable) return true;
if (function.message_Enable) return true; if (function.message_Enable) return true;
if (function.serverChange) return true; if (function.serverChange) return true;
if (function.setConfigEnable) return true; if (function.setConfigEnable) return true;
@ -149,6 +150,10 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 1L); }.runTaskLater(plugin, 1L);
} }
private static void closeGUI(Player player){
player.closeInventory();
}
private static void message(Function slot, Player player) { private static void message(Function slot, Player player) {
player.closeInventory(); player.closeInventory();
for (String msg : slot.message) { for (String msg : slot.message) {
@ -338,7 +343,11 @@ public class GUIListener implements Listener {
} }
break; break;
case VOTEPOINTS: case VOTEPOINTS:
if (!T2Ceco.votePointsRemove(prefix, player, function.votePoints)) { if (T2Ceco.votePointsRemove(prefix, player, function.votePoints)) {
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
.replace("[price]", function.votePoints + " VotePoints"));
execute(function, slot, player, e, gui);
} else {
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
@ -347,15 +356,15 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 1L); }.runTaskLater(plugin, 1L);
T2Csend.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString())); T2Csend.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
Sound.play(player, SoundEnum.NoMoney); Sound.play(player, SoundEnum.NoMoney);
} else {
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
.replace("[price]", function.votePoints + " VotePoints"));
execute(function, slot, player, e, gui);
} }
break; break;
case VAULT: case VAULT:
case MONEY: case MONEY:
if (!T2Ceco.moneyRemove(prefix, player, function.price)) { if (T2Ceco.moneyRemove(prefix, player, function.price)) {
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
.replace("[price]", function.price + " " + SelectConfig.getCurrency()));
execute(function, slot, player, e, gui);
} else {
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
@ -364,10 +373,6 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 1L); }.runTaskLater(plugin, 1L);
T2Csend.player(player, T2Creplace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price))); T2Csend.player(player, T2Creplace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
Sound.play(player, SoundEnum.NoMoney); Sound.play(player, SoundEnum.NoMoney);
} else {
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
.replace("[price]", function.price + " " + SelectConfig.getCurrency()));
execute(function, slot, player, e, gui);
} }
break; break;
} }

View File

@ -1,5 +1,6 @@
package net.t2code.commandguiv2.Spigot.objects; package net.t2code.commandguiv2.Spigot.objects;
import com.sun.org.apache.xpath.internal.operations.Bool;
import net.t2code.commandguiv2.Spigot.Main; import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI; import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter; import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
@ -149,6 +150,7 @@ public class Obj_Select {
String serverChangeServer = yamlConfiguration.getString("Slots.Function.ServerChange.Server"); String serverChangeServer = yamlConfiguration.getString("Slots.Function.ServerChange.Server");
Boolean openGUI_Enable = yamlConfiguration.getBoolean("Slots.Function.OpenGUI.Enable"); Boolean openGUI_Enable = yamlConfiguration.getBoolean("Slots.Function.OpenGUI.Enable");
String openGUI = yamlConfiguration.getString("Slots.Function.OpenGUI.GUI"); String openGUI = yamlConfiguration.getString("Slots.Function.OpenGUI.GUI");
Boolean closeGUI = yamlConfiguration.getBoolean("Slots.Function.CloseGUI.Enable");
Boolean togglePermission = yamlConfiguration.getBoolean("Slots.Function.Toggle.Permission.Enable"); Boolean togglePermission = yamlConfiguration.getBoolean("Slots.Function.Toggle.Permission.Enable");
String togglePermissionPerm = yamlConfiguration.getString("Slots.Function.Toggle.Permission.Permission"); String togglePermissionPerm = yamlConfiguration.getString("Slots.Function.Toggle.Permission.Permission");
Boolean toggleUseItem = yamlConfiguration.getBoolean("Slots.Function.Toggle.UseItem.Enable"); Boolean toggleUseItem = yamlConfiguration.getBoolean("Slots.Function.Toggle.UseItem.Enable");
@ -203,7 +205,7 @@ public class Obj_Select {
Function function = new Function(key, empty, itemAmount, playerHead_Enable, base64_Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, item, name, lore, Function function = new Function(key, empty, itemAmount, playerHead_Enable, base64_Enable, base64Value, playerWhoHasOpenedTheGUI, playerName, item, name, lore,
noPermMessageEnable, customNoPermMessage, noPermLoreEnable, noPermLore, noPermMessageEnable, customNoPermMessage, noPermLoreEnable, noPermLore,
customSound_Enable, customSound_NoSound, customSound_Sound, cost_Enable, ecoModule, ecoItem, votePoints, price, command_Enable, command_BungeeCommand, 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, commandAsConsole, command, serverChange, serverChangeServer, openGUI_Enable, openGUI, closeGUI, togglePermission, togglePermissionPerm, toggleUseItem, message_Enable,
message, setConfigEnable, configFilePath, configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft, message, setConfigEnable, configFilePath, configOptionPath, configOptionPremat, configStringValueLeft, configBooleanValueLeft, configIntegerValueLeft,
configDoubleValueLeft, configListValueLeft, configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight, configDoubleValueLeft, configListValueLeft, configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight,
configListValueRight, pluginReloadEnable, pluginReloadCommand, functionVotePoints, functionVotePointsMode, functionVotePointsAmount, configListValueRight, pluginReloadEnable, pluginReloadCommand, functionVotePoints, functionVotePointsMode, functionVotePointsAmount,

View File

@ -39,6 +39,7 @@ public class Function {
public List<String> command; public List<String> command;
public Boolean openGUI_Enable; public Boolean openGUI_Enable;
public String openGUI; public String openGUI;
public Boolean closeGUI_Enable;
public Boolean togglePermission; public Boolean togglePermission;
public String togglePermissionPerm; public String togglePermissionPerm;
public Boolean toggleUseItem; public Boolean toggleUseItem;
@ -102,6 +103,7 @@ public class Function {
String serverChangeServer, String serverChangeServer,
Boolean openGUI_Enable, Boolean openGUI_Enable,
String openGUI, String openGUI,
Boolean closeGUI,
Boolean togglePermission, Boolean togglePermission,
String togglePermissionPerm, String togglePermissionPerm,
Boolean toggleUseItem, Boolean toggleUseItem,
@ -163,6 +165,7 @@ public class Function {
this.serverChangeServer = serverChangeServer; this.serverChangeServer = serverChangeServer;
this.openGUI_Enable = openGUI_Enable; this.openGUI_Enable = openGUI_Enable;
this.openGUI = openGUI; this.openGUI = openGUI;
this.closeGUI_Enable =closeGUI;
this.togglePermission = togglePermission; this.togglePermission = togglePermission;
this.togglePermissionPerm = togglePermissionPerm; this.togglePermissionPerm = togglePermissionPerm;
this.toggleUseItem = toggleUseItem; this.toggleUseItem = toggleUseItem;

View File

@ -35,6 +35,6 @@ public class Util {
} }
public static Integer getConfigVersion() { public static Integer getConfigVersion() {
return 6; return 7;
} }
} }

View File

@ -115,6 +115,9 @@ Slots:
# Here you can set which GUI should be opened. # Here you can set which GUI should be opened.
# Use the file name of the GUI without .yml # Use the file name of the GUI without .yml
GUI: '' GUI: ''
CloseGUI:
# Here you can set a function to close the GUI.
Enable: false
Toggle: Toggle:
# Here you can enable a feature that allows players to give or remove permissions to each other # Here you can enable a feature that allows players to give or remove permissions to each other
# The commands for the permission plugin can be set in the config (default for LuckPerms) # The commands for the permission plugin can be set in the config (default for LuckPerms)

View File

@ -2,7 +2,7 @@
######################################### #########################################
## Please do not change ConfigVersion! ## ## Please do not change ConfigVersion! ##
######################################### #########################################
ConfigVersion: 6 ConfigVersion: 7
Plugin: Plugin:
# Here you can set the debug mode of the plugin. # Here you can set the debug mode of the plugin.