From 92d3e9a2d86f430aba5fb2453493c959399e5237 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Wed, 8 Jun 2022 05:50:18 +0200 Subject: [PATCH] files with explanations NEW: In case of a new installation, files with explanations are now also created in the plugin folder --- .../Spigot/objects/Obj_Select.java | 15 +- .../commandguiv2/Spigot/system/Load.java | 18 + .../Functions/functionDeclaration.yml | 158 +++++++++ .../main/resources/GUIs/guiDeclaration.yml | 51 +++ .../src/main/resources/configDeclaration.yml | 313 ++++++++++++++++++ 5 files changed, 548 insertions(+), 7 deletions(-) create mode 100644 CommandGUI V2/src/main/resources/Functions/functionDeclaration.yml create mode 100644 CommandGUI V2/src/main/resources/GUIs/guiDeclaration.yml create mode 100644 CommandGUI V2/src/main/resources/configDeclaration.yml diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java index 7912d33..9283862 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/objects/Obj_Select.java @@ -29,14 +29,14 @@ public class Obj_Select { File f = new File(Main.getPath() + "/GUIs/"); File[] fileArray = f.listFiles(); - for (File config_gui : fileArray) { - + for (File config : fileArray) { try { - String sub = config_gui.getName().substring(config_gui.getName().length() - 4); + if (config.getName().equals("guiDeclaration.yml")) return; + String sub = config.getName().substring(config.getName().length() - 4); if (sub.equals(".yml")) { - String key = config_gui.getName().replace(".yml", ""); + String key = config.getName().replace(".yml", ""); Main.allAliases.add(key); - YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config_gui); + YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config); Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable"); Integer guiLines = yamlConfiguration_gui.getInt("GUI.Lines"); @@ -81,11 +81,11 @@ public class Obj_Select { key, commandAliasEnable, commandPermission, slots); Main.guiHashMap.put(key, gui); - CmdExecuter_GUI.arg1.put(config_gui.getName() + CmdExecuter_GUI.arg1.put(config.getName() .replace(".yml", ""), "commandgui.gui." + key); - yamlConfiguration_gui.save(config_gui); + yamlConfiguration_gui.save(config); } } catch (Exception e) { Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]); @@ -100,6 +100,7 @@ public class Obj_Select { File[] fileArray = f.listFiles(); for (File config : fileArray) { + if (config.getName().equals("functionDeclaration.yml")) return; String sub = config.getName().substring(config.getName().length() - 4); if (sub.equals(".yml")) { YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java index 4de8217..605ccc8 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java @@ -48,6 +48,24 @@ public class Load { send.console(prefix + " ยง8-------------------------------"); if (!new File(Main.getPath(), "config.yml").exists()) { + try { + plugin.saveResource("config.yml", false); + } 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) { diff --git a/CommandGUI V2/src/main/resources/Functions/functionDeclaration.yml b/CommandGUI V2/src/main/resources/Functions/functionDeclaration.yml new file mode 100644 index 0000000..70d3ccf --- /dev/null +++ b/CommandGUI V2/src/main/resources/Functions/functionDeclaration.yml @@ -0,0 +1,158 @@ +##################################################### +## To add another Function just create a new file. ## +##################################################### + +Slots: + Function: + Item: + # Here you can create an empty slot. + # Note: When this is enabled, no functions will work. + Empty: false + # Here you can set the number of items + Amount: 1 + PlayerHead: + # Here you can set if the item should be a player head + Enable: false + Base64: + # Here you can specify whether a Base64 player header should be used + Enable: false + # Here you can set the Base64 Value. + # You can find the Base64 Value for example on https://minecraft-heads.com. + Base64Value: '' + # Here you can set whether the player head should be used by the player who has opened the GUI. + PlayerWhoHasOpenedTheGUI: false + # Here you can set a specific player from which the player head should be used + PlayerName: '' + # Here you can set a Minecraft material to be used. This is ignored when PlayerHead is used + Material: 'DIRT' + # Here you set the DisplayName of the item + Name: 'Item Title' + # Here you set the lore of the item + Lore: + - '&8-----------------' + - '&bLine 1' + - '&bLine 2' + - '&8-----------------' + CustomSound: + # Here you can set whether a specific sound or the default sound from the config.yml should be used. + Enable: false + # Here you can deactivate the sound for this item. CustomSound must be activated for this! + NoSound: false + # Here you set the custom sound + Sound: '' + Cost: + # Here you can specify whether the function should cost or not + Enable: false + # Here you set which economy mode should be used. + # Use 'VAULT' / 'MONEY' for money via vault. + # Use 'ITEM' to pay with items. + # Use 'VOTEPOINTS' to pay with vote points from VotingPlugin (https://spigotmc.org/resources/votingplugin.15358/). + EcoModule: VAULT + # Set the item and the quantity for the ITEM mode here. (ITEM;AMOUNT) + Item: DIRT;5 + # Set here the VotePoints for the VOTEPOINTS mode. + VotePoints: 0 + # Set the money here for the mode VAULT or MONEY + Price: 0.0 + Command: + # Here you can enable or disable the Command function + # Placeholder: [player] = PlayerName + Enable: false + # Here you can specify if this command should be executed on the bugee + BungeeCommand: false + # Here you can set if the command should be executed from the console + # Example: You can also create a store with this command. + # /give [player] stone | So all commands can be executed even those for which the player has no permission. + CommandAsConsole: false + # Here you can set commands. Several commands are also possible. + # They are processed from top to bottom and executed one after the other! + Command: + - 'command 1' + - 'command 2' + ServerChange: + # Here you can enable or disable the function ServerChange + # To use this function the function BungeeCord must be activated in the conig.yml and the plugin must be installed on the proxy! + Enable: false + # # Here you can say which server the player should be moved to. + Server: '' + OpenGUI: + # Here you can enable or disable the OpenGUI feature + Enable: false + # Here you can set which GUI should be opened. + # Use the file name of the GUI without .yml + GUI: '' + Toggle: + # 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) + Permission: + # Activate this function here + Enable: false + # Set the permission here + Permission: '' + UseItem: + # When this function is enabled, players can toggle the UseItem on and off. + # For this function 'UseItem.AllowToggle' must be activated in config.yml! + Enable: false + Message: + # Here you can enable or disable the Message function + 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 + Message: + - 'Message line 1' + - 'Message line 2' + SetConfig: + # Here you can enable or disable the SetConfig function + Enable: false + File: + # Here you define in which file something should be changed + # Example at this file: 'plugins/CommandGUI/GUIs/default.yml'. + Path: '' + Option: + # Here you set the option to be changed + # Example on the option of this example slots: 'Slots.Example.Slot' + Path: '' + # Here you set which format should be set + # String = text in one line + # Boolean = true / false + # Integer = numbers without comma + # Double = number with comma | Please use . as comma + # List = text with multiple lines (- 'hi') + Premat: String + Value: + # Here you can set which value should be set when you click with the left mouse button. + LeftClick: + String: '' + Boolean: false + Integer: 0 + Double: 0.0 + List: [] + # Here you set which value should be set when clicking with the right mouse button + RightClick: + String: '' + Boolean: false + Integer: 0 + Double: 0.0 + List: [] + PluginReload: + # Here you can set if the plugin to which a file was changed should be reloaded directly + Enable: false + # Here you set the reload command to be used + # The command is executed by the console! No / is needed! + Command: '' + FunctionVotePoints: + # With this function you can give or subtract VotePoints from VotingPlugin to a player. + Enable: false + # Use to add: ADD + # Use to subtract: REMOVE + Mode: ADD + # Set the number of vote points to be subtracted / added here + Amount: 0 + FunctionItem: + # With this function you can give or remove items to a player + Enable: false + # Use to add: ADD + # Use to subtract: REMOVE + Mode: REMOVE + # Enter the item (material) and the number behind it. Separate them with ; (ITEM;AMOUNT) + Item: DIRT;5 diff --git a/CommandGUI V2/src/main/resources/GUIs/guiDeclaration.yml b/CommandGUI V2/src/main/resources/GUIs/guiDeclaration.yml new file mode 100644 index 0000000..d632655 --- /dev/null +++ b/CommandGUI V2/src/main/resources/GUIs/guiDeclaration.yml @@ -0,0 +1,51 @@ + +################################################ +## To add another GUI just create a new file. ## +################################################ + +GUI: + # Enable or disable the GUI + Enable: true + # Set the lines of the GUI here (1-6) + Lines: 1 + # Here you set the display name of the GUI + Name: '&5default &9GUI' + FillItem: + # Activate or deactivate the FillItem here + Enable: true + # Here you can set the FillItem + Item: BLACK_STAINED_GLASS_PANE + +# Here you set the settings for the alias +Command: + # Here you can enable or disable the alias of the GUI. The alias is the file name without .yml + Alias: true + Permission: + # Set here if a permission is needed for the alias or not. | Permission: t2code.alias.use. + Required: true + +# Here you set the functions and slots +Slots: + # Here is an example of a slot + # To add another slot just copy the block. IMPORTANT: The slot name must not be duplicated (Slots.). + function1: + # Here you set which slot the item / function should be in + Slot: 4 + # Here you can activate and deactivate the slot + Enable: true + # Here you specify which function this slot should perform + Function: function1 + Permission: + # Here you can set if a permission is needed to use this function. + Required: false + # Placeholder: [function] which function is used | [slot] is the slot number | [slotname] is the name of the key (Slots.KEY) + See: commandgui.gui.[function].slot.[slot].see + Use: commandgui.gui.[function].slot.[slot].use + function2: + Slot: 6 + Enable: true + Function: function2 + Permission: + Required: false + See: commandgui.gui.[function].slot.[slot].see + Use: commandgui.gui.[function].slot.[slot].use diff --git a/CommandGUI V2/src/main/resources/configDeclaration.yml b/CommandGUI V2/src/main/resources/configDeclaration.yml new file mode 100644 index 0000000..681eb67 --- /dev/null +++ b/CommandGUI V2/src/main/resources/configDeclaration.yml @@ -0,0 +1,313 @@ + +######################################### +## Please do not change ConfigVersion! ## +######################################### +ConfigVersion: 5 + +Plugin: + # Here you can set the debug mode of the plugin. + # It is recommended not to activate this on productive systems. Only if it is really needed! + Debug: false + # Here you can set whether the Helpalias command (/commandguihelp) should be activated. + # If this is changed the server MUST be restarted to change this! + HelpAlias: true + # Here you set which subcommand should be for the admin functions. + # (/commandgui 'admin' reload) + AdminSubCommand: admin + # here you set the language to be used + language: english + # Here you set the character or word that will be used as currency + Currency: $ + # Here you set which GUI should be opened at '/commandgui' / '/gui'. + DefaultGUI: default + +Storage: + # Set here if MySQL, SQLITE or YML should be used as storage. + Type: SQLITE + # Enter here the access data to the database you want to use, if you use MySQL + MySQL: + IP: localhost + Port: 3306 + Database: database + User: root + Password: password + SSL: false + +BungeeCord: + # Set here if the plugin runs in a BungeeCord subserver. + # The plugin file must then be installed on the proxy (BungeeCord, Waterfall) and on the servers. + Enable: false + # Set here the server name of the server + ThisServer: server + +UseItem: + # Set here if the UseItem is to be used in use + Enable: true + # Set here if players are allowed to enable or disable the UseItem with '/gui-item '. + # Permission 'commandgui.useitem.toggle' is additionally required + AllowToggle: true + # Set here if players are allowed to change the slot in the inventory where the UseItem is located with '/gui-item '. + # Permission 'commandgui.useitem.toggle' is additionally required + AllowSetSlot: true + # Set here if the dropping of the UseItem should be blocked + BlockMoveAndDrop: true + # Set here which GUI should open the UseItem + OpenGUI: default + Permission: + # Set here if the permission 'commandgui.useitem' is required to use the UseItem + NeededToUse: true + # Set here if the UseItem should stay in the inventory with the '/clear' command + KeepAtCommandClear: true + InventorySlot: + # Set here on which slot the UseItem should be located by default + Slot: 1 + # Set here if the slot should be forced even if another item is on this slot (also the set slot of the player). + # NOTE: The item that was on this slot before will be deleted. + SlotEnforce: false + # Set here if the UseItem should be placed on another free slot, if the selected slot (also the set slot of the player) is occupied. + FreeSlot: false + # Set here the item that should be used as UseItem + Item: + # Set here which material should be used as UseItem + Material: paper + PlayerHead: + # Set here if a PlayerHead should be used as UseItem + Enable: false + Base64: + # Set here if a Base64 PlayerHead should be used as UseItem + Enable: false + # Here you can set the Base64 Value. + # You can find the Base64 Value for example on https://minecraft-heads.com. + Base64Value: '' + # Here you can set whether the player head should be used as a UseItem by the player + PlayerWhoHasOpenedTheGUI: false + # Here you can set a player name whose head should be used as UseItem + Playername: '' + # Set the DisplayName of the UseItem here + Name: '&6GUI UseItem' + # Set the lore of the UseItem here + Lore: + - 'Lore line 1' + - 'Lore line 2' + Join: + # Set here if the UseItem should be given at every server join + GiveOnEveryJoin: true + # Set here if the UseItem should only be given to the server at the first join of the player. + GiveOnlyOnFirstJoin: false + Cursor: + ToGUIItem: + OnLogin: + # Here you define whether the UseItem should be selected when joining the server. + Enable: true + Spigot: + # Set here if the UseItem should only be selected at the first join + OnOnlyFirstLogin: true + Bungee: + # Set here if the UseItem should be selected even if you change the server of the bungee network. + # The option BungeeCord must be activated for this! + OnServerChange: false + +Toggle: + # Set the items to be used with the Toggle function here + Items: + # Set here the item that should be used if you have the permission or the UseItem is active. + OnOrYes: + Item: + Base64: + # Set here if a Base64 head should be used + Enable: false + # Here you can set the Base64 Value. + # You can find the Base64 Value for example on https://minecraft-heads.com. + Base64Value: '' + # Set the material to be used here + Material: GREEN_WOOL + # Set here the item to be used if you have the permission or the UseItem is disabled + OffOrNo: + Item: + Base64: + # Set here if a Base64 head should be used + Enable: false + # Here you can set the Base64 Value. + # You can find the Base64 Value for example on https://minecraft-heads.com. + Base64Value: '' + # Set the material to be used here + Material: RED_WOOL + Permission: + # Set here the commands to be used for Toggle.Permission + Commands: + 'True': luckperms user [player] permission set [perm] true + 'False': luckperms user [player] permission set [perm] false + +# Set the design of the placeholders here +Placeholder: + # Placeholder for true / enabled + 'True': '&2true' + # Placeholder for false / disabled + 'False': '&4false' + +Sound: + # Here you can disable all sounds + Enable: true + # Set here At which action which sound should be played or none at all + OpenInventory: + Enable: true + Sound: BLOCK_CHEST_OPEN + Click: + Enable: true + Sound: BLOCK_NOTE_BLOCK_HAT + NoMoney: + Enable: true + Sound: BLOCK_NOTE_BLOCK_HARP + NoInventorySpace: + Enable: true + Sound: BLOCK_NOTE_BLOCK_HARP + Give: + Enable: true + Sound: ENTITY_PLAYER_LEVELUP + PlayerNotFound: + Enable: true + Sound: BLOCK_NOTE_BLOCK_HARP + +Advanced: + UseItem: + GameMode: + Change: + # Set here if the UseItem should be reset when the GameMode is changed. + Enable: true + # Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second). + DelayInTicks: 1 + Protection: + # Set here in which gamemode the UseItem may be used + Enable: false + # Set here if the UseItem should be removed if you are in a not allowed Gamemode + RemoveItemWhenItIsDisabled: false + # Set here if a 'blacklist' or 'whitelist' should be used + Mode: blacklist + # Set the GameMode list here + List: + - CREATIVE + - Spectator + World: + Change: + # This specifies whether the UseItem should be reset when the world is changed. + Enable: true + # Set the delay with which the UseItem should be reset (time in Minecraft ticks. 20 is one second). + DelayInTicks: 1 + Protection: + # Set here in which world the UseItem may be used + Enable: false + # Here you specify whether the UseItem should be removed if you are in a world that is not permitted + RemoveItemWhenItIsDisabled: false + # Set here if a 'blacklist' or 'whitelist' should be used + Mode: blacklist + # Set the worlds here + List: + - World1 + - World2 + # Set here for which blocks the UseItem is blocked and the function of the block you are looking at should be used. + ItemBlockBlacklist: + - CHEST + - CRAFTING_TABLE + - FURNACE + - OAK_FENCE + - SPRUCE_FENCE + - BIRCH_FENCE + - JUNGLE_FENCE + - ACACIA_FENCE + - DARK_OAK_FENCE + - MANGROVE_FENCE + - CRIMSON_FENCE + - WARPED_FENCE + - NETHER_BRICK_FENCE + - ENDER_CHEST + - BEACON + - ANVIL + - CHIPPED_ANVIL + - DAMAGED_ANVIL + - REPEATER + - COMPARATOR + - HOPPER + - DISPENSER + - DROPPER + - LEVER + - DAYLIGHT_DETECTOR + - TRAPPED_CHEST + - NOTE_BLOCK + - STONE_BUTTON + - POLISHED_BLACKSTONE_BUTTON + - OAK_BUTTON + - SPRUCE_BUTTON + - BIRCH_BUTTON + - JUNGLE_BUTTON + - ACACIA_BUTTON + - DARK_OAK_BUTTON + - MANGROVE_BUTTON + - CRIMSON_BUTTON + - WARPED_BUTTON + - IRON_DOOR + - OAK_DOOR + - SPRUCE_DOOR + - BIRCH_DOOR + - JUNGLE_DOOR + - ACACIA_DOOR + - DARK_OAK_DOOR + - MANGROVE_DOOR + - CRIMSON_DOOR + - WARPED_DOOR + - IRON_TRAPDOOR + - IRON_TRAPDOOR + - OAK_TRAPDOOR + - OAK_TRAPDOOR + - SPRUCE_TRAPDOOR + - SPRUCE_TRAPDOOR + - BIRCH_TRAPDOOR + - BIRCH_TRAPDOOR + - JUNGLE_TRAPDOOR + - JUNGLE_TRAPDOOR + - ACACIA_TRAPDOOR + - ACACIA_TRAPDOOR + - DARK_OAK_TRAPDOOR + - DARK_OAK_TRAPDOOR + - MANGROVE_TRAPDOOR + - MANGROVE_TRAPDOOR + - CRIMSON_TRAPDOOR + - CRIMSON_TRAPDOOR + - WARPED_TRAPDOOR + - WARPED_TRAPDOOR + - OAK_FENCE_GATE + - SPRUCE_FENCE_GATE + - BIRCH_FENCE_GATE + - JUNGLE_FENCE_GATE + - ACACIA_FENCE_GATE + - DARK_OAK_FENCE_GATE + - MANGROVE_FENCE_GATE + - CRIMSON_FENCE_GATE + - WARPED_FENCE_GATE + - CHEST_MINECART + - FURNACE_MINECART + - HOPPER_MINECART + - OAK_CHEST_BOAT + - SPRUCE_CHEST_BOAT + - BIRCH_CHEST_BOAT + - JUNGLE_CHEST_BOAT + - ACACIA_CHEST_BOAT + - DARK_OAK_CHEST_BOAT + - MANGROVE_CHEST_BOAT + - LEATHER_CHESTPLATE + - CHAINMAIL_CHESTPLATE + - IRON_CHESTPLATE + - DIAMOND_CHESTPLATE + - GOLDEN_CHESTPLATE + - NETHERITE_CHESTPLATE + - BREWING_STAND + - LOOM + - COMPOSTER + - BARREL + - SMOKER + - BLAST_FURNACE + - BLAST_FURNACE + - CARTOGRAPHY_TABLE + - FLETCHING_TABLE + - GRINDSTONE + - SMITHING_TABLE + - STONECUTTER