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
This commit is contained in:
parent
a0026381af
commit
7768530c19
@ -6,10 +6,10 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>CommandGUI_V2</artifactId>
|
||||
<version>2.8.16_dev</version>
|
||||
<version>2.8.16</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandGUI</name>
|
||||
<name>T2C-CommandGUI</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
@ -76,7 +76,7 @@
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>15.9</version>
|
||||
<version>16.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -91,6 +91,13 @@
|
||||
<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>
|
||||
|
@ -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");
|
||||
|
||||
}
|
||||
|
@ -48,9 +48,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);
|
||||
|
@ -1,7 +1,7 @@
|
||||
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.messages.T2Creplace;
|
||||
@ -27,7 +27,10 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,10 +53,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");
|
||||
@ -285,10 +284,6 @@ 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 Boolean UseItem_Enable;
|
||||
@ -433,14 +428,6 @@ public class SelectConfig {
|
||||
return mysqlSSL;
|
||||
}
|
||||
|
||||
public static Boolean getBungee() {
|
||||
return Bungee;
|
||||
}
|
||||
|
||||
public static String getThisServer() {
|
||||
return thisServer;
|
||||
}
|
||||
|
||||
public static String getDefaultGUI() {
|
||||
return DefaultGUI;
|
||||
}
|
||||
|
@ -15,7 +15,21 @@ 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");
|
@ -1,5 +1,6 @@
|
||||
package net.t2code.commandguiv2.Spigot.gui;
|
||||
|
||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Help;
|
||||
import net.t2code.commandguiv2.Spigot.listener.ServerChange;
|
||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||
@ -18,6 +19,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;
|
||||
@ -118,7 +120,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);
|
||||
}
|
||||
@ -266,6 +268,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 {
|
||||
|
@ -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);
|
||||
|
@ -2,7 +2,7 @@ package net.t2code.commandguiv2.Spigot.objects;
|
||||
|
||||
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 +118,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");
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
item = T2CitemVersion.getHeadIS();
|
||||
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
|
||||
|
||||
SkullMeta playerheadmeta = null;
|
||||
|
||||
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();
|
||||
}
|
||||
item = T2CitemBuilder.base64(SelectConfig.getUseItem_Base64value());
|
||||
playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||
} else {
|
||||
item = T2CitemVersion.getHeadIS();
|
||||
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()));
|
||||
}
|
||||
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 {
|
||||
|
@ -7,7 +7,7 @@ public class Util {
|
||||
}
|
||||
|
||||
public static String getRequiredT2CodeLibVersion() {
|
||||
return "15.9";
|
||||
return "16.2";
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
@ -35,6 +35,6 @@ public class Util {
|
||||
}
|
||||
|
||||
public static Integer getConfigVersion() {
|
||||
return 5;
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#########################################
|
||||
## Please do not change ConfigVersion! ##
|
||||
#########################################
|
||||
ConfigVersion: 5
|
||||
ConfigVersion: 6
|
||||
|
||||
Plugin:
|
||||
# Here you can set the debug mode of the plugin.
|
||||
@ -40,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
|
||||
|
Loading…
Reference in New Issue
Block a user