2.8.5
- With this update the plugin has been renamed from 'CommandGUI' to 'T2C-CommandGUI'. - The plugin folder is now called 'T2C-CommandGUI'. - The commands 't2c-commandgui', 't2c-commandguihelp' and 't2c-commandgui-item' have been added - A new tab 'NoPermission' has been added to the functions, where it is adjustable: - Whether a message should be displayed if you click on the function but don't have permission for it. - CustomNoPermMessage - Whether a custom lore should be displayed if you don't have a permission for this function.
This commit is contained in:
@@ -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 {
|
||||
@@ -153,8 +198,8 @@ public class ConfigConverterUnderV5 {
|
||||
set("Slots." + key + ".Enable", slotEnable, yamlConfiguration);
|
||||
set("Slots." + key + ".Function", function, yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.Required", permRequired, yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.See", "t2code.functiongui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||
set("Slots." + key + ".Permission.Use", "t2code.functiongui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||
}
|
||||
|
||||
private static void set(String path, String value, YamlConfiguration config) {
|
||||
|
@@ -15,10 +15,11 @@ 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: %t2c-functiongui_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",
|
||||
Arrays.asList("&bYour UseItem was set to: %t2c-functiongui_useitem%&b."), false, "", "", "String",
|
||||
"", false, 0, 0.0, Arrays.asList(), "", false,
|
||||
0, 0.0, Arrays.asList(), false, "",
|
||||
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
|
||||
@@ -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;
|
||||
|
Reference in New Issue
Block a user