T2C-CommandGUI/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/GuiBuilder.java

123 lines
5.2 KiB
Java
Raw Normal View History

2022-04-16 12:32:22 +00:00
package de.jatitv.commandguiv2.Spigot.gui;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import de.jatitv.commandguiv2.Spigot.Main;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
2022-04-16 12:32:22 +00:00
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
2022-04-18 21:12:50 +00:00
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
2022-04-16 12:32:22 +00:00
import net.t2code.lib.Spigot.Lib.replace.Replace;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import java.lang.reflect.Field;
import java.util.UUID;
public class GuiBuilder {
private static String prefix = Util.getPrefix();
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
protected static void item(Function function, Integer slot, Player player, Inventory inventory) {
ItemStack item = new ItemStack(Material.valueOf(function.item.toUpperCase().replace(".", "_")));
2022-04-16 12:32:22 +00:00
ItemMeta itemMeta = item.getItemMeta();
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
setDisplayNameAndLore(itemMeta, player, function);
2022-04-16 12:32:22 +00:00
item.setItemMeta(itemMeta);
Integer am;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
if (function.itemAmount == 0) {
2022-04-16 12:32:22 +00:00
am = 1;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
} else am = function.itemAmount;
2022-04-16 12:32:22 +00:00
item.setAmount(am);
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
inventory.setItem(slot, item);
2022-04-16 12:32:22 +00:00
}
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
protected static void item(String material, Function function,Integer slot, Player player, Inventory inventory) {
2022-04-16 12:32:22 +00:00
ItemStack item = new ItemStack(Material.valueOf(material));
ItemMeta itemMeta = item.getItemMeta();
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
setDisplayNameAndLore(itemMeta, player, function);
2022-04-16 12:32:22 +00:00
item.setItemMeta(itemMeta);
Integer am;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
if (function.itemAmount == 0) {
2022-04-16 12:32:22 +00:00
am = 1;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
} else am = function.itemAmount;
2022-04-16 12:32:22 +00:00
item.setAmount(am);
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
inventory.setItem(slot, item);
2022-04-16 12:32:22 +00:00
}
2022-04-18 21:12:50 +00:00
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Function slot) {
2022-04-18 21:12:50 +00:00
if (Main.PaPi) {
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.name.replace("[player]", player.getName())));
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.lore, slot.price + " " + SelectConfig.Currency));
} else {
itemMeta.setDisplayName(Replace.replace(prefix, slot.name.replace("[player]", player.getName())));
itemMeta.setLore(Replace.replacePrice(prefix, slot.lore, slot.price + " " + SelectConfig.Currency));
}
}
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
protected static void base64(String base64Value, Function function, Integer slot, Player player, Inventory inventory) {
2022-04-16 12:32:22 +00:00
ItemStack item = ItemVersion.getHeadIS();
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
2022-04-18 21:12:50 +00:00
setBase64(itemMeta, base64Value);
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
setDisplayNameAndLore(itemMeta, player, function);
2022-04-16 12:32:22 +00:00
item.setItemMeta(itemMeta);
Integer am;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
if (function.itemAmount == 0) {
2022-04-16 12:32:22 +00:00
am = 1;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
} else am = function.itemAmount;
2022-04-16 12:32:22 +00:00
item.setAmount(am);
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
inventory.setItem(slot, item);
2022-04-16 12:32:22 +00:00
}
2022-04-18 21:12:50 +00:00
private static void setBase64(ItemMeta itemMeta, String base64Value) {
2022-04-16 12:32:22 +00:00
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
2022-04-18 21:12:50 +00:00
profile.getProperties().put("textures", new Property("textures", base64Value == null ? "" : base64Value));
Field profileField;
2022-04-16 12:32:22 +00:00
try {
profileField = itemMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(itemMeta, profile);
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
e.printStackTrace();
}
}
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
protected static void base64(Function function,Integer slot, Player player, Inventory inventory) {
base64(function.base64Value, function,slot, player, inventory);
2022-04-18 21:12:50 +00:00
}
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
protected static void playerHead(Function function, Integer slot,Player player, Inventory inventory, String skullName) {
2022-04-16 12:32:22 +00:00
ItemStack item = ItemVersion.getHeadIS();
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
setDisplayNameAndLore(itemMeta, player, function);
2022-04-18 21:12:50 +00:00
itemMeta.setOwner(skullName);
2022-04-16 12:32:22 +00:00
item.setItemMeta(itemMeta);
Integer am;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
if (function.itemAmount == 0) {
2022-04-16 12:32:22 +00:00
am = 1;
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
} else am = function.itemAmount;
2022-04-16 12:32:22 +00:00
item.setAmount(am);
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
inventory.setItem(slot, item);
2022-04-16 12:32:22 +00:00
}
2.7.0 Snapshot 1 In this update some functions were rewritten, changed and added. Also some minor bugs have been fixed. The GUIs files have been split into GUI files and function files, this provides more clarity in the complete plugin structure and offers the possibility to access a function from multiple GUIs. Thus, for example, you can create a back button as a function and open it from 3 GUIs, the item, the function can also be in different places, because the slot is set in the GUI file. In the GUI files is thus specified on which slot which function should be located. In addition, the permission for See and for Use of the functions can now be set individually in the GUI Config. In the functions also 2 new functions were added, with which players can switch permissions on and off and an option to switch the UseItem on and off. Placeholders have been added. This update includes a converter that builds the new structure from the old config structure. Your options should be taken over. For security reasons your old GUI files are saved under the path 'plugins/CommandGUI/OldConfig/GUIs/Version4'. Bug fixes: - Fixed a bug that prevented GUIs from opening. - The OpenGUI option, the command '/cgui <guiname>' did not work. The GUI that was set as default GUI in UseItem was always opened. This was fixed New features: - Placeholders - %commandgui_useitem% - Shows if you have activated or deactivated the UseItem (in color, customizable in config.yml) - %commandgui_useitem_boolean% - Shows if you have enabled or disabled the UseItem - %commandgui_useitem_slot% - shows on which slot you have set the UseItem - ToggleUseItem as new option for slots - TogglePermission as new option for slots Changes: - The config structure has been revised.
2022-04-19 05:08:33 +00:00
public static void fillItem(Inventory inventory, Gui gui) {
2022-04-18 21:12:50 +00:00
ItemStack glass;
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.valueOf(gui.guiFillItemItem));
} else glass = new ItemStack(Material.valueOf(gui.guiFillItemItem.toUpperCase().replace(".", "_")));
2022-04-18 21:12:50 +00:00
ItemMeta itemMetaglass = glass.getItemMeta();
itemMetaglass.setDisplayName(" ");
glass.setItemMeta(itemMetaglass);
glass.setAmount(1);
for (int i = 0; i < 9 * gui.guiLines; i++) {
2022-04-18 21:12:50 +00:00
inventory.setItem(i, glass);
2022-04-16 12:32:22 +00:00
}
}
}