Compare commits

...

6 Commits
2.8.14 ... main

Author SHA1 Message Date
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
15 changed files with 99 additions and 83 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.14</version>
<version>2.8.16</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.2</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,12 +76,15 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
break;
}
} else {
if (sender instanceof Player) {
Player player = (Player) sender;
Commands.gui(player, args[0]);
return false;
if (!args[0].equalsIgnoreCase("updateinfo")){
if (sender instanceof Player) {
Player player = (Player) sender;
Commands.gui(player, args[0]);
return false;
}
Help.sendHelp(sender, prefix);
}
Help.sendHelp(sender, prefix);
}
}

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

@ -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);

View File

@ -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;
}

View File

@ -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");

View File

@ -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 {

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

@ -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");

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 {
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 {

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 6;
}
}

View File

@ -2,12 +2,19 @@
#########################################
## Please do not change ConfigVersion! ##
#########################################
ConfigVersion: 5
ConfigVersion: 6
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