small fix

This commit is contained in:
JaTiTV 2024-07-08 05:09:51 +02:00
parent 13af9faf36
commit 90696365dd
4 changed files with 28 additions and 15 deletions

View File

@ -54,7 +54,6 @@ public final class Main extends JavaPlugin {
autor = this.getDescription().getAuthors();
version = this.getDescription().getVersion();
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
Util.load();
if (T2C_McVersion.isMc1_8() || T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12() || T2C_McVersion.isMc1_13() ||
T2C_McVersion.isMc1_14() || T2C_McVersion.isMc1_15() || T2C_McVersion.isNms1_16_R1()) {
legacy = true;

View File

@ -174,18 +174,28 @@ public class Commands {
} else T2C_Send.player(player, Languages.VALUES.NoPermissionForCommand.getValue().toString().replace("[cmd]", "/commandgui")
.replace("[perm]", "commandgui.command"));
} else T2C_Send.player(player, Languages.VALUES.GUIIsDisabled.getValue().toString().replace("[gui]", gui.guiName));
} else {
T2C_Send.player(player, Languages.VALUES.guiNotFound.getValue().toString());
T2C_Send.error(Main.getPlugin(), "");
T2C_Send.console(Util.getPrefix()+ " <red>The gui <gold>[gui]</gold> that the player <gold>[player]</gold> wanted to open does not exist!".replace("[gui]", Config.VALUES.defaultGUI.getValue().toString()).replace("[player]", player.getName())); //todo in lang
T2C_Send.error(Main.getPlugin(), "");
}
}
public static void gui(Player player, String arg) {
if (Main.guiHashMap.containsKey(arg)) {
Gui gui = Main.guiHashMap.get(arg);
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, arg, true);
} else T2C_Send.player(player, Languages.VALUES.NoPermissionForCommand.getValue().toString().replace("[cmd]", "/commandgui " + gui.key)
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
} else T2C_Send.player(player, Languages.VALUES.GUIIsDisabled.getValue().toString().replace("[gui]", gui.key));
} else T2C_Send.player(player, Languages.VALUES.guiNotFound);
Gui gui = Main.guiHashMap.get(arg);
if (gui == null) {
T2C_Send.player(player, Languages.VALUES.guiNotFound.getValue().toString());
T2C_Send.error(Main.getPlugin(), "");
T2C_Send.console(Util.getPrefix()+ " <red>The gui <gold>[gui]</gold> that the player <gold>[player]</gold> wanted to open does not exist!".replace("[gui]", arg).replace("[player]", player.getName())); //todo in lang
T2C_Send.error(Main.getPlugin(), "");
return;
}
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
OpenGUI.openGUI(player, arg, true);
} else T2C_Send.player(player, Languages.VALUES.NoPermissionForCommand.getValue().toString().replace("[cmd]", "/commandgui " + gui.key)
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
} else T2C_Send.player(player, Languages.VALUES.GUIIsDisabled.getValue().toString().replace("[gui]", gui.key));
}
}

View File

@ -30,7 +30,15 @@ public class OpenGUI {
private static final String prefix = Util.getPrefix();
public static void openGUI(Player player, String guiString, Boolean sound) {
if (!Main.guiHashMap.containsKey(guiString)) {
T2C_Send.player(player, Languages.VALUES.guiNotFound.getValue().toString());
T2C_Send.error(Main.getPlugin(), "");
T2C_Send.console(Util.getPrefix() + " <red>The gui <gold>[gui]</gold> that the player <gold>[player]</gold> wanted to open does not exist!".replace("[gui]", guiString).replace("[player]", player.getName()));
T2C_Send.error(Main.getPlugin(), "");
return;
}
Gui gui = Main.guiHashMap.get(guiString);
long long_ = System.currentTimeMillis();
switch (guiString) {
//case "plugin.PlotSquaredGUI":

View File

@ -34,7 +34,7 @@ public class Util {
private static final String spigot = "https://www.spigotmc.org/resources/" + getSpigotID();
@Getter
private static String discord;
private static final String discord = "http://dc.t2code.net";
public static String[] getConfigLogo() {
ArrayList<String> arrayList = new ArrayList<>(T2C_Util.getConfigT2CodeLogo());
@ -42,10 +42,6 @@ public class Util {
return arrayList.toArray(new String[0]);
}
public static void load() {
discord = T2C_Util.getDiscord();
}
public static void replace(T2C_ConfigItem item) {
if (item.getValue() instanceof List) {
item.setValue(T2C_Replace.replace(Config.VALUES.prefix.getValue().toString(), (List<String>) item.getValue()));