Compare commits

...

10 Commits
2.8.13 ... main

Author SHA1 Message Date
JaTiTV 36e6702e8b 2.8.18
-	Add „Plugin.Prefix“ in cofig.yml
-	Add Function: „Slots.Function.CloseGUI.Enable“ – With this function you can create a button to close the GUI
2024-05-17 01:17:29 +02:00
JaTiTV 7768530c19 2.8.16
- 1.20.2 Support
- If UseItem.AllowToggle was disabled in config.yml, it was still possible to toggle it via the toggle function, this logic error has been fixed
- The BungeeCord option has been removed from config.yml. The setting from the T2CodeLib Config is adopted
2023-12-07 18:34:34 +01:00
JaTiTV a0026381af 2.8.16_dev 2023-09-05 22:56:44 +02:00
JaTiTV a2cb76733d Update configDeclaration.yml 2023-09-05 22:28:21 +02:00
JaTiTV ae5a3b3557 2.8.15
- API update to Minecraft version 1.20
- T2CodeLib API update to 15.0 (this version is required from now on)
2023-06-08 07:02:06 +02:00
JaTiTV 367f1e32f4 Small bugfix 2023-04-23 13:25:14 +02:00
JaTiTV feed3914b0 „.gitea/ISSUE_TEMPLATE/feature_request.md“ ändern 2022-12-31 20:29:32 +00:00
JaTiTV 2f3c555195 Merge pull request '2.8.14 | Bugfix: Player-Inv-Click' (#16) from 2.8.14-DEV into main
Reviewed-on: #16
2022-12-22 01:07:14 +00:00
JaTiTV bcfe98bf22 2.8.14 2022-12-22 02:05:57 +01:00
JaTiTV b83766744d Bugfix: Player-Inv-Click
Bugfix: #14
2022-12-22 02:04:32 +01:00
19 changed files with 180 additions and 100 deletions

View File

@ -3,7 +3,7 @@ name: Feature request
about: Suggest an idea/improvement
title: ''
labels:
- " feature request"
- "feature request"
---

View File

@ -6,10 +6,10 @@
<groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId>
<version>2.8.13</version>
<version>2.8.18</version>
<packaging>jar</packaging>
<name>CommandGUI</name>
<name>T2C-CommandGUI</name>
<properties>
<java.version>1.8</java.version>
@ -17,6 +17,7 @@
</properties>
<build>
<finalName>${project.name}_${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -75,37 +76,51 @@
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>13.4</version>
<version>16.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>LuckyBox-API</artifactId>
<version>4.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>bungee</artifactId>
<version>1615</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_20.r2</groupId>
<artifactId>spigot</artifactId>
<version>1.20r2</version>
<classifier>1.20.2</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_16.r2</groupId>
<artifactId>spigot</artifactId>
<version>1.16r2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_10.r1</groupId>
<artifactId>spigot</artifactId>
<version>1.10r1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_8.r1</groupId>
<artifactId>spigot</artifactId>
<version>1.8r1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>PlugmanGUI</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<!-- placeholderAPI -->
@ -120,16 +135,19 @@
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>4.0.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.10</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.22</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -76,6 +76,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
break;
}
} else {
if (!args[0].equalsIgnoreCase("updateinfo")){
if (sender instanceof Player) {
Player player = (Player) sender;
Commands.gui(player, args[0]);
@ -83,6 +84,8 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
}
Help.sendHelp(sender, prefix);
}
}
}
return false;

View File

@ -17,6 +17,7 @@ import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -64,7 +65,7 @@ public class Commands {
e.printStackTrace();
}
if (SelectConfig.getBungee()) {
if (SelectLibConfig.getBungee()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.getPlugin(), "commandgui:bungee");
}

View File

@ -37,6 +37,7 @@ public class ConfigCreate {
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
T2Cconfig.set("Plugin.Currency", "$", yamlConfiguration);
T2Cconfig.set("Plugin.DefaultGUI", "default", yamlConfiguration);
T2Cconfig.set("Plugin.Prefix", "&8[&4C&9GUI&8]", yamlConfiguration);
if (Main.legacy){
T2Cconfig.set("Storage.Type", "YML", yamlConfiguration);
@ -48,9 +49,6 @@ public class ConfigCreate {
T2Cconfig.set("Storage.MySQL.Password", "password", yamlConfiguration);
T2Cconfig.set("Storage.MySQL.SSL", false, yamlConfiguration);
T2Cconfig.set("BungeeCord.Enable", false, yamlConfiguration);
T2Cconfig.set("BungeeCord.ThisServer", "server", yamlConfiguration);
T2Cconfig.set("UseItem.Enable", true, yamlConfiguration);
T2Cconfig.set("UseItem.AllowToggle", true, yamlConfiguration);
T2Cconfig.set("UseItem.AllowSetSlot", true, yamlConfiguration);

View File

@ -1,9 +1,10 @@
package net.t2code.commandguiv2.Spigot.config.config;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
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.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
@ -14,6 +15,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class SelectConfig {
public static void onSelect() {
@ -27,7 +29,13 @@ public class SelectConfig {
T2Csend.console(Util.getPrefix() + " ");
T2Csend.console(Util.getPrefix() + " §4----------------------");
if (yamlConfiguration.getInt("ConfigVersion") < 5) {
ConfigConverterUnderV5.convert();
ConfigConverter.convert();
}
if (yamlConfiguration.getInt("ConfigVersion") < 6) {
ConfigConverter.removeBungeeOption();
}
if (yamlConfiguration.getInt("ConfigVersion") < 7) {
ConfigConverter.convert7();
}
}
@ -40,6 +48,7 @@ public class SelectConfig {
language = yamlConfiguration.getString("Plugin.language");
Currency = yamlConfiguration.getString("Plugin.Currency");
DefaultGUI = yamlConfiguration.getString("Plugin.DefaultGUI");
prefix = T2Creplace.replace("", Objects.requireNonNull(yamlConfiguration.getString("Plugin.Prefix")));
storage = yamlConfiguration.getString("Storage.Type").toUpperCase();
@ -50,10 +59,6 @@ public class SelectConfig {
mysqlPassword = yamlConfiguration.getString("Storage.MySQL.Password");
mysqlSSL = yamlConfiguration.getBoolean("Storage.MySQL.SSL");
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
UseItem_Enable = yamlConfiguration.getBoolean("UseItem.Enable");
UseItem_AllowToggle = yamlConfiguration.getBoolean("UseItem.AllowToggle");
UseItem_AllowSetSlot = yamlConfiguration.getBoolean("UseItem.AllowSetSlot");
@ -192,7 +197,7 @@ public class SelectConfig {
Sound_OpenInventory = sound_OpenInventory;
}
} 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");
Sound_OpenInventory = Sound.valueOf(soundOpenInventory);
}
@ -285,11 +290,8 @@ public class SelectConfig {
private static String mysqlPassword;
private static Boolean mysqlSSL;
private static Boolean Bungee;
private static String thisServer;
private static String DefaultGUI;
private static String prefix;
private static Boolean UseItem_Enable;
private static Boolean UseItem_AllowToggle;
@ -433,18 +435,14 @@ public class SelectConfig {
return mysqlSSL;
}
public static Boolean getBungee() {
return Bungee;
}
public static String getThisServer() {
return thisServer;
}
public static String getDefaultGUI() {
return DefaultGUI;
}
public static String getPrefix() {
return prefix;
}
public static Boolean getUseItem_Enable() {
return UseItem_Enable;
}

View File

@ -1,5 +1,6 @@
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.config.functions.CreateFunctions;
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
@ -15,7 +16,22 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
public class ConfigConverterUnderV5 {
public class ConfigConverter {
public static void removeBungeeOption() {
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
yamlConfiguration.set("BungeeCord", null);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void renameMainFolder() {
if (new File("plugins/CommandGUI").exists() && !Main.getPath().exists()) {
File oldF = new File("plugins/CommandGUI");
@ -120,6 +136,7 @@ public class ConfigConverterUnderV5 {
String serverChangeServer = yamlConfigurationOld.getString("Slots." + key + ".ServerChange.Server");
Boolean openGUIEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".OpenGUI.Enable");
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");
String togglePermissionPerm = yamlConfigurationOld.getString("Slots." + key + ".Toggle.Permission.Permission");
Boolean toggleUseItem = yamlConfigurationOld.getBoolean("Slots." + key + ".Toggle.UseItem.Enable");
@ -149,7 +166,7 @@ public class ConfigConverterUnderV5 {
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,
serverChangeServer, openGUIEnable, openGUI,closeGUI, 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");
@ -219,4 +236,36 @@ public class ConfigConverterUnderV5 {
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,
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,
"", false, "", false,false, "", true, true,
Arrays.asList("&bYour UseItem was set to: %commandgui_useitem%&b."), false, "", "", "String",
"", false, 0, 0.0, Arrays.asList(), "", false,
0, 0.0, Arrays.asList(), false, "",
@ -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"),
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, Arrays.asList(), false, "", false, "", false,false, "",
false, true, Arrays.asList("&6You can find more information on Discord: &ehttp://dc.t2code.net"), false, "",
"", "String", "", false, 0, 0.0, Arrays.asList(),
"", false, 0, 0.0, Arrays.asList(), false, "",
@ -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,
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 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,
String configFilePath, String configOptionPath, String configOptionPremat, String configStringValueLeft, Boolean configBooleanValueLeft,
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.OpenGUI.Enable", openGUIEnable, 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.Permission", togglePermissionPerm == null ? "" : togglePermissionPerm, yamlConfiguration);

View File

@ -174,6 +174,6 @@ public class SelectMessages {
}
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

@ -18,6 +18,7 @@ import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.file.YamlConfiguration;
@ -48,6 +49,9 @@ public class GUIListener implements Listener {
if (player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, GUICode + gui.guiName))
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, player, GUICode + gui.guiName)))) {
e.setCancelled(true);
if (player.getOpenInventory().getTopInventory() != e.getClickedInventory()) {
continue;
}
for (Slot slot : gui.slots) {
execute(e, slot, player, gui);
}
@ -59,6 +63,7 @@ public class GUIListener implements Listener {
if (e.getSlot() != slot.slot) return;
Function function = Main.functionHashMap.get(slot.function);
if (slot.permission && !player.hasPermission(slot.permissionToSee)) return;
if (function.closeGUI_Enable) closeGUI(player);
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
if (function.noPermMessageEnable) {
if (function.customNoPermMessage == null || function.customNoPermMessage.equals("")) {
@ -89,6 +94,7 @@ public class GUIListener implements Listener {
if (function.toggleUseItem) return true;
if (function.command_Enable) return true;
if (function.openGUI_Enable) return true;
if (function.closeGUI_Enable) return true;
if (function.message_Enable) return true;
if (function.serverChange) return true;
if (function.setConfigEnable) return true;
@ -115,7 +121,7 @@ public class GUIListener implements Listener {
@Override
public void run() {
if (slot.command_BungeeCommand) {
if (SelectConfig.getBungee()) {
if (SelectLibConfig.getBungee()) {
for (String cmd : slot.command) {
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.commandAsConsole);
}
@ -144,6 +150,10 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 1L);
}
private static void closeGUI(Player player){
player.closeInventory();
}
private static void message(Function slot, Player player) {
player.closeInventory();
for (String msg : slot.message) {
@ -263,6 +273,10 @@ public class GUIListener implements Listener {
}
private static void toggleUseItem(Player player, Gui gui) {
if (!SelectConfig.getUseItem_AllowToggle()) {
T2Csend.sender(player, "§4UseItem toggle is disabled!");
return;
}
if (Events.useItemHashMap.get(player.getName())) {
Commands.itemOff(player);
} else {
@ -329,7 +343,11 @@ public class GUIListener implements Listener {
}
break;
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() {
@Override
public void run() {
@ -338,15 +356,15 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 1L);
T2Csend.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
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;
case VAULT:
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() {
@Override
public void run() {
@ -355,10 +373,6 @@ public class GUIListener implements Listener {
}.runTaskLater(plugin, 1L);
T2Csend.player(player, T2Creplace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
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;
}

View File

@ -9,17 +9,23 @@ import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
import net.t2code.commandguiv2.Spigot.system.Placeholder;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemBuilder;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import org.bukkit.Bukkit;
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 org.bukkit.profile.PlayerProfile;
import org.bukkit.profile.PlayerTextures;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.UUID;
public class GuiBuilder {
@ -80,9 +86,8 @@ public class GuiBuilder {
protected static void base64(String base64Value, Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);
ItemStack item = T2CitemVersion.getHeadIS();
ItemStack item = T2CitemBuilder.base64(base64Value);
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
setBase64(itemMeta, base64Value);
setDisplayNameAndLore(itemMeta, player, slot);
item.setItemMeta(itemMeta);
Integer am;
@ -93,18 +98,7 @@ public class GuiBuilder {
inventory.setItem(slot.slot, item);
}
private static void setBase64(ItemMeta itemMeta, String base64Value) {
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
profile.getProperties().put("textures", new Property("textures", base64Value == null ? "" : base64Value));
Field profileField;
try {
profileField = itemMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(itemMeta, profile);
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
e.printStackTrace();
}
}
protected static void base64(Slot slot, Player player, Inventory inventory) {
Function function = Main.functionHashMap.get(slot.function);

View File

@ -1,8 +1,9 @@
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.cmdManagement.CmdExecuter_GUI;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
@ -118,7 +119,7 @@ public class Obj_Select {
String name = yamlConfiguration.getString("Slots.Function.Item.Name");
List<String> lore = yamlConfiguration.getStringList("Slots.Function.Item.Lore");
if (yamlConfiguration.get("Slots.Function.NoPermission") == null) {
ConfigConverterUnderV5.noPermLore(yamlConfiguration, config);
ConfigConverter.noPermLore(yamlConfiguration, config);
}
Boolean noPermMessageEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Message.Enable");
String customNoPermMessage = yamlConfiguration.getString("Slots.Function.NoPermission.Message.CustomNoPermMessage");
@ -149,6 +150,7 @@ public class Obj_Select {
String serverChangeServer = yamlConfiguration.getString("Slots.Function.ServerChange.Server");
Boolean openGUI_Enable = yamlConfiguration.getBoolean("Slots.Function.OpenGUI.Enable");
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");
String togglePermissionPerm = yamlConfiguration.getString("Slots.Function.Toggle.Permission.Permission");
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,
noPermMessageEnable, customNoPermMessage, noPermLoreEnable, noPermLore,
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,
configDoubleValueLeft, configListValueLeft, configStringValueRight, configBooleanValueRight, configIntegerValueRight, configDoubleValueRight,
configListValueRight, pluginReloadEnable, pluginReloadCommand, functionVotePoints, functionVotePointsMode, functionVotePointsAmount,

View File

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

View File

@ -1,6 +1,6 @@
package net.t2code.commandguiv2.Spigot.system;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
import net.t2code.commandguiv2.Spigot.gui.GUIListener;
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
import net.t2code.commandguiv2.Spigot.useItem.EventsFrom110;
@ -28,6 +28,7 @@ import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
@ -49,7 +50,7 @@ public class Load {
T2Csend.console(prefix + " §8-------------------------------");
try {
ConfigConverterUnderV5.renameMainFolder();
ConfigConverter.renameMainFolder();
} catch (Exception e) {
e.printStackTrace();
}
@ -96,7 +97,7 @@ public class Load {
SelectConfig.setConfigVersion();
if (SelectConfig.getBungee()) {
if (SelectLibConfig.getBungee()) {
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "t2c:bcmd")) {
T2Csend.debug(plugin, "registerOutgoingPluginChannel §et2c:bcmd");
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");

View File

@ -2,7 +2,9 @@ package net.t2code.commandguiv2.Spigot.useItem;
import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@ -88,7 +90,7 @@ public class ItemChange {
return;
}
T2Csend.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
if (!SelectConfig.getBungee()) {
if (!SelectLibConfig.getBungee()) {
player.getInventory().setHeldItemSlot(slot - 1);
T2Csend.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
return;

View File

@ -6,6 +6,7 @@ import net.t2code.commandguiv2.Spigot.Main;
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
import net.t2code.commandguiv2.Util;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemBuilder;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
@ -48,35 +49,27 @@ public class UseItem {
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
T2Csend.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
T2Csend.error(Main.getPlugin(),"Playerheads for UseItem are only available from version 1.13!");
T2Csend.error(Main.getPlugin(), "Playerheads for UseItem are only available from version 1.13!");
} else {
SkullMeta playerheadmeta = null;
if (SelectConfig.getUseItem_Base64_Enable()) {
item = T2CitemBuilder.base64(SelectConfig.getUseItem_Base64value());
playerheadmeta = (SkullMeta) item.getItemMeta();
} else {
item = T2CitemVersion.getHeadIS();
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
if (SelectConfig.getUseItem_Base64_Enable()) {
if (Main.PaPi) {
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
profile.getProperties().put("textures", new Property("textures", SelectConfig.getUseItem_Base64value()));
Field profileField = null;
try {
profileField = playerheadmeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(playerheadmeta, profile);
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
e.printStackTrace();
}
} else {
playerheadmeta = (SkullMeta) item.getItemMeta();
String p;
if (SelectConfig.getUseItem_PlayerWhoHasOpenedTheGUI()) {
p = player.getName();
} else p = SelectConfig.getUseItem_PlayerName();
playerheadmeta.setOwner(p);
}
if (Main.PaPi) {
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
}
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
item.setItemMeta(playerheadmeta);
}
} else {

View File

@ -7,7 +7,7 @@ public class Util {
}
public static String getRequiredT2CodeLibVersion() {
return "13.4";
return "16.2";
}
public static String getPrefix() {
@ -35,6 +35,6 @@ public class Util {
}
public static Integer getConfigVersion() {
return 5;
return 7;
}
}

View File

@ -115,6 +115,9 @@ Slots:
# Here you can set which GUI should be opened.
# Use the file name of the GUI without .yml
GUI: ''
CloseGUI:
# Here you can set a function to close the GUI.
Enable: false
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)

View File

@ -2,12 +2,19 @@
#########################################
## Please do not change ConfigVersion! ##
#########################################
ConfigVersion: 5
ConfigVersion: 7
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
updateCheck:
# In this option you can set if players with the permission 'commandgui.updatemsg' will get an update message on join when an update for the plugin is available.
onJoin: true
# In this option you can set whether you want to receive and display beta and snapshot versions in the update check.
seePreReleaseUpdates: true
# In this option you can set the time interval in minutes in which updates should be checked.
timeInterval: 60
# 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
@ -33,13 +40,6 @@ Storage:
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