Compare commits
No commits in common. "main" and "2.8.18" have entirely different histories.
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>CommandGUI_V2</artifactId>
|
<artifactId>CommandGUI_V2</artifactId>
|
||||||
<version>2.9_dev-24</version>
|
<version>2.8.18</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>T2C-CommandGUI</name>
|
<name>T2C-CommandGUI</name>
|
||||||
@ -24,8 +24,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>11</source>
|
<source>8</source>
|
||||||
<target>11</target>
|
<target>8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -76,8 +76,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>16.7</version>
|
<version>16.4</version>
|
||||||
<classifier>dev-24</classifier>
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -135,15 +134,21 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zaxxer</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
<artifactId>HikariCP</artifactId>
|
<artifactId>HikariCP</artifactId>
|
||||||
<!--version>4.0.3</version-->
|
<version>4.0.3</version>
|
||||||
<version>5.1.0</version>
|
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
<version>1.18.30</version>
|
<version>1.7.10</version>
|
||||||
<scope>provided</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>1.7.22</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
package net.t2code.commandguiv2.Spigot;
|
package net.t2code.commandguiv2.Spigot;
|
||||||
|
|
||||||
import lombok.Getter;
|
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Function;
|
|
||||||
import net.t2code.commandguiv2.Spigot.system.Load;
|
import net.t2code.commandguiv2.Spigot.system.Load;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.database.MySQL;
|
import net.t2code.commandguiv2.Spigot.database.MySQL;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Plugman;
|
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -21,7 +19,7 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public final class Main extends JavaPlugin {
|
public final class Main extends JavaPlugin {
|
||||||
|
|
||||||
public static ArrayList<String> proxyJoinPlayers = new ArrayList<>();
|
public static ArrayList<String> bungeejoinplayers = new ArrayList<>();
|
||||||
|
|
||||||
public static File getPath() {
|
public static File getPath() {
|
||||||
return plugin.getDataFolder();
|
return plugin.getDataFolder();
|
||||||
@ -34,7 +32,6 @@ public final class Main extends JavaPlugin {
|
|||||||
|
|
||||||
public static List<String> autor;
|
public static List<String> autor;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static Main plugin;
|
private static Main plugin;
|
||||||
|
|
||||||
public static Boolean PaPi = false;
|
public static Boolean PaPi = false;
|
||||||
@ -54,25 +51,25 @@ public final class Main extends JavaPlugin {
|
|||||||
autor = this.getDescription().getAuthors();
|
autor = this.getDescription().getAuthors();
|
||||||
version = this.getDescription().getVersion();
|
version = this.getDescription().getVersion();
|
||||||
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
||||||
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() ||
|
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12() || T2CmcVersion.isMc1_13() ||
|
||||||
T2C_McVersion.isMc1_14() || T2C_McVersion.isMc1_15() || T2C_McVersion.isNms1_16_R1()) {
|
T2CmcVersion.isMc1_14() || T2CmcVersion.isMc1_15() || T2CmcVersion.isNms1_16_R1()) {
|
||||||
legacy = true;
|
legacy = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (T2C_PluginCheck.pluginCheck("CommandGUI")) {
|
if (T2CpluginCheck.pluginCheck("CommandGUI")) {
|
||||||
T2C_Send.error( plugin, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.error( plugin, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
T2C_Send.error( plugin,"");
|
T2Csend.error( plugin,"");
|
||||||
T2C_Send.error( plugin,"An older version of the plugin T2C-CommandGUI was found!");
|
T2Csend.error( plugin,"An older version of the plugin T2C-CommandGUI was found!");
|
||||||
T2C_Send.error( plugin,"This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
|
T2Csend.error( plugin,"This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
|
||||||
T2C_Send.error( plugin,"Please remove the older version (CommandGUI)!");
|
T2Csend.error( plugin,"Please remove the older version (CommandGUI)!");
|
||||||
T2C_Send.error( plugin,this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
|
T2Csend.error( plugin,this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
|
||||||
T2C_Send.error( plugin,"");
|
T2Csend.error( plugin,"");
|
||||||
T2C_Send.error( plugin,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.error( plugin,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||||
if (T2C_PluginCheck.papi()) {
|
if (T2CpluginCheck.papi()) {
|
||||||
PaPi = true;
|
PaPi = true;
|
||||||
}
|
}
|
||||||
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
|
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
|
||||||
@ -80,24 +77,24 @@ public final class Main extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addonLoad() {
|
public static void addonLoad() {
|
||||||
if (T2C_PluginCheck.plotSquaredGUI()) {
|
if (T2CpluginCheck.plotSquaredGUI()) {
|
||||||
PlotSquaredGUI = true;
|
PlotSquaredGUI = true;
|
||||||
addonEnable(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI")));
|
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (T2C_PluginCheck.luckyBox()) {
|
if (T2CpluginCheck.luckyBox()) {
|
||||||
LuckyBox = true;
|
LuckyBox = true;
|
||||||
addonEnable(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox")));
|
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (T2C_PluginCheck.plugManGUI()) {
|
if (T2CpluginCheck.plugManGUI()) {
|
||||||
PlugManGUI = true;
|
PlugManGUI = true;
|
||||||
addonEnable(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("PlugManGUI")));
|
addonEnable(Bukkit.getPluginManager().getPlugin("PlugManGUI"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addonEnable(Plugin plugin) {
|
public static void addonEnable(Plugin plugin) {
|
||||||
T2C_Send.console(Util.getPrefix() + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
|
T2Csend.console(Util.getPrefix() + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
||||||
@ -108,7 +105,7 @@ public final class Main extends JavaPlugin {
|
|||||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
String plVer = Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(pl)).getDescription().getVersion();
|
String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
|
||||||
if (ver.contains("_")) {
|
if (ver.contains("_")) {
|
||||||
if (!plVer.equals(ver)) {
|
if (!plVer.equals(ver)) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||||
@ -134,15 +131,17 @@ public final class Main extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void sendTryCatch(Class c, StackTraceElement line) {
|
public static void sendTryCatch(Class c, StackTraceElement line) {
|
||||||
T2C_Send.error(plugin,c.getName() + " Line: " + line.getLineNumber());
|
T2Csend.error(plugin,c.getName() + " Line: " + line.getLineNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// Plugin shutdown logic
|
// Plugin shutdown logic
|
||||||
if (enable) T2C_Template.onDisable(Util.getPrefix(), plugin);
|
if (enable) T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||||
Plugman.unLoad();
|
|
||||||
MySQL.close();
|
MySQL.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Main getPlugin() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.gui.GuiFile;
|
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.commands.T2C_Tab;
|
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -24,13 +24,13 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(Languages.VALUES.OnlyForPlayer.getValue().toString());
|
sender.sendMessage(SelectMessages.OnlyForPlayer);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
Commands.gui(player);
|
Commands.gui(player);
|
||||||
} else {
|
} else {
|
||||||
if (args[0].equals(Config.VALUES.adminSubCommand.getValue().toString())) {
|
if (args[0].equals(SelectConfig.getAdminSubCommand())) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
Help.sendHelp(sender, prefix);
|
Help.sendHelp(sender, prefix);
|
||||||
return false;
|
return false;
|
||||||
@ -44,21 +44,21 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||||||
case "ver":
|
case "ver":
|
||||||
if (sender.hasPermission("commandgui.command.info")) {
|
if (sender.hasPermission("commandgui.command.info")) {
|
||||||
Commands.info(sender);
|
Commands.info(sender);
|
||||||
} else sender.sendMessage(Languages.VALUES.NoPermissionForCommand.getValue().toString()
|
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.command.info"));
|
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.command.info"));
|
||||||
break;
|
break;
|
||||||
case "reload":
|
case "reload":
|
||||||
case "rl":
|
case "rl":
|
||||||
if (sender.hasPermission("commandgui.admin")) {
|
if (sender.hasPermission("commandgui.admin")) {
|
||||||
Commands.reload(sender);
|
Commands.reload(sender);
|
||||||
} else sender.sendMessage(Languages.VALUES.NoPermissionForCommand.getValue().toString()
|
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||||
break;
|
break;
|
||||||
case "createdefaultgui":
|
case "createdefaultgui":
|
||||||
if (sender.hasPermission("commandgui.admin")) {
|
if (sender.hasPermission("commandgui.admin")) {
|
||||||
GuiFile.createDefault(true);
|
CreateGUI.configCreate();
|
||||||
sender.sendMessage(Languages.VALUES.DefaultGUIcreate.getValue().toString().replace("[directory]", Main.getPath() + "/GUIs/default.yml"));
|
sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "/GUIs/default.yml"));
|
||||||
} else sender.sendMessage(Languages.VALUES.NoPermissionForCommand.getValue().toString()
|
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
||||||
break;
|
break;
|
||||||
case "give":
|
case "give":
|
||||||
@ -66,7 +66,7 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||||||
if (sender.hasPermission("commandgui.giveitem.other")) {
|
if (sender.hasPermission("commandgui.giveitem.other")) {
|
||||||
Player target = Bukkit.getPlayer(args[2]);
|
Player target = Bukkit.getPlayer(args[2]);
|
||||||
Commands.give(sender, target);
|
Commands.give(sender, target);
|
||||||
} else sender.sendMessage(Languages.VALUES.NoPermissionForCommand.getValue().toString().replace("[cmd]", "/commandgui give")
|
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui give")
|
||||||
.replace("[perm]", "commandgui.command.give"));
|
.replace("[perm]", "commandgui.command.give"));
|
||||||
} else Help.sendHelp(sender, prefix);
|
} else Help.sendHelp(sender, prefix);
|
||||||
break;
|
break;
|
||||||
@ -107,9 +107,9 @@ public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
|
|
||||||
T2C_Tab.tab(list, sender, 0, args, arg1);
|
T2Ctab.tab(list, sender, 0, args, arg1);
|
||||||
T2C_Tab.tab(list, sender, 0, Config.VALUES.adminSubCommand.getValue().toString(), 1, args, arg2);
|
T2Ctab.tab(list, sender, 0, SelectConfig.getAdminSubCommand(), 1, args, arg2);
|
||||||
T2C_Tab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
|
T2Ctab.tab(list, sender, 1, "give", 2, args, "commandgui.giveitem.other", true);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -19,16 +19,16 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
Player player = (Player) sender;
|
||||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
if ((boolean)Config.VALUES.useItemAllowToggle.getValue()) {
|
if (SelectConfig.getUseItem_AllowToggle()) {
|
||||||
Help.sendGUIItemHelp(sender);
|
Help.sendGUIItemHelp(sender);
|
||||||
} else T2C_Send.sender(sender, "§4UseItem toggle is disabled!");//todo in lang file
|
} else T2Csend.sender(sender, "§4UseItem toggle is disabled!");// todo
|
||||||
} else {
|
} else {
|
||||||
if (args.length == 1 || args.length == 2) {
|
if (args.length == 1 || args.length == 2) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
if (SelectConfig.getUseItem_AllowToggle()) {
|
||||||
if ((boolean) Config.VALUES.useItemAllowToggle.getValue()) {
|
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "on":
|
case "on":
|
||||||
Commands.itemOn(player);
|
Commands.itemOn(player);
|
||||||
@ -41,21 +41,21 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||||||
try {
|
try {
|
||||||
Commands.onSetSlot(player, Integer.valueOf(args[1]));
|
Commands.onSetSlot(player, Integer.valueOf(args[1]));
|
||||||
} catch (Exception e5) {
|
} catch (Exception e5) {
|
||||||
T2C_Send.player(player, Languages.VALUES.ItemSlot_wrongValue.getValue().toString());
|
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else T2C_Send.player(player, "§4Use: §7/gui-item slot [slot]"); //todo in lang file
|
} else T2Csend.player(player, "§4Use: §7/gui-item slot [slot]");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Help.sendHelp(player, prefix);
|
Help.sendHelp(player, prefix);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else T2C_Send.sender(sender, "§4UseItem toggle is disabled!");//todo in lang file
|
} else T2Csend.sender(sender, "§4UseItem toggle is disabled!");// todo
|
||||||
} else sender.sendMessage(Languages.VALUES.OnlyForPlayer.getValue().toString());
|
} else sender.sendMessage(SelectMessages.OnlyForPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else sender.sendMessage(Languages.VALUES.NoPermissionForCommand.getValue().toString().replace("[cmd]", "/commandgui-item")
|
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui-item")
|
||||||
.replace("[perm]", "commandgui.useitem.toggle"));
|
.replace("[perm]", "commandgui.useitem.toggle"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||||
put("on", "commandgui.useitem.toggle");
|
put("on", "commandgui.useitem.toggle");
|
||||||
put("off", "commandgui.useitem.toggle");
|
put("off", "commandgui.useitem.toggle");
|
||||||
if ((boolean)Config.VALUES.useItemAllowSetSlot.getValue()) {
|
if (SelectConfig.getUseItem_AllowSetSlot()) {
|
||||||
put("slot", "commandgui.useitem.toggle");
|
put("slot", "commandgui.useitem.toggle");
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
@ -74,7 +74,7 @@ public class CmdExecuter_GUIItem implements CommandExecutor, TabCompleter {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
if ((boolean)Config.VALUES.useItemAllowToggle.getValue()) {
|
if (SelectConfig.getUseItem_AllowToggle()) {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
for (String command : arg1.keySet()) {
|
for (String command : arg1.keySet()) {
|
||||||
|
@ -1,24 +1,23 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.functions.FunctionsFile;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.gui.GuiFile;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
||||||
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.UseItem;
|
import net.t2code.commandguiv2.Spigot.useItem.UseItem;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -27,35 +26,36 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class Commands {
|
public class Commands {
|
||||||
public static void info(CommandSender sender) {
|
public static void info(CommandSender sender) {
|
||||||
T2C_Template.sendInfo(sender, Main.getPlugin(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText());
|
T2Ctemplate.sendInfo(sender, Main.getPlugin(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reload(CommandSender sender) {
|
public static void reload(CommandSender sender) {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(Main.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(Main.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (sender instanceof Player) sender.sendMessage(Languages.VALUES.ReloadStart.getValue().toString());
|
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadStart);
|
||||||
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
|
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||||
T2C_Send.console(Util.getPrefix() + " §6Plugin reload...");
|
T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
|
||||||
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
|
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||||
Config.set(true);
|
SelectConfig.onSelect();
|
||||||
Main.getPlugin().reloadConfig();
|
Main.getPlugin().reloadConfig();
|
||||||
|
|
||||||
CmdExecuter_GUI.arg1.clear();
|
CmdExecuter_GUI.arg1.clear();
|
||||||
CmdExecuter_GUI.arg1.put(Config.VALUES.adminSubCommand.getValue().toString(), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||||
|
|
||||||
if (!Objects.equals(SelectDatabase.getStorage().toString(), Config.VALUES.storage.getValue().toString())) {
|
if (!Objects.equals(SelectDatabase.getStorage().toString(), SelectConfig.getStorage())) {
|
||||||
if (sender instanceof Player) T2C_Send.sender(sender, "You have changed the storage medium! To apply this change, you must restart the server!");
|
if (sender instanceof Player) T2Csend.sender(sender, "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||||
T2C_Send.warning(Main.getPlugin(), "You have changed the storage medium! To apply this change, you must restart the server!");
|
T2Csend.warning(Main.getPlugin(), "You have changed the storage medium! To apply this change, you must restart the server!");
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionsFile.select(true);
|
LanguagesCreate.langCreate();
|
||||||
GuiFile.set(true);
|
|
||||||
Languages.set(true);
|
Obj_Select.onSelect();
|
||||||
Config.checkSounds();
|
SelectMessages.onSelect(Util.getPrefix());
|
||||||
|
SelectConfig.sound(Util.getPrefix());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AliasRegister.onRegister(true);
|
AliasRegister.onRegister();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -65,15 +65,15 @@ public class Commands {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (T2C_Main.isProxy()) {
|
if (SelectLibConfig.getBungee()) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.getPlugin(), "commandgui:bungee");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.getPlugin(), "commandgui:bungee");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender instanceof Player) sender.sendMessage(Languages.VALUES.ReloadEnd.getValue().toString());
|
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadEnd);
|
||||||
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
|
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||||
T2C_Send.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
|
T2Csend.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
|
||||||
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
|
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -81,11 +81,11 @@ public class Commands {
|
|||||||
public static void give(CommandSender sender, Player target) {
|
public static void give(CommandSender sender, Player target) {
|
||||||
if (Bukkit.getPlayer(target.getName()) != null) {
|
if (Bukkit.getPlayer(target.getName()) != null) {
|
||||||
UseItem.giveUseItem(target);
|
UseItem.giveUseItem(target);
|
||||||
T2C_Send.sender(sender, Languages.VALUES.Give_Sender.getValue().toString().replace("[player]", target.getName()).replace("[item]", Config.VALUES.useItemName.getValue().toString()));
|
T2Csend.sender(sender, SelectMessages.Give_Sender.replace("[player]", target.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
|
||||||
T2C_Send.player(target, Languages.VALUES.Give_Receiver.getValue().toString().replace("[sender]", sender.getName()).replace("[item]", Config.VALUES.useItemName.getValue().toString()));
|
T2Csend.player(target, SelectMessages.Give_Receiver.replace("[sender]", sender.getName()).replace("[item]", SelectConfig.getUseItem_Name()));
|
||||||
Sound.play(target, SoundEnum.Give);
|
Sound.play(target, SoundEnum.Give);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(Languages.VALUES.PlayerNotFond.getValue().toString().replace("[player]", target.getName()));
|
sender.sendMessage(SelectMessages.PlayerNotFond.replace("[player]", target.getName()));
|
||||||
if (sender instanceof Player) Sound.play((Player) sender, SoundEnum.PlayerNotFound);
|
if (sender instanceof Player) Sound.play((Player) sender, SoundEnum.PlayerNotFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,12 +93,12 @@ public class Commands {
|
|||||||
public static void itemOn(Player player) {
|
public static void itemOn(Player player) {
|
||||||
UseItem.removeItem(player);
|
UseItem.removeItem(player);
|
||||||
Integer slot = null;
|
Integer slot = null;
|
||||||
if ((boolean) Config.VALUES.useItemInventorySlotEnforce.getValue()) {
|
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
|
||||||
slot = (int) Config.VALUES.useItemInventorySlot.getValue();
|
slot = SelectConfig.getUseItem_InventorySlot();
|
||||||
} else {
|
} else {
|
||||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||||
}
|
}
|
||||||
T2C_Debug.debug(Main.getPlugin(), String.valueOf(slot));
|
T2Csend.debug(Main.getPlugin(), String.valueOf(slot));
|
||||||
if (player.getInventory().getItem(slot - 1) == null) {
|
if (player.getInventory().getItem(slot - 1) == null) {
|
||||||
SelectDatabase.setItemStatusTrue(player);
|
SelectDatabase.setItemStatusTrue(player);
|
||||||
UseItem.giveUseItem(player);
|
UseItem.giveUseItem(player);
|
||||||
@ -113,9 +113,9 @@ public class Commands {
|
|||||||
if (empty) {
|
if (empty) {
|
||||||
SelectDatabase.setItemStatusTrue(player);
|
SelectDatabase.setItemStatusTrue(player);
|
||||||
UseItem.addUseItem(player);
|
UseItem.addUseItem(player);
|
||||||
T2C_Send.player(player, Languages.VALUES.ItemON);
|
T2Csend.player(player, SelectMessages.ItemON);
|
||||||
} else {
|
} else {
|
||||||
T2C_Send.player(player, Languages.VALUES.NoInventorySpace);
|
T2Csend.player(player, SelectMessages.NoInventorySpace);
|
||||||
Sound.play(player, SoundEnum.NoInventorySpace);
|
Sound.play(player, SoundEnum.NoInventorySpace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,33 +124,33 @@ public class Commands {
|
|||||||
public static void itemOff(Player player) {
|
public static void itemOff(Player player) {
|
||||||
SelectDatabase.setItemStatusFalse(player);
|
SelectDatabase.setItemStatusFalse(player);
|
||||||
UseItem.removeItem(player);
|
UseItem.removeItem(player);
|
||||||
T2C_Send.player(player, Languages.VALUES.ItemOFF);
|
T2Csend.player(player, SelectMessages.ItemOFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onSetSlot(Player player, Integer setSlot) {
|
public static void onSetSlot(Player player, Integer setSlot) {
|
||||||
if (!(boolean) Config.VALUES.useItemAllowSetSlot.getValue()) {
|
if (!SelectConfig.getUseItem_AllowSetSlot()) {
|
||||||
T2C_Send.player(player, Util.getPrefix() + " §4Function disabled");
|
T2Csend.player(player, Util.getPrefix() + " §4Function disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setSlot < 1) {
|
if (setSlot < 1) {
|
||||||
T2C_Send.player(player, Languages.VALUES.ItemSlot_wrongValue);
|
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (setSlot > 9) {
|
if (setSlot > 9) {
|
||||||
T2C_Send.player(player, Languages.VALUES.ItemSlot_wrongValue);
|
T2Csend.player(player, SelectMessages.ItemSlot_wrongValue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Events.useItemHashMap.get(player.getName())) {
|
if (Events.useItemHashMap.get(player.getName())) {
|
||||||
if (Objects.equals(Events.useItemSlotHashMap.get(player.getName()), setSlot)) {
|
if (Objects.equals(Events.useItemSlotHashMap.get(player.getName()), setSlot)) {
|
||||||
T2C_Send.player(player, Languages.VALUES.ItemSlotAlreadySet.getValue().toString().replace("[slot]", setSlot.toString()));
|
T2Csend.player(player, SelectMessages.ItemSlotAlreadySet.replace("[slot]", setSlot.toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((boolean) Config.VALUES.useItemInventorySlotEnforce.getValue() || player.getInventory().getItem(setSlot - 1) != null) {
|
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(setSlot - 1) != null) {
|
||||||
T2C_Send.player(player, Languages.VALUES.ItemSlotNotEmpty.getValue().toString().replace("[slot]", setSlot.toString()));
|
T2Csend.player(player, SelectMessages.ItemSlotNotEmpty.replace("[slot]", setSlot.toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,40 +162,30 @@ public class Commands {
|
|||||||
UseItem.giveUseItem(player);
|
UseItem.giveUseItem(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
T2C_Send.player(player, Languages.VALUES.ItemSlot.getValue().toString().replace("[slot]", setSlot.toString()));
|
T2Csend.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void gui(Player player) {
|
public static void gui(Player player) {
|
||||||
if (Main.guiHashMap.containsKey(Config.VALUES.defaultGUI.getValue().toString())) {
|
if (Main.guiHashMap.containsKey(SelectConfig.getDefaultGUI())) {
|
||||||
Gui gui = Main.guiHashMap.get(Config.VALUES.defaultGUI.getValue().toString());
|
Gui gui = Main.guiHashMap.get(SelectConfig.getDefaultGUI());
|
||||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command") || player.hasPermission("commandgui.bypass")) {
|
||||||
OpenGUI.openGUI(player, Config.VALUES.defaultGUI.toString(), true);
|
OpenGUI.openGUI(player, SelectConfig.getDefaultGUI(), true);
|
||||||
} else T2C_Send.player(player, Languages.VALUES.NoPermissionForCommand.getValue().toString().replace("[cmd]", "/commandgui")
|
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui")
|
||||||
.replace("[perm]", "commandgui.command"));
|
.replace("[perm]", "commandgui.command"));
|
||||||
} else T2C_Send.player(player, Languages.VALUES.GUIIsDisabled.getValue().toString().replace("[gui]", gui.guiName));
|
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.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) {
|
public static void gui(Player player, String arg) {
|
||||||
|
if (Main.guiHashMap.containsKey(arg)) {
|
||||||
Gui gui = Main.guiHashMap.get(arg);
|
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.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
|
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + gui.key) || player.hasPermission("commandgui.bypass")) {
|
||||||
OpenGUI.openGUI(player, arg, true);
|
OpenGUI.openGUI(player, arg, true);
|
||||||
} else T2C_Send.player(player, Languages.VALUES.NoPermissionForCommand.getValue().toString().replace("[cmd]", "/commandgui " + gui.key)
|
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + gui.key)
|
||||||
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
|
.replace("[perm]", "commandgui.command." + arg.toLowerCase()));
|
||||||
} else T2C_Send.player(player, Languages.VALUES.GUIIsDisabled.getValue().toString().replace("[gui]", gui.key));
|
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", gui.key));
|
||||||
|
} else T2Csend.player(player, SelectMessages.guiNotFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Help {
|
public class Help {
|
||||||
private static final String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
public static void sendHelp(CommandSender sender, String Prefix) {
|
public static void sendHelp(CommandSender sender, String Prefix) {
|
||||||
Gui gui = Main.guiHashMap.get(Config.VALUES.defaultGUI.getValue().toString());
|
Gui gui = Main.guiHashMap.get(SelectConfig.getDefaultGUI());
|
||||||
|
|
||||||
T2C_Send.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
|
T2Csend.sender(sender, Prefix + " §8----- §4Command§9GUI §chelp §8-----");
|
||||||
cgui(sender, gui);
|
cgui(sender, gui);
|
||||||
open(sender);
|
open(sender);
|
||||||
help(sender);
|
help(sender);
|
||||||
@ -25,7 +25,7 @@ public class Help {
|
|||||||
give(sender);
|
give(sender);
|
||||||
createDefaultGUI(sender);
|
createDefaultGUI(sender);
|
||||||
reload(sender);
|
reload(sender);
|
||||||
T2C_Send.sender(sender, Prefix + " §8-------------------------");
|
T2Csend.sender(sender, Prefix + " §8-------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -33,8 +33,8 @@ public class Help {
|
|||||||
if (!sender.hasPermission("commandgui.command")) return;
|
if (!sender.hasPermission("commandgui.command")) return;
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerHelpCgui.getValue().toString().replace("[gui]", T2C_Replace.replace(prefix, gui.guiName)));
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpCgui.replace("[gui]", T2Creplace.replace(prefix, gui.guiName)));
|
||||||
} else T2C_Send.sender(sender, prefix + " " + Languages.VALUES.HelpCgui.getValue().toString().replace("[gui]", T2C_Replace.replace(prefix, gui.guiName)));
|
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpCgui.replace("[gui]", T2Creplace.replace(prefix, gui.guiName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void open(CommandSender sender) {
|
private static void open(CommandSender sender) {
|
||||||
@ -43,9 +43,9 @@ public class Help {
|
|||||||
for (String alias : Main.allAliases) {
|
for (String alias : Main.allAliases) {
|
||||||
if (Main.guiHashMap.get(alias).guiEnable || sender.hasPermission("commandgui.bypass")) {
|
if (Main.guiHashMap.get(alias).guiEnable || sender.hasPermission("commandgui.bypass")) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerHelpOpen.getValue().toString().replace("[gui]", alias).replace("[guiname]", T2C_Replace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpOpen.replace("[gui]", alias).replace("[guiname]", T2Creplace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
|
||||||
} else
|
} else
|
||||||
T2C_Send.sender(sender, prefix + " " + Languages.VALUES.HelpOpen.getValue().toString().replace("[gui]", alias).replace("[guiname]", T2C_Replace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
|
T2Csend.sender(sender, prefix + " " + SelectMessages.HelpOpen.replace("[gui]", alias).replace("[guiname]", T2Creplace.replace(prefix, Main.guiHashMap.get(alias).guiName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,59 +54,59 @@ public class Help {
|
|||||||
if (!sender.hasPermission("commandgui.command")) return;
|
if (!sender.hasPermission("commandgui.command")) return;
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerHelpHelp);
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpHelp);
|
||||||
} else T2C_Send.sender(sender, prefix + " " + Languages.VALUES.HelpHelp);
|
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpHelp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void info(CommandSender sender) {
|
private static void info(CommandSender sender) {
|
||||||
if (!sender.hasPermission("commandgui.command.info")) return;
|
if (!sender.hasPermission("commandgui.command.info")) return;
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerHelpInfo);
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpInfo);
|
||||||
} else T2C_Send.sender(sender, prefix + " " + Languages.VALUES.HelpInfo);
|
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void give(CommandSender sender) {
|
private static void give(CommandSender sender) {
|
||||||
if (!sender.hasPermission("commandgui.admin")) return;
|
if (!sender.hasPermission("commandgui.admin")) return;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerHelpGive);
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpGive);
|
||||||
} else T2C_Send.sender(sender, prefix + " " + Languages.VALUES.HelpGive);
|
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpGive);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createDefaultGUI(CommandSender sender) {
|
private static void createDefaultGUI(CommandSender sender) {
|
||||||
if (!sender.hasPermission("commandgui.admin")) return;
|
if (!sender.hasPermission("commandgui.admin")) return;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerHelpCreateDefaultGUI.getValue().toString().replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpCreateDefaultGUI.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
||||||
} else T2C_Send.sender(sender, prefix + " " + Languages.VALUES.HelpCreateDefaultGUI.getValue().toString().replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpCreateDefaultGUI.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void reload(CommandSender sender) {
|
private static void reload(CommandSender sender) {
|
||||||
if (!sender.hasPermission("commandgui.admin")) return;
|
if (!sender.hasPermission("commandgui.admin")) return;
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerHelpReload);
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerHelpReload);
|
||||||
} else T2C_Send.sender(sender, prefix + " " + Languages.VALUES.HelpReload);
|
} else T2Csend.sender(sender, prefix + " " + SelectMessages.HelpReload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void gUIItemHelp(CommandSender sender) {
|
public static void gUIItemHelp(CommandSender sender) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerGUIItemHelp_on);
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerGUIItemHelp_on);
|
||||||
} else T2C_Send.sender(sender, prefix + " " + Languages.VALUES.GUIItemHelp_on);
|
} else T2Csend.sender(sender, prefix + " " + SelectMessages.GUIItemHelp_on);
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerGUIItemHelp_off);
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerGUIItemHelp_off);
|
||||||
} else T2C_Send.sender(sender, prefix + " " + Languages.VALUES.GUIItemHelp_off);
|
} else T2Csend.sender(sender, prefix + " " + SelectMessages.GUIItemHelp_off);
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2C_Send.player((Player) sender, prefix + " " + Languages.VALUES.PlayerGUIItemHelp_Slot);
|
T2Csend.player((Player) sender, prefix + " " + SelectMessages.PlayerGUIItemHelp_Slot);
|
||||||
} else T2C_Send.sender(sender, prefix + " " + Languages.VALUES.GUIItemHelp_Slot);
|
} else T2Csend.sender(sender, prefix + " " + SelectMessages.GUIItemHelp_Slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendGUIItemHelp(CommandSender sender) {
|
public static void sendGUIItemHelp(CommandSender sender) {
|
||||||
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
if (sender.hasPermission("commandgui.useitem.toggle")) {
|
||||||
T2C_Send.sender(sender, prefix + " §8------ §4Command§9GUI§2Item §chelp §8------");
|
T2Csend.sender(sender, prefix + " §8------ §4Command§9GUI§2Item §chelp §8------");
|
||||||
gUIItemHelp(sender);
|
gUIItemHelp(sender);
|
||||||
T2C_Send.sender(sender, prefix + " §8------------------------------");
|
T2Csend.sender(sender, prefix + " §8------------------------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,7 @@ package net.t2code.commandguiv2.Spigot.cmdManagement.register;
|
|||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandMap;
|
import org.bukkit.command.CommandMap;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -13,11 +11,11 @@ import java.lang.reflect.Field;
|
|||||||
|
|
||||||
|
|
||||||
public class AliasRegister {
|
public class AliasRegister {
|
||||||
public static void onRegister(boolean isReload) {
|
public static void onRegister() {
|
||||||
Plugin plugin = Main.getPlugin();
|
Plugin plugin = Main.getPlugin();
|
||||||
T2C_Debug.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
|
T2Csend.debug(plugin, Bukkit.getServer().getClass().getPackage().getName());
|
||||||
if (Main.allAliases.toString().equals("[]")) {
|
if (Main.allAliases.toString().equals("[]")) {
|
||||||
T2C_Send.sendStartTextCenter(Util.getPrefix(),"§4No GUI files available",isReload);
|
T2Csend.console(Util.getPrefix() + " §4No GUI files available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (String alias : Main.allAliases) {
|
for (String alias : Main.allAliases) {
|
||||||
@ -27,7 +25,7 @@ public class AliasRegister {
|
|||||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||||
bukkitCommandMap.setAccessible(true);
|
bukkitCommandMap.setAccessible(true);
|
||||||
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
||||||
commandMap.register(Main.getPlugin().getName(), new RegisterCommand(alias));
|
commandMap.register(alias, new RegisterCommand(alias));
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -2,17 +2,16 @@ package net.t2code.commandguiv2.Spigot.cmdManagement.register;
|
|||||||
|
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
|
||||||
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class RegisterCommand extends Command {
|
public class RegisterCommand extends Command {
|
||||||
private final String alias;
|
private String alias;
|
||||||
|
|
||||||
public RegisterCommand(String alias) {
|
public RegisterCommand(String alias) {
|
||||||
super(alias);
|
super(alias);
|
||||||
@ -20,7 +19,7 @@ public class RegisterCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, String[] args) {
|
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
@ -28,9 +27,9 @@ public class RegisterCommand extends Command {
|
|||||||
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
if (gui.guiEnable || player.hasPermission("commandgui.bypass")) {
|
||||||
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
if (!gui.commandPermissionEnable || player.hasPermission("commandgui.command." + alias) || player.hasPermission("commandgui.bypass")) {
|
||||||
OpenGUI.openGUI(player, alias, true);
|
OpenGUI.openGUI(player, alias, true);
|
||||||
} else T2C_Send.player(player, Languages.VALUES.NoPermissionForCommand.getValue().toString().replace("[cmd]", "/commandgui " + alias)
|
} else T2Csend.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui " + alias)
|
||||||
.replace("[perm]", "commandgui.command." + alias));
|
.replace("[perm]", "commandgui.command." + alias));
|
||||||
} else T2C_Send.player(player,Languages.VALUES.GUIIsDisabled.getValue().toString().replace("[gui]", gui.guiName));
|
} else T2Csend.player(player,SelectMessages.GUIIsDisabled.replace("[gui]", gui.guiName));
|
||||||
} else sender.sendMessage("§8[§6Command§9GUI§8] §cThis command is only for players!");
|
} else sender.sendMessage("§8[§6Command§9GUI§8] §cThis command is only for players!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,676 +0,0 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.config;
|
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
|
||||||
import net.t2code.commandguiv2.Util;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemVersion;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
|
||||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
|
||||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Config {
|
|
||||||
|
|
||||||
public static enum VALUES implements T2C_ConfigItem {
|
|
||||||
|
|
||||||
debug("plugin.debug", false, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
helpAlias("plugin.helpAlias", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
adminSubCommand("plugin.adminSubCommand", "admin", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
language("plugin.language", T2C_LanguageEnum.english, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
currency("plugin.currency", "$", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
defaultGUI("plugin.defaultGUI", "default", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
prefix("plugin.prefix", "&8[&4C&9GUI&8]", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
storage("storage.type", Main.legacy ? "YML" : "SQLITE", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("Speichermöglichkeiten: YML, SQLITE, MYSQL"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
mysqlIp("storage.mysql.ip", "localhost", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
mysqlPort("storage.mysql.port", 3306, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
mysqlDatabase("storage.mysql.database", "database", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
mysqlUser("storage.mysql.user", "user", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
mysqlPassword("storage.mysql.password", "password", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
mysqlSSL("storage.mysql.ssl", false, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
useItemEnable("useItem.enable", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
useItemAllowToggle("useItem.allowToggle", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
useItemAllowSetSlot("useItem.allowSetSlot", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
useItemBlockMoveAndDrop("useItem.blockMoveAndDrop", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
useItemOpenGUI("useItem.openGUI", "default", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
useItemPermissionNeeded("useItem.permission.neededToUse", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
useItemKeepAtCommandClear("useItem.keepAtCommandClear", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
|
|
||||||
useItemInventorySlot("useItem.inventorySlot.slot", 1, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
useItemInventorySlotEnforce("useItem.inventorySlot.slotEnforce", false, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
useItemInventorySlotFreeSlot("useItem.inventorySlot.freeSlot", false, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
useItemMaterial("useItem.item.material", "paper", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
useItemPlayerHeadEnable(isHead() ? "useItem.item.playerHead.enable" : null, false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemBase64Enable(isHead() ? "useItem.item.playerHead.base64.enable" : null, false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemBase64value(isHead() ? "useItem.item.playerHead.base64.base64value" : null, "", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemPlayerWhoHasOpenedTheGUI(isHead() ? "useItem.item.playerHead.playerWhoHasOpenedTheGUI" : null, false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemPlayerName(isHead() ? "useItem.item.playerHead.playerName" : null, "", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemName("useItem.item.name", "&bDefault &6GUI", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemLore("useItem.item.lore", List.of("&eThis is an example GUI"), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemGiveOnEveryJoin("useItem.Join.GiveOnEveryJoin", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemGiveOnlyOnFirstJoin("useItem.join.giveOnlyOnFirstJoin", false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
cursorToGUIItemOnLogin("useItem.join.cursor.toGUIItem.onLogin.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
cursorToGUIItemOnlyOnFirstLogin("useItem.join.cursor.toGUIItem.onlyOnFirstLogin", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
cursorUseItemServerChange("useItem.join.cursor.toGUIItem.onServerChange", false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
toggleItemOnOrYesBase64("toggle.items.onOrYes.item.base64.enable", false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
toggleItemOnOrYesBase64Value("toggle.items.onOrYes.item.base64.base64value", "", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
toggleItemOnOrYesMaterial("toggle.items.onOrYes.item.material", Main.legacy ? "WOOL,5" : T2C_ItemVersion.getGreenWool().getType().toString(), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
toggleItemOffOrNoBase64("toggle.items.offOrNo.item.base64.enable", false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
toggleItemOffOrNoBase64Value("toggle.items.offOrNo.item.base64.base64value", "", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
toggleItemOffOrNoMaterial("toggle.items.offOrNo.item.material", Main.legacy ? "WOOL,14" : T2C_ItemVersion.getRedWool().getType().toString(), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
togglePermTrue("toggle.permission.commands.true", "luckperms user [player] permission set [perm] true", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
togglePermFalse("toggle.permission.commands.false", "luckperms user [player] permission set [perm] false", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
placeholderTrue("placeholder.true", "&2true", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
placeholderFalse("placeholder.false", "&4false", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
soundEnable("sound.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundOpenInventoryEnable("sound.openInventory.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundOpenInventory("sound.openInventory.sound", getSoundOpenInventory(), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundClickEnable("sound.click.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundClick("sound.click.sound", getSoundClick(), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundNoMoneyEnable("sound.noMoney.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundNoMoney("sound.noMoney.sound", getSoundNoMoney(), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
soundNoInventorySpaceEnable("sound.noInventorySpace.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundNoInventorySpace("sound.noInventorySpace.sound", getSoundNoInventorySpace(), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundGiveEnable("sound.give.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundGive("sound.give.sound", getSoundGive(), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundPlayerNotFoundEnable("sound.playerNotFound.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
soundPlayerNotFound("sound.playerNotFound.sound", getSoundPlayerNotFound(), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
useItemGameModeChangeEnable("advanced.useItem.gameMode.change.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemGameModeChangeDelayInTicks("advanced.useItem.gameMode.change.delayInTicks", 1, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemGameModeProtection("advanced.useItem.gameMode.protection.enable", false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemGameModeRemoveItemWhenItIsDisabled("advanced.useItem.gameMode.protection.removeItemWhenItIsDisabled", false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemGameModeMode("advanced.useItem.gameMode.protection.mode", "blacklist", true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
useItemGameModeList("advanced.useItem.gameMode.protection.list", List.of("CREATIVE", "SPECTATOR"), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
useItemWorldChangeEnable("advanced.useItem.world.change.enable", true, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemWorldChangeDelayInTicks("advanced.useItem.world.change.delayInTicks", 1, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemWorldProtection("advanced.useItem.world.protection.enable", false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemWorldRemoveItemWhenItIsDisabled("advanced.useItem.world.protection.removeItemWhenItIsDisabled", false, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemWorldMode("advanced.useItem.world.protection.mode", List.of("CREATIVE", "Spectator"), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
useItemWorldList("advanced.useItem.world.protection.list", List.of("World1", "World2"), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
// if (yamlConfiguration.get("advanced.UseItem.DisableInfoBySneak") != null) {
|
|
||||||
// disableInfoBySneak = yamlConfiguration.getBoolean("advanced.UseItem.DisableInfoBySneak");
|
|
||||||
// }
|
|
||||||
disableInfoBySneak("advanced.useItem.disableInfoBySneak", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
useItemItemBlockBlacklist("advanced.useItem.itemBlockBlacklist", getItemBlockBlacklist(), true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
;
|
|
||||||
private final String path;
|
|
||||||
private Object value;
|
|
||||||
private final boolean forceSet;
|
|
||||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
|
||||||
|
|
||||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
|
||||||
this.path = path;
|
|
||||||
this.value = value;
|
|
||||||
this.forceSet = forceSet;
|
|
||||||
this.comments = comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getForceSet() {
|
|
||||||
return forceSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
|
||||||
return comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLanguagePath() {
|
|
||||||
return language.path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setValue(Object newValue) {
|
|
||||||
value = newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set(boolean isReload) {
|
|
||||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "config.yml"), VALUES.values(), isReload, Util.getConfigLogo());
|
|
||||||
Util.replace(VALUES.prefix);
|
|
||||||
Util.replace(VALUES.useItemName);
|
|
||||||
Util.replace(VALUES.useItemLore);
|
|
||||||
Util.replace(VALUES.placeholderFalse);
|
|
||||||
Util.replace(VALUES.placeholderTrue);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isHead() {
|
|
||||||
if (!(T2C_McVersion.isMc1_8() || T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12())) {
|
|
||||||
return true;
|
|
||||||
} else return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSoundOpenInventory() {
|
|
||||||
if (T2C_McVersion.isMc1_8()) {
|
|
||||||
return "CHEST_OPEN";
|
|
||||||
}
|
|
||||||
return "BLOCK_CHEST_OPEN";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSoundClick() {
|
|
||||||
if (T2C_McVersion.isMc1_8()) {
|
|
||||||
return "NOTE_STICKS";
|
|
||||||
} else if (T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12()) {
|
|
||||||
return "BLOCK_NOTE_HAT";
|
|
||||||
}
|
|
||||||
return "BLOCK_NOTE_BLOCK_HAT";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSoundNoMoney() {
|
|
||||||
if (T2C_McVersion.isMc1_8()) {
|
|
||||||
return "NOTE_PIANO";
|
|
||||||
} else if (T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12()) {
|
|
||||||
return "BLOCK_NOTE_HARP";
|
|
||||||
}
|
|
||||||
return "BLOCK_NOTE_BLOCK_HARP";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSoundNoInventorySpace() {
|
|
||||||
if (T2C_McVersion.isMc1_8()) {
|
|
||||||
return "NOTE_PIANO";
|
|
||||||
} else if (T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12()) {
|
|
||||||
return "BLOCK_NOTE_BASS";
|
|
||||||
}
|
|
||||||
return "BLOCK_NOTE_BLOCK_GUITAR";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSoundGive() {
|
|
||||||
if (T2C_McVersion.isMc1_8()) {
|
|
||||||
return "LEVEL_UP";
|
|
||||||
}
|
|
||||||
return "ENTITY_PLAYER_LEVELUP";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSoundPlayerNotFound() {
|
|
||||||
if (T2C_McVersion.isMc1_8()) {
|
|
||||||
return "NOTE_PIANO";
|
|
||||||
} else if (T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12()) {
|
|
||||||
return "BLOCK_NOTE_HARP";
|
|
||||||
} else {
|
|
||||||
return "BLOCK_NOTE_BLOCK_HARP";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<String> getItemBlockBlacklist() {
|
|
||||||
List<String> materialList = Arrays.asList("BUTTON", "DOOR", "FENCE", "CHEST", "FURNACE", "NOTE_BLOCK", "CRAFTING_TABLE", "WORKBENCH",
|
|
||||||
"ANVIL", "LOOM", "COMPOSTER", "BARREL", "SMOKER", "BLAST_FURNACE", "CARTOGRAPHY_TABLE", "FLETCHING_TABLE", "GRINDSTONE",
|
|
||||||
"SMITHING_TABLE", "STONECUTTER", "HOPPER", "DISPENSER", "DROPPER", "REPEATER", "COMPARATOR", "LEVER", "DAYLIGHT_DETECTOR", "BREWING_STAND", "TRAPDOOR", "BEACON"
|
|
||||||
);
|
|
||||||
|
|
||||||
List<String> materialBlacklist = new ArrayList<>();
|
|
||||||
for (Material material : Material.values()) {
|
|
||||||
for (String target : materialList) {
|
|
||||||
if (material.toString().contains(target)) {
|
|
||||||
materialBlacklist.add(material.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return materialBlacklist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void checkSounds() {
|
|
||||||
checkSound(VALUES.soundOpenInventory, getSoundOpenInventory());
|
|
||||||
checkSound(VALUES.soundClick, getSoundOpenInventory());
|
|
||||||
checkSound(VALUES.soundNoMoney, getSoundOpenInventory());
|
|
||||||
checkSound(VALUES.soundNoInventorySpace, getSoundOpenInventory());
|
|
||||||
checkSound(VALUES.soundGive, getSoundOpenInventory());
|
|
||||||
checkSound(VALUES.soundPlayerNotFound, getSoundOpenInventory());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void checkSound(VALUES item, String defaultSound) {
|
|
||||||
try {
|
|
||||||
item.setValue(Sound.valueOf(item.value.toString()).toString());
|
|
||||||
} catch (Exception e) {
|
|
||||||
T2C_Send.console("§4\n§4\n§4\n" + Languages.VALUES.SoundNotFound.getValue().toString().replace("[prefix]", Util.getPrefix())
|
|
||||||
.replace("[sound]", "§8" + item.getPath() + item.value.toString()) + "§4\n§4\n§4\n");
|
|
||||||
item.setValue(Sound.valueOf(defaultSound).toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,189 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.config;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ConfigCreate {
|
||||||
|
|
||||||
|
public static void configCreate() {
|
||||||
|
long long_ = System.currentTimeMillis();
|
||||||
|
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||||
|
if (Main.getPlugin().getConfig().getBoolean("Plugin.Debug")) T2Csend.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||||
|
} else T2Csend.console(Util.getPrefix() + " §4config.yml are created...");
|
||||||
|
|
||||||
|
File config = new File(Main.getPath(), "config.yml");
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
if (!config.exists()) T2Cconfig.set("ConfigVersion", Util.getConfigVersion(), yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Plugin.Debug", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Plugin.updateCheck.onJoin", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Plugin.updateCheck.seePreReleaseUpdates", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Plugin.updateCheck.timeInterval", 60, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Plugin.HelpAlias", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Plugin.AdminSubCommand", "admin", yamlConfiguration);
|
||||||
|
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);
|
||||||
|
} else T2Cconfig.set("Storage.Type", "SQLITE", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Storage.MySQL.IP", "localhost", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Storage.MySQL.Port", 3306, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Storage.MySQL.Database", "database", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Storage.MySQL.User", "root", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Storage.MySQL.Password", "password", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Storage.MySQL.SSL", false, yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("UseItem.Enable", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.AllowToggle", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.AllowSetSlot", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.BlockMoveAndDrop", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.OpenGUI", "default", yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Permission.NeededToUse", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.KeepAtCommandClear", true, yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("UseItem.InventorySlot.Slot", 1, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.InventorySlot.SlotEnforce", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.InventorySlot.FreeSlot", false, yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("UseItem.Item.Material", "paper", yamlConfiguration);
|
||||||
|
if (!(T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12())) {
|
||||||
|
T2Cconfig.set("UseItem.Item.PlayerHead.Enable", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Item.PlayerHead.Base64.Enable", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Item.PlayerHead.Base64.Base64Value", "", yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Item.PlayerHead.Playername", "", yamlConfiguration);
|
||||||
|
}
|
||||||
|
T2Cconfig.set("UseItem.Item.Name", "&bDefault &6GUI", yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Item.Lore", Arrays.asList("&eThis is an example GUI"), yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Join.GiveOnEveryJoin", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Join.GiveOnlyOnFirstJoin", false, yamlConfiguration);
|
||||||
|
|
||||||
|
//convert
|
||||||
|
if (yamlConfiguration.contains("UseItem.Join.Cursor.ToGUIItem.OnEveryLogin")) {
|
||||||
|
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.OnEveryLogin", yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnEveryLogin"), yamlConfiguration);
|
||||||
|
}
|
||||||
|
if (yamlConfiguration.contains("UseItem.Join.Cursor.ToGUIItem.OnOnlyFirstLogin")) {
|
||||||
|
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.OnOnlyFirstLogin", yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.Spigot.OnOnlyFirstLogin", yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnOnlyFirstLogin"), yamlConfiguration);
|
||||||
|
}
|
||||||
|
if (yamlConfiguration.contains("UseItem.Join.Cursor.ToGUIItem.EXPERIMENTELL_ServerChange")) {
|
||||||
|
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.EXPERIMENTELL_ServerChange", yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.EXPERIMENTELL_ServerChange"), yamlConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.Spigot.OnOnlyFirstLogin", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", false, yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Toggle.Items.OnOrYes.Item.Base64.Enable", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", yamlConfiguration);
|
||||||
|
if (Main.legacy) {
|
||||||
|
T2Cconfig.set("Toggle.Items.OnOrYes.Item.Material", "WOOL,5", yamlConfiguration);
|
||||||
|
} else T2Cconfig.set("Toggle.Items.OnOrYes.Item.Material", T2CitemVersion.getGreenWool().getType().toString(), yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Toggle.Items.OffOrNo.Item.Base64.Enable", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Toggle.Items.OffOrNo.Item.Base64.Base64Value", "", yamlConfiguration);
|
||||||
|
if (Main.legacy) {
|
||||||
|
T2Cconfig.set("Toggle.Items.OffOrNo.Item.Material", "WOOL,14", yamlConfiguration);
|
||||||
|
} else T2Cconfig.set("Toggle.Items.OffOrNo.Item.Material", T2CitemVersion.getRedWool().getType().toString(), yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Toggle.Permission.Commands.True", "luckperms user [player] permission set [perm] true", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false", yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Placeholder.True", "&2true", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Placeholder.False", "&4false", yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Sound.Enable", true, yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Sound.OpenInventory.Enable", true, yamlConfiguration);
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
T2Cconfig.set("Sound.OpenInventory.Sound", "CHEST_OPEN", yamlConfiguration);
|
||||||
|
} else T2Cconfig.set("Sound.OpenInventory.Sound", "BLOCK_CHEST_OPEN", yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Sound.Click.Enable", true, yamlConfiguration);
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
T2Cconfig.set("Sound.Click.Sound", "NOTE_STICKS", yamlConfiguration);
|
||||||
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
T2Cconfig.set("Sound.Click.Sound", "BLOCK_NOTE_HAT", yamlConfiguration);
|
||||||
|
} else T2Cconfig.set("Sound.Click.Sound", "BLOCK_NOTE_BLOCK_HAT", yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Sound.NoMoney.Enable", true, yamlConfiguration);
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
T2Cconfig.set("Sound.NoMoney.Sound", "NOTE_PIANO", yamlConfiguration);
|
||||||
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
T2Cconfig.set("Sound.NoMoney.Sound", "BLOCK_NOTE_HARP", yamlConfiguration);
|
||||||
|
} else T2Cconfig.set("Sound.NoMoney.Sound", "BLOCK_NOTE_BLOCK_HARP", yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Sound.NoInventorySpace.Enable", true, yamlConfiguration);
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
T2Cconfig.set("Sound.NoInventorySpace.Sound", "NOTE_PIANO", yamlConfiguration);
|
||||||
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
T2Cconfig.set("Sound.NoInventorySpace.Sound", "BLOCK_NOTE_HARP", yamlConfiguration);
|
||||||
|
} else T2Cconfig.set("Sound.NoInventorySpace.Sound", "BLOCK_NOTE_BLOCK_HARP", yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Sound.Give.Enable", true, yamlConfiguration);
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
T2Cconfig.set("Sound.Give.Sound", "LEVEL_UP", yamlConfiguration);
|
||||||
|
} else T2Cconfig.set("Sound.Give.Sound", "ENTITY_PLAYER_LEVELUP", yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Sound.PlayerNotFound.Enable", true, yamlConfiguration);
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
T2Cconfig.set("Sound.PlayerNotFound.Sound", "NOTE_PIANO", yamlConfiguration);
|
||||||
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
T2Cconfig.set("Sound.PlayerNotFound.Sound", "BLOCK_NOTE_HARP", yamlConfiguration);
|
||||||
|
} else T2Cconfig.set("Sound.PlayerNotFound.Sound", "BLOCK_NOTE_BLOCK_HARP", yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Advanced.UseItem.GameMode.Change.Enable", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.GameMode.Change.DelayInTicks", 1, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.GameMode.Protection.Enable", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.GameMode.Protection.Mode", "blacklist", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.GameMode.Protection.List", Arrays.asList("CREATIVE", "Spectator"), yamlConfiguration);
|
||||||
|
|
||||||
|
T2Cconfig.set("Advanced.UseItem.World.Change.Enable", true, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.World.Change.DelayInTicks", 1, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.World.Protection.Enable", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", false, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.World.Protection.Mode", "blacklist", yamlConfiguration);
|
||||||
|
T2Cconfig.set("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), yamlConfiguration);
|
||||||
|
|
||||||
|
if (!yamlConfiguration.contains("Advanced.UseItem.ItemBlockBlacklist")) {
|
||||||
|
List<String> materialList = Arrays.asList("BUTTON", "DOOR", "FENCE", "CHEST", "FURNACE", "NOTE_BLOCK", "CRAFTING_TABLE", "WORKBENCH",
|
||||||
|
"ANVIL", "LOOM", "COMPOSTER", "BARREL", "SMOKER", "BLAST_FURNACE", "CARTOGRAPHY_TABLE", "FLETCHING_TABLE", "GRINDSTONE",
|
||||||
|
"SMITHING_TABLE", "STONECUTTER", "HOPPER", "DISPENSER", "DROPPER", "REPEATER", "COMPARATOR", "LEVER", "DAYLIGHT_DETECTOR", "BREWING_STAND", "TRAPDOOR", "BEACON"
|
||||||
|
);
|
||||||
|
|
||||||
|
List<String> materialBlacklist = new ArrayList<>();
|
||||||
|
for (Material material : Material.values()) {
|
||||||
|
for (String target : materialList) {
|
||||||
|
if (material.toString().contains(target)) materialBlacklist.add(material.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
T2Cconfig.set("Advanced.UseItem.ItemBlockBlacklist", materialBlacklist, yamlConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,709 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.config;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
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;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
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() {
|
||||||
|
File config = new File(Main.getPath(), "config.yml");
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
if (yamlConfiguration.getInt("ConfigVersion") < Util.getConfigVersion() && new File(Main.getPath(), "config.yml").exists()) {
|
||||||
|
T2Csend.console(Util.getPrefix() + " §4----------------------");
|
||||||
|
T2Csend.console(Util.getPrefix() + " ");
|
||||||
|
T2Csend.console(Util.getPrefix() + " §6New features have been added to CommandGUI. The Config is adapted!");
|
||||||
|
T2Csend.console(Util.getPrefix() + " ");
|
||||||
|
T2Csend.console(Util.getPrefix() + " §4----------------------");
|
||||||
|
if (yamlConfiguration.getInt("ConfigVersion") < 5) {
|
||||||
|
ConfigConverter.convert();
|
||||||
|
}
|
||||||
|
if (yamlConfiguration.getInt("ConfigVersion") < 6) {
|
||||||
|
ConfigConverter.removeBungeeOption();
|
||||||
|
}
|
||||||
|
if (yamlConfiguration.getInt("ConfigVersion") < 7) {
|
||||||
|
ConfigConverter.convert7();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||||
|
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin");
|
||||||
|
updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.updateCheck.seePreReleaseUpdates");
|
||||||
|
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval");
|
||||||
|
HelpAlias = yamlConfiguration.getBoolean("Plugin.HelpAlias");
|
||||||
|
adminSubCommand = yamlConfiguration.getString("Plugin.AdminSubCommand").toLowerCase();
|
||||||
|
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();
|
||||||
|
|
||||||
|
mysqlIp = yamlConfiguration.getString("Storage.MySQL.IP");
|
||||||
|
mysqlPort = yamlConfiguration.getInt("Storage.MySQL.Port");
|
||||||
|
mysqlDatabase = yamlConfiguration.getString("Storage.MySQL.Database");
|
||||||
|
mysqlUser = yamlConfiguration.getString("Storage.MySQL.User");
|
||||||
|
mysqlPassword = yamlConfiguration.getString("Storage.MySQL.Password");
|
||||||
|
mysqlSSL = yamlConfiguration.getBoolean("Storage.MySQL.SSL");
|
||||||
|
|
||||||
|
UseItem_Enable = yamlConfiguration.getBoolean("UseItem.Enable");
|
||||||
|
UseItem_AllowToggle = yamlConfiguration.getBoolean("UseItem.AllowToggle");
|
||||||
|
UseItem_AllowSetSlot = yamlConfiguration.getBoolean("UseItem.AllowSetSlot");
|
||||||
|
UseItem_BlockMoveAndDrop = yamlConfiguration.getBoolean("UseItem.BlockMoveAndDrop");
|
||||||
|
UseItem_OpenGUI = yamlConfiguration.getString("UseItem.OpenGUI");
|
||||||
|
UseItem_Permission = yamlConfiguration.getBoolean("UseItem.Permission.NeededToUse");
|
||||||
|
UseItem_KeepAtCommandClear = yamlConfiguration.getBoolean("UseItem.KeepAtCommandClear");
|
||||||
|
|
||||||
|
UseItem_InventorySlot_FreeSlot = yamlConfiguration.getBoolean("UseItem.InventorySlot.FreeSlot");
|
||||||
|
UseItem_InventorySlot = yamlConfiguration.getInt("UseItem.InventorySlot.Slot");
|
||||||
|
UseItem_InventorySlotEnforce = yamlConfiguration.getBoolean("UseItem.InventorySlot.SlotEnforce");
|
||||||
|
UseItem_Material = yamlConfiguration.getString("UseItem.Item.Material").toUpperCase();
|
||||||
|
UseItem_PlayerHead_Enable = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.Enable");
|
||||||
|
UseItem_Base64_Enable = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.Base64.Enable");
|
||||||
|
UseItem_Base64value = yamlConfiguration.getString("UseItem.Item.PlayerHead.Base64.Base64Value");
|
||||||
|
UseItem_PlayerWhoHasOpenedTheGUI = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
||||||
|
UseItem_PlayerName = yamlConfiguration.getString("UseItem.Item.PlayerHead.PlayerName");
|
||||||
|
UseItem_Name = T2Creplace.replace(Util.getPrefix(), yamlConfiguration.getString("UseItem.Item.Name"));
|
||||||
|
UseItem_Lore = yamlConfiguration.getStringList("UseItem.Item.Lore");
|
||||||
|
UseItem_GiveOnEveryJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnEveryJoin");
|
||||||
|
UseItem_GiveOnlyOnFirstJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnlyOnFirstJoin");
|
||||||
|
Cursor_ToGUIItem_OnLogin = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable");
|
||||||
|
Cursor_ToGUIItem_OnlyOnFirstLogin = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin");
|
||||||
|
UseItem_ServerChange = yamlConfiguration.getBoolean("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange");
|
||||||
|
|
||||||
|
toggleItemOnOrYesBase64 = yamlConfiguration.getBoolean("Toggle.Items.OnOrYes.Item.Base64.Enable");
|
||||||
|
toggleItemOnOrYesBase64Value = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Base64.Base64Value");
|
||||||
|
toggleItemOnOrYesMaterial = yamlConfiguration.getString("Toggle.Items.OnOrYes.Item.Material");
|
||||||
|
|
||||||
|
toggleItemOffOrNoBase64 = yamlConfiguration.getBoolean("Toggle.Items.OffOrNo.Item.Base64.Enable");
|
||||||
|
toggleItemOffOrNoBase64Value = yamlConfiguration.getString("Toggle.Items.OffOrNo.Item.Base64.Base64Value");
|
||||||
|
toggleItemOffOrNoMaterial = yamlConfiguration.getString("Toggle.Items.OffOrNo.Item.Material");
|
||||||
|
|
||||||
|
togglePermTrue = yamlConfiguration.getString("Toggle.Permission.Commands.True");
|
||||||
|
togglePermFalse = yamlConfiguration.getString("Toggle.Permission.Commands.False");
|
||||||
|
|
||||||
|
placeholderTrue = yamlConfiguration.getString("Placeholder.True");
|
||||||
|
placeholderFalse = yamlConfiguration.getString("Placeholder.False");
|
||||||
|
|
||||||
|
Sound_Enable = yamlConfiguration.getBoolean("Sound.Enable");
|
||||||
|
Sound_OpenInventory_Enable = yamlConfiguration.getBoolean("Sound.OpenInventory.Enable");
|
||||||
|
Sound_OpenInventory_input = (yamlConfiguration.getString("Sound.OpenInventory.Sound").toUpperCase().replace(".", "_"));
|
||||||
|
Sound_Click_Enable = yamlConfiguration.getBoolean("Sound.Click.Enable");
|
||||||
|
Sound_Click_input = (yamlConfiguration.getString("Sound.Click.Sound").toUpperCase().replace(".", "_"));
|
||||||
|
Sound_NoMoney_Enable = yamlConfiguration.getBoolean("Sound.NoMoney.Enable");
|
||||||
|
Sound_NoMoney_input = (yamlConfiguration.getString("Sound.NoMoney.Sound").toUpperCase().replace(".", "_"));
|
||||||
|
|
||||||
|
Sound_NoInventorySpace_Enable = yamlConfiguration.getBoolean("Sound.NoInventorySpace.Enable");
|
||||||
|
Sound_NoInventorySpace_input = (yamlConfiguration.getString("Sound.NoInventorySpace.Sound").toUpperCase().replace(".", "_"));
|
||||||
|
Sound_Give_Enable = yamlConfiguration.getBoolean("Sound.Give.Enable");
|
||||||
|
Sound_Give_input = (yamlConfiguration.getString("Sound.Give.Sound").toUpperCase().replace(".", "_"));
|
||||||
|
Sound_PlayerNotFound_Enable = yamlConfiguration.getBoolean("Sound.PlayerNotFound.Enable");
|
||||||
|
Sound_PlayerNotFound_input = (yamlConfiguration.getString("Sound.PlayerNotFound.Sound").toUpperCase().replace(".", "_"));
|
||||||
|
|
||||||
|
UseItemGameModeChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Change.Enable");
|
||||||
|
UseItemGameModeChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.GameMode.Change.DelayInTicks");
|
||||||
|
UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable");
|
||||||
|
UseItemGameModeRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
|
||||||
|
UseItemGameModeMode = yamlConfiguration.getString("Advanced.UseItem.GameMode.Protection.Mode");
|
||||||
|
List<String> gml = new ArrayList<>();
|
||||||
|
for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")) {
|
||||||
|
gml.add(gm.toUpperCase());
|
||||||
|
}
|
||||||
|
UseItemGameModeList = gml;
|
||||||
|
|
||||||
|
UseItemWorldChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.World.Change.Enable");
|
||||||
|
UseItemWorldChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.World.Change.DelayInTicks");
|
||||||
|
UseItemWorldProtection = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.Enable");
|
||||||
|
UseItemWorldRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
|
||||||
|
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
|
||||||
|
UseItemWorldList = yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
|
||||||
|
|
||||||
|
|
||||||
|
if (yamlConfiguration.get("Advanced.UseItem.DisableInfoBySneak") != null) {
|
||||||
|
disableInfoBySneak = yamlConfiguration.getBoolean("Advanced.UseItem.DisableInfoBySneak");
|
||||||
|
}
|
||||||
|
|
||||||
|
UseItemItemBlockBlacklist = yamlConfiguration.getStringList("Advanced.UseItem.ItemBlockBlacklist");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void sound(String Prefix) {
|
||||||
|
String soundOpenInventory;
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
soundOpenInventory = "CHEST_OPEN";
|
||||||
|
} else {
|
||||||
|
soundOpenInventory = "BLOCK_CHEST_OPEN";
|
||||||
|
}
|
||||||
|
|
||||||
|
String soundClick;
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
soundClick = "NOTE_STICKS";
|
||||||
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
soundClick = "BLOCK_NOTE_HAT";
|
||||||
|
} else {
|
||||||
|
soundClick = "BLOCK_NOTE_BLOCK_HAT";
|
||||||
|
}
|
||||||
|
|
||||||
|
String soundNoMoney;
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
soundNoMoney = "NOTE_PIANO";
|
||||||
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
soundNoMoney = "BLOCK_NOTE_HARP";
|
||||||
|
} else {
|
||||||
|
soundNoMoney = "BLOCK_NOTE_BLOCK_HARP";
|
||||||
|
}
|
||||||
|
|
||||||
|
String soundNoInventorySpace;
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
soundNoInventorySpace = "NOTE_PIANO";
|
||||||
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
soundNoInventorySpace = "BLOCK_NOTE_BASS";
|
||||||
|
} else {
|
||||||
|
soundNoInventorySpace = "BLOCK_NOTE_BLOCK_GUITAR";
|
||||||
|
}
|
||||||
|
|
||||||
|
String soundGive;
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
soundGive = "LEVEL_UP";
|
||||||
|
} else {
|
||||||
|
soundGive = "ENTITY_PLAYER_LEVELUP";
|
||||||
|
}
|
||||||
|
|
||||||
|
String soundPlayerNotFound;
|
||||||
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
|
soundPlayerNotFound = "NOTE_PIANO";
|
||||||
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
soundPlayerNotFound = "BLOCK_NOTE_HARP";
|
||||||
|
} else {
|
||||||
|
soundPlayerNotFound = "BLOCK_NOTE_BLOCK_HARP";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Sound sound_OpenInventory = Sound.valueOf(Sound_OpenInventory_input);
|
||||||
|
if (sound_OpenInventory != null) {
|
||||||
|
Sound_OpenInventory = sound_OpenInventory;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Sound sound_Click = Sound.valueOf(Sound_Click_input);
|
||||||
|
if (sound_Click != null) {
|
||||||
|
Sound_Click = sound_Click;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||||
|
.replace("[sound]", "§8Click: §6" + Sound_Click_input) + "§4\n§4\n§4\n");
|
||||||
|
Sound_Click = Sound.valueOf(soundClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Sound sound_NoMoney = Sound.valueOf(Sound_NoMoney_input);
|
||||||
|
if (sound_NoMoney != null) {
|
||||||
|
Sound_Click = sound_NoMoney;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||||
|
.replace("[sound]", "§8NoMoney: §6" + Sound_NoMoney_input) + "§4\n§4\n§4\n");
|
||||||
|
Sound_NoMoney = Sound.valueOf(soundNoMoney);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Sound sound_NoInventorySpace = Sound.valueOf(Sound_NoInventorySpace_input);
|
||||||
|
if (sound_NoInventorySpace != null) {
|
||||||
|
Sound_NoInventorySpace = sound_NoInventorySpace;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||||
|
.replace("[sound]", "§8NoInventorySpace: §6" + Sound_NoInventorySpace_input) + "§4\n§4\n§4\n");
|
||||||
|
Sound_NoInventorySpace = Sound.valueOf(soundNoInventorySpace);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Sound sound_Give = Sound.valueOf(Sound_Give_input);
|
||||||
|
if (sound_Give != null) {
|
||||||
|
Sound_Give = sound_Give;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||||
|
.replace("[sound]", "§8Give: §6" + Sound_Give_input) + "§4\n§4\n§4\n");
|
||||||
|
Sound_Give = Sound.valueOf(soundGive);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Sound sound_PlayerNotFound = Sound.valueOf(Sound_PlayerNotFound_input);
|
||||||
|
if (sound_PlayerNotFound != null) {
|
||||||
|
Sound_PlayerNotFound = sound_PlayerNotFound;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Prefix)
|
||||||
|
.replace("[sound]", "§8PlayerNotFound: §6" + Sound_PlayerNotFound_input) + "§4\n§4\n§4\n");
|
||||||
|
Sound_PlayerNotFound = Sound.valueOf(soundPlayerNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setConfigVersion() {
|
||||||
|
File config = new File(Main.getPath(), "config.yml");
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
yamlConfiguration.set("ConfigVersion", Util.getConfigVersion());
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Boolean Debug;
|
||||||
|
|
||||||
|
private static Boolean updateCheckOnJoin;
|
||||||
|
private static Boolean updateCheckSeePreReleaseUpdates;
|
||||||
|
private static Integer updateCheckTimeInterval;
|
||||||
|
private static Boolean HelpAlias;
|
||||||
|
private static String adminSubCommand;
|
||||||
|
private static String language;
|
||||||
|
private static String Currency;
|
||||||
|
|
||||||
|
private static String storage;
|
||||||
|
|
||||||
|
private static String mysqlIp;
|
||||||
|
private static Integer mysqlPort;
|
||||||
|
private static String mysqlDatabase;
|
||||||
|
private static String mysqlUser;
|
||||||
|
private static String mysqlPassword;
|
||||||
|
private static Boolean mysqlSSL;
|
||||||
|
|
||||||
|
private static String DefaultGUI;
|
||||||
|
private static String prefix;
|
||||||
|
|
||||||
|
private static Boolean UseItem_Enable;
|
||||||
|
private static Boolean UseItem_AllowToggle;
|
||||||
|
private static Boolean UseItem_AllowSetSlot;
|
||||||
|
private static Boolean UseItem_GiveOnEveryJoin;
|
||||||
|
private static Boolean UseItem_GiveOnlyOnFirstJoin;
|
||||||
|
private static Boolean UseItem_ServerChange;
|
||||||
|
private static Boolean Cursor_ToGUIItem_OnLogin;
|
||||||
|
private static Boolean Cursor_ToGUIItem_OnlyOnFirstLogin;
|
||||||
|
private static Boolean UseItem_BlockMoveAndDrop;
|
||||||
|
private static String UseItem_OpenGUI;
|
||||||
|
private static Boolean UseItem_Permission;
|
||||||
|
private static Boolean UseItem_KeepAtCommandClear;
|
||||||
|
|
||||||
|
private static Boolean UseItemGameModeChangeEnable;
|
||||||
|
private static int UseItemGameModeChangeDelayInTicks;
|
||||||
|
private static Boolean UseItemGameModeProtection;
|
||||||
|
private static Boolean UseItemGameModeRemoveItemWhenItIsDisabled;
|
||||||
|
private static String UseItemGameModeMode;
|
||||||
|
private static List<String> UseItemGameModeList;
|
||||||
|
|
||||||
|
private static Boolean UseItemWorldChangeEnable;
|
||||||
|
private static int UseItemWorldChangeDelayInTicks;
|
||||||
|
private static Boolean UseItemWorldProtection;
|
||||||
|
private static Boolean UseItemWorldRemoveItemWhenItIsDisabled;
|
||||||
|
private static String UseItemWorldMode;
|
||||||
|
private static List<String> UseItemWorldList;
|
||||||
|
private static List<String> UseItemItemBlockBlacklist;
|
||||||
|
|
||||||
|
private static Boolean disableInfoBySneak = false;
|
||||||
|
|
||||||
|
private static Boolean UseItem_InventorySlot_FreeSlot;
|
||||||
|
private static Integer UseItem_InventorySlot;
|
||||||
|
private static Boolean UseItem_InventorySlotEnforce;
|
||||||
|
private static String UseItem_Material;
|
||||||
|
private static Boolean UseItem_PlayerHead_Enable;
|
||||||
|
private static Boolean UseItem_Base64_Enable;
|
||||||
|
private static String UseItem_Base64value;
|
||||||
|
private static Boolean UseItem_PlayerWhoHasOpenedTheGUI;
|
||||||
|
private static String UseItem_PlayerName;
|
||||||
|
private static String UseItem_Name;
|
||||||
|
private static List<String> UseItem_Lore;
|
||||||
|
|
||||||
|
private static Boolean toggleItemOnOrYesBase64;
|
||||||
|
private static String toggleItemOnOrYesBase64Value;
|
||||||
|
private static String toggleItemOnOrYesMaterial;
|
||||||
|
|
||||||
|
private static Boolean toggleItemOffOrNoBase64;
|
||||||
|
private static String toggleItemOffOrNoBase64Value;
|
||||||
|
private static String toggleItemOffOrNoMaterial;
|
||||||
|
|
||||||
|
private static String togglePermTrue;
|
||||||
|
private static String togglePermFalse;
|
||||||
|
|
||||||
|
private static String placeholderTrue;
|
||||||
|
private static String placeholderFalse;
|
||||||
|
|
||||||
|
private static Boolean Sound_Enable = true;
|
||||||
|
|
||||||
|
private static Boolean Sound_OpenInventory_Enable = true;
|
||||||
|
private static Sound Sound_OpenInventory;
|
||||||
|
private static String Sound_OpenInventory_input;
|
||||||
|
|
||||||
|
private static Boolean Sound_Click_Enable = true;
|
||||||
|
private static Sound Sound_Click;
|
||||||
|
private static String Sound_Click_input;
|
||||||
|
|
||||||
|
private static Boolean Sound_NoMoney_Enable = true;
|
||||||
|
private static Sound Sound_NoMoney;
|
||||||
|
private static String Sound_NoMoney_input;
|
||||||
|
|
||||||
|
private static Boolean Sound_NoInventorySpace_Enable = true;
|
||||||
|
private static Sound Sound_NoInventorySpace;
|
||||||
|
private static String Sound_NoInventorySpace_input;
|
||||||
|
|
||||||
|
private static Boolean Sound_Give_Enable = true;
|
||||||
|
private static Sound Sound_Give;
|
||||||
|
private static String Sound_Give_input;
|
||||||
|
|
||||||
|
private static Boolean Sound_PlayerNotFound_Enable = true;
|
||||||
|
private static Sound Sound_PlayerNotFound;
|
||||||
|
private static String Sound_PlayerNotFound_input;
|
||||||
|
|
||||||
|
public static Boolean getDebug() {
|
||||||
|
return Debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUpdateCheckOnJoin() {
|
||||||
|
return updateCheckOnJoin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUpdateCheckSeePreReleaseUpdates() {
|
||||||
|
return updateCheckSeePreReleaseUpdates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getUpdateCheckTimeInterval() {
|
||||||
|
return updateCheckTimeInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getHelpAlias() {
|
||||||
|
return HelpAlias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getAdminSubCommand() {
|
||||||
|
return adminSubCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCurrency() {
|
||||||
|
return Currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getStorage() {
|
||||||
|
return storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMysqlIp() {
|
||||||
|
return mysqlIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getMysqlPort() {
|
||||||
|
return mysqlPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMysqlDatabase() {
|
||||||
|
return mysqlDatabase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMysqlUser() {
|
||||||
|
return mysqlUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMysqlPassword() {
|
||||||
|
return mysqlPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getMysqlSSL() {
|
||||||
|
return mysqlSSL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDefaultGUI() {
|
||||||
|
return DefaultGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPrefix() {
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_Enable() {
|
||||||
|
return UseItem_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_AllowToggle() {
|
||||||
|
return UseItem_AllowToggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_AllowSetSlot() {
|
||||||
|
return UseItem_AllowSetSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_GiveOnEveryJoin() {
|
||||||
|
return UseItem_GiveOnEveryJoin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_GiveOnlyOnFirstJoin() {
|
||||||
|
return UseItem_GiveOnlyOnFirstJoin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_ServerChange() {
|
||||||
|
return UseItem_ServerChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getCursor_ToGUIItem_OnLogin() {
|
||||||
|
return Cursor_ToGUIItem_OnLogin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getCursor_ToGUIItem_OnlyOnFirstLogin() {
|
||||||
|
return Cursor_ToGUIItem_OnlyOnFirstLogin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_BlockMoveAndDrop() {
|
||||||
|
return UseItem_BlockMoveAndDrop;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUseItem_OpenGUI() {
|
||||||
|
return UseItem_OpenGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_Permission() {
|
||||||
|
return UseItem_Permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_KeepAtCommandClear() {
|
||||||
|
return UseItem_KeepAtCommandClear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItemGameModeChangeEnable() {
|
||||||
|
return UseItemGameModeChangeEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getUseItemGameModeChangeDelayInTicks() {
|
||||||
|
return UseItemGameModeChangeDelayInTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItemGameModeProtection() {
|
||||||
|
return UseItemGameModeProtection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItemGameModeRemoveItemWhenItIsDisabled() {
|
||||||
|
return UseItemGameModeRemoveItemWhenItIsDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUseItemGameModeMode() {
|
||||||
|
return UseItemGameModeMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getUseItemGameModeList() {
|
||||||
|
return UseItemGameModeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItemWorldChangeEnable() {
|
||||||
|
return UseItemWorldChangeEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getUseItemWorldChangeDelayInTicks() {
|
||||||
|
return UseItemWorldChangeDelayInTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItemWorldProtection() {
|
||||||
|
return UseItemWorldProtection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItemWorldRemoveItemWhenItIsDisabled() {
|
||||||
|
return UseItemWorldRemoveItemWhenItIsDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUseItemWorldMode() {
|
||||||
|
return UseItemWorldMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getUseItemWorldList() {
|
||||||
|
return UseItemWorldList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getUseItemItemBlockBlacklist() {
|
||||||
|
return UseItemItemBlockBlacklist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getDisableInfoBySneak() {
|
||||||
|
return disableInfoBySneak;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_InventorySlot_FreeSlot() {
|
||||||
|
return UseItem_InventorySlot_FreeSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getUseItem_InventorySlot() {
|
||||||
|
return UseItem_InventorySlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_InventorySlotEnforce() {
|
||||||
|
return UseItem_InventorySlotEnforce;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUseItem_Material() {
|
||||||
|
return UseItem_Material;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_PlayerHead_Enable() {
|
||||||
|
return UseItem_PlayerHead_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_Base64_Enable() {
|
||||||
|
return UseItem_Base64_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUseItem_Base64value() {
|
||||||
|
return UseItem_Base64value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getUseItem_PlayerWhoHasOpenedTheGUI() {
|
||||||
|
return UseItem_PlayerWhoHasOpenedTheGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUseItem_PlayerName() {
|
||||||
|
return UseItem_PlayerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUseItem_Name() {
|
||||||
|
return UseItem_Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getUseItem_Lore() {
|
||||||
|
return UseItem_Lore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getToggleItemOnOrYesBase64() {
|
||||||
|
return toggleItemOnOrYesBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getToggleItemOnOrYesBase64Value() {
|
||||||
|
return toggleItemOnOrYesBase64Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getToggleItemOnOrYesMaterial() {
|
||||||
|
return toggleItemOnOrYesMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getToggleItemOffOrNoBase64() {
|
||||||
|
return toggleItemOffOrNoBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getToggleItemOffOrNoBase64Value() {
|
||||||
|
return toggleItemOffOrNoBase64Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getToggleItemOffOrNoMaterial() {
|
||||||
|
return toggleItemOffOrNoMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTogglePermTrue() {
|
||||||
|
return togglePermTrue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTogglePermFalse() {
|
||||||
|
return togglePermFalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPlaceholderTrue() {
|
||||||
|
return placeholderTrue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPlaceholderFalse() {
|
||||||
|
return placeholderFalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSound_Enable() {
|
||||||
|
return Sound_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSound_OpenInventory_Enable() {
|
||||||
|
return Sound_OpenInventory_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Sound getSound_OpenInventory() {
|
||||||
|
return Sound_OpenInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSound_OpenInventory_input() {
|
||||||
|
return Sound_OpenInventory_input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSound_Click_Enable() {
|
||||||
|
return Sound_Click_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Sound getSound_Click() {
|
||||||
|
return Sound_Click;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSound_Click_input() {
|
||||||
|
return Sound_Click_input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSound_NoMoney_Enable() {
|
||||||
|
return Sound_NoMoney_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Sound getSound_NoMoney() {
|
||||||
|
return Sound_NoMoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSound_NoMoney_input() {
|
||||||
|
return Sound_NoMoney_input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSound_NoInventorySpace_Enable() {
|
||||||
|
return Sound_NoInventorySpace_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Sound getSound_NoInventorySpace() {
|
||||||
|
return Sound_NoInventorySpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSound_NoInventorySpace_input() {
|
||||||
|
return Sound_NoInventorySpace_input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSound_Give_Enable() {
|
||||||
|
return Sound_Give_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Sound getSound_Give() {
|
||||||
|
return Sound_Give;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSound_Give_input() {
|
||||||
|
return Sound_Give_input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSound_PlayerNotFound_Enable() {
|
||||||
|
return Sound_PlayerNotFound_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Sound getSound_PlayerNotFound() {
|
||||||
|
return Sound_PlayerNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSound_PlayerNotFound_input() {
|
||||||
|
return Sound_PlayerNotFound_input;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,271 @@
|
|||||||
|
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;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||||
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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");
|
||||||
|
File newF = new File("plugins/T2C-CommandGUI");
|
||||||
|
|
||||||
|
if (oldF.renameTo(newF)) {
|
||||||
|
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
T2Csend.error(Main.getPlugin(), "");
|
||||||
|
T2Csend.warning(Main.getPlugin(), "File renamed successfully");
|
||||||
|
T2Csend.warning(Main.getPlugin(), "The plugin folder has been renamed from 'CommandGUI' to 'T2C-CommandGUI");
|
||||||
|
T2Csend.error(Main.getPlugin(), "");
|
||||||
|
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
} else {
|
||||||
|
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
T2Csend.error(Main.getPlugin(), "");
|
||||||
|
T2Csend.error(Main.getPlugin(), "Failed to rename file");
|
||||||
|
T2Csend.error(Main.getPlugin(), "An error occurred while renaming the plugin folder from 'CommandGUI' to 'T2C-CommandGUI'! Please report on our Discord: " + Util.getDiscord());
|
||||||
|
T2Csend.error(Main.getPlugin(), "");
|
||||||
|
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void noPermLore(YamlConfiguration yamlConfiguration, File config) {
|
||||||
|
yamlConfiguration.set("Slots.Function.NoPermission.Message.Enable", true);
|
||||||
|
yamlConfiguration.set("Slots.Function.NoPermission.Message.CustomNoPermMessage", "");
|
||||||
|
yamlConfiguration.set("Slots.Function.NoPermission.Item.Lore.Enable", true);
|
||||||
|
yamlConfiguration.set("Slots.Function.NoPermission.Item.Lore.Lore", Arrays.asList("&8-----------------", "&4No Permission for this Function", "&8-----------------"));
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
T2Csend.error(Main.getPlugin(), "");
|
||||||
|
T2Csend.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Message.Enable' was added to the function " + config.getName() + "!");
|
||||||
|
T2Csend.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Message.CustomNoPermMessage' was added to the function " + config.getName() + "!");
|
||||||
|
T2Csend.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Item.Lore.Enable' was added to the function " + config.getName() + "!");
|
||||||
|
T2Csend.warning(Main.getPlugin(), "'Slots.Function.NoPermission.Item.Lore.Lore' was added to the function " + config.getName() + "!");
|
||||||
|
T2Csend.error(Main.getPlugin(), "");
|
||||||
|
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void convert() {
|
||||||
|
renameFolder();
|
||||||
|
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() + "/OldConfig/GUIs/Version4");
|
||||||
|
File[] fileArray = f.listFiles();
|
||||||
|
|
||||||
|
for (File configOld : fileArray) {
|
||||||
|
String sub = configOld.getName().substring(configOld.getName().length() - 4);
|
||||||
|
if (sub.equals(".yml")) {
|
||||||
|
YamlConfiguration yamlConfigurationOld = YamlConfiguration.loadConfiguration(configOld);
|
||||||
|
|
||||||
|
File config = new File(Main.getPath(), "GUIs/" + configOld.getName().replace(".yml", "") + ".yml");
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
Boolean enable = yamlConfigurationOld.getBoolean("GUI.Enable");
|
||||||
|
Integer lines = yamlConfigurationOld.getInt("GUI.Lines");
|
||||||
|
|
||||||
|
String name = yamlConfigurationOld.getString("GUI.Name");
|
||||||
|
Boolean fillItemEnable = yamlConfigurationOld.getBoolean("GUI.FillItem.Enable");
|
||||||
|
String fillItem;
|
||||||
|
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
fillItem = yamlConfigurationOld.getString("GUI.FillItem.GlassPaneColor");
|
||||||
|
} else fillItem = yamlConfigurationOld.getString("GUI.FillItem.Item");
|
||||||
|
|
||||||
|
Boolean alias = yamlConfigurationOld.getBoolean("Command.Alias");
|
||||||
|
Boolean aliasPerm = yamlConfigurationOld.getBoolean("Command.Permission.Required");
|
||||||
|
|
||||||
|
setNew(enable, lines, name, fillItemEnable, fillItem, alias, aliasPerm, yamlConfiguration);
|
||||||
|
|
||||||
|
for (String key : yamlConfigurationOld.getConfigurationSection("Slots").getKeys(false)) {
|
||||||
|
Integer slotNumber = yamlConfigurationOld.getInt("Slots." + key + ".Slot");
|
||||||
|
Boolean slotEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Enable");
|
||||||
|
Boolean permRequired = yamlConfigurationOld.getBoolean("Slots." + key + ".Permission.Required");
|
||||||
|
|
||||||
|
Boolean empty = yamlConfigurationOld.getBoolean("Slots." + key + ".Item.Empty");
|
||||||
|
Integer itemAmount = yamlConfigurationOld.getInt("Slots." + key + ".Item.Amount");
|
||||||
|
Boolean playerHeadEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Item.PlayerHead.Enable");
|
||||||
|
Boolean base64Enable = yamlConfigurationOld.getBoolean("Slots." + key + ".Item.PlayerHead.Base64.Enable");
|
||||||
|
String base64Value = yamlConfigurationOld.getString("Slots." + key + ".Item.PlayerHead.Base64.Base64Value");
|
||||||
|
Boolean playerWhoHasOpenedTheGUI = yamlConfigurationOld.getBoolean("Slots." + key + ".Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
||||||
|
String playerName = yamlConfigurationOld.getString("Slots." + key + ".Item.PlayerHead.PlayerName");
|
||||||
|
String itemMaterial = yamlConfigurationOld.getString("Slots." + key + ".Item.Material");
|
||||||
|
String itemName = yamlConfigurationOld.getString("Slots." + key + ".Item.Name");
|
||||||
|
List<String> lore = yamlConfigurationOld.getStringList("Slots." + key + ".Item.Lore");
|
||||||
|
Boolean customSoundEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".CustomSound.Enable");
|
||||||
|
Boolean customSoundNoSound = yamlConfigurationOld.getBoolean("Slots." + key + ".CustomSound.NoSound");
|
||||||
|
String customSoundSound = yamlConfigurationOld.getString("Slots." + key + ".CustomSound.Sound");
|
||||||
|
Boolean costEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Cost.Enable");
|
||||||
|
Double price = yamlConfigurationOld.getDouble("Slots." + key + ".Cost.Price");
|
||||||
|
Boolean commandEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Command.Enable");
|
||||||
|
Boolean commandBungeeCommand = yamlConfigurationOld.getBoolean("Slots." + key + ".Command.BungeeCommand");
|
||||||
|
Boolean commandAsConsole = yamlConfigurationOld.getBoolean("Slots." + key + ".Command.CommandAsConsole");
|
||||||
|
List<String> command = yamlConfigurationOld.getStringList("Slots." + key + ".Command.Command");
|
||||||
|
Boolean serverChange = yamlConfigurationOld.getBoolean("Slots." + key + ".ServerChange.Enable");
|
||||||
|
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");
|
||||||
|
Boolean messageEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".Message.Enable");
|
||||||
|
List<String> message = yamlConfigurationOld.getStringList("Slots." + key + ".Message.Message");
|
||||||
|
Boolean setConfigEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.Enable");
|
||||||
|
String configFilePath = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.File.Path");
|
||||||
|
String configOptionPath = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Option.Path");
|
||||||
|
String configOptionPremat = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Option.Premat");
|
||||||
|
|
||||||
|
String configStringValueLeft = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Value.LeftClick.String");
|
||||||
|
Boolean configBooleanValueLeft = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.Value.LeftClick.Boolean");
|
||||||
|
Integer configIntegerValueLeft = yamlConfigurationOld.getInt("Slots." + key + ".SetConfig.Value.LeftClick.Integer");
|
||||||
|
Double configDoubleValueLeft = yamlConfigurationOld.getDouble("Slots." + key + ".SetConfig.Value.LeftClick.Double");
|
||||||
|
List<String> configListValueLeft = yamlConfigurationOld.getStringList("Slots." + key + ".SetConfig.Value.LeftClick.List");
|
||||||
|
|
||||||
|
String configStringValueRight = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.Value.RightClick.String");
|
||||||
|
Boolean configBooleanValueRight = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.Value.RightClick.Boolean");
|
||||||
|
Integer configIntegerValueRight = yamlConfigurationOld.getInt("Slots." + key + ".SetConfig.Value.RightClick.Integer");
|
||||||
|
Double configDoubleValueRight = yamlConfigurationOld.getDouble("Slots." + key + ".SetConfig.Value.RightClick.Double");
|
||||||
|
List<String> configListValueRight = yamlConfigurationOld.getStringList("Slots." + key + ".SetConfig.RightClick.Value.List");
|
||||||
|
|
||||||
|
Boolean pluginReloadEnable = yamlConfigurationOld.getBoolean("Slots." + key + ".SetConfig.PluginReload.Enable");
|
||||||
|
String pluginReloadCommand = yamlConfigurationOld.getString("Slots." + key + ".SetConfig.PluginReload.Command");
|
||||||
|
|
||||||
|
setNew(key, slotNumber, slotEnable, key, permRequired, yamlConfiguration);
|
||||||
|
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,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");
|
||||||
|
}
|
||||||
|
|
||||||
|
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----------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void renameFolder() {
|
||||||
|
File dir = new File(Main.getPath() + "/GUIs");
|
||||||
|
File newDir = new File(Main.getPath() + "/OldConfig/GUIs/Version4");
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileUtils.moveDirectory(dir, newDir);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setNew(Boolean enable, Integer lines, String name, Boolean fillItemEnable, String fillItem, Boolean alias, Boolean aliasPerm, YamlConfiguration yamlConfiguration) {
|
||||||
|
set("GUI.Enable", enable, yamlConfiguration);
|
||||||
|
set("GUI.Lines", lines, yamlConfiguration);
|
||||||
|
set("GUI.Name", name, yamlConfiguration);
|
||||||
|
set("GUI.FillItem.Enable", fillItemEnable, yamlConfiguration);
|
||||||
|
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
set("GUI.FillItem.GlassPaneColor", fillItem, yamlConfiguration);
|
||||||
|
} else set("GUI.FillItem.Item", fillItem, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Command.Alias", alias, yamlConfiguration);
|
||||||
|
set("Command.Permission.Required", aliasPerm, yamlConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setNew(String key, Integer slotNumber, Boolean slotEnable, String function, Boolean permRequired, YamlConfiguration yamlConfiguration) {
|
||||||
|
set("Slots." + key + ".Slot", slotNumber, yamlConfiguration);
|
||||||
|
set("Slots." + key + ".Enable", slotEnable, yamlConfiguration);
|
||||||
|
set("Slots." + key + ".Function", function, yamlConfiguration);
|
||||||
|
set("Slots." + key + ".Permission.Required", permRequired, yamlConfiguration);
|
||||||
|
set("Slots." + key + ".Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||||
|
set("Slots." + key + ".Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, String value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, Integer value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, Boolean value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
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----------------------");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,168 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.functions;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||||
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CreateFunctions {
|
||||||
|
public static void create() {
|
||||||
|
createFunction("UseItem", false, 1, false, false, "", false, "", "",
|
||||||
|
"&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,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, "",
|
||||||
|
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
|
||||||
|
|
||||||
|
createFunction("SupportDiscord", false, 1, true, true, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19",
|
||||||
|
false, "", "",
|
||||||
|
"&3Support Discord", Arrays.asList("&8-----------------", "&bIf you need help setting up the plugin,", "&bfeel free to contact me on the Suport Discord.",
|
||||||
|
"&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, "",
|
||||||
|
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, "",
|
||||||
|
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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,
|
||||||
|
Boolean configBooleanValueRight, Integer configIntegerValueRight, Double configDoubleValueRight, List<String> configListValueRight,
|
||||||
|
Boolean pluginReloadEnable, String pluginReloadCommand, Boolean functionVotePoints, FunctionVoteEnum functionVotePointsMode,
|
||||||
|
Integer functionVotePointsAmount, Boolean functionItem, FunctionItemEnum functionItemMode, String functionItemItem) {
|
||||||
|
long long_ = System.currentTimeMillis();
|
||||||
|
|
||||||
|
File config = new File(Main.getPath(), "Functions/" + fileName + ".yml");
|
||||||
|
int i = 1;
|
||||||
|
while (config.exists()) {
|
||||||
|
config = new File(Main.getPath(), "Functions/" + fileName + "-" + i + ".yml");
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
T2Csend.console(Util.getPrefix() + " §4Function GUI file (Functions/" + config.getName() + ") is loaded...");
|
||||||
|
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
set("Slots.Function.Item.Empty", empty, yamlConfiguration);
|
||||||
|
set("Slots.Function.Item.Amount", itemAmount, yamlConfiguration);
|
||||||
|
// if (!(MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12)) {
|
||||||
|
set("Slots.Function.Item.PlayerHead.Enable", playerHeadEnable, yamlConfiguration);
|
||||||
|
set("Slots.Function.Item.PlayerHead.Base64.Enable", base64Enable, yamlConfiguration);
|
||||||
|
set("Slots.Function.Item.PlayerHead.Base64.Base64Value", base64Value, yamlConfiguration);
|
||||||
|
set("Slots.Function.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", playerWhoHasOpenedTheGUI, yamlConfiguration);
|
||||||
|
set("Slots.Function.Item.PlayerHead.PlayerName", playerName, yamlConfiguration);
|
||||||
|
// }
|
||||||
|
set("Slots.Function.Item.Material", itemMaterial == null ? "" : itemMaterial, yamlConfiguration);
|
||||||
|
set("Slots.Function.Item.Name", name == null ? "" : name, yamlConfiguration);
|
||||||
|
set("Slots.Function.Item.Lore", lore, yamlConfiguration);
|
||||||
|
set("Slots.Function.NoPermission.Message.Enable", noPermMessageEnable, yamlConfiguration);
|
||||||
|
set("Slots.Function.NoPermission.Message.CustomNoPermMessage", customNoPermMessage, yamlConfiguration);
|
||||||
|
set("Slots.Function.NoPermission.Item.Lore.Enable", noPermLoreEnable, yamlConfiguration);
|
||||||
|
set("Slots.Function.NoPermission.Item.Lore.Lore", noPermLore, yamlConfiguration);
|
||||||
|
set("Slots.Function.CustomSound.Enable", customSoundEnable, yamlConfiguration);
|
||||||
|
set("Slots.Function.CustomSound.NoSound", customSoundNoSound, yamlConfiguration);
|
||||||
|
set("Slots.Function.CustomSound.Sound", customSoundSound == null ? "" : customSoundSound, yamlConfiguration);
|
||||||
|
set("Slots.Function.Cost.Enable", costEnable, yamlConfiguration);
|
||||||
|
set("Slots.Function.Cost.EcoModule", ecoModule, yamlConfiguration);
|
||||||
|
set("Slots.Function.Cost.Item", ecoItem, yamlConfiguration);
|
||||||
|
set("Slots.Function.Cost.VotePoints", ecoVotePoints, yamlConfiguration);
|
||||||
|
set("Slots.Function.Cost.Price", ecoPrice, yamlConfiguration);
|
||||||
|
set("Slots.Function.Command.Enable", commandEnable, yamlConfiguration);
|
||||||
|
set("Slots.Function.Command.BungeeCommand", commandBungeeCommand, yamlConfiguration);
|
||||||
|
set("Slots.Function.Command.CommandAsConsole", commandAsConsole, yamlConfiguration);
|
||||||
|
set("Slots.Function.Command.Command", command, yamlConfiguration);
|
||||||
|
set("Slots.Function.ServerChange.Enable", serverChange, yamlConfiguration);
|
||||||
|
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);
|
||||||
|
set("Slots.Function.Toggle.UseItem.Enable", toggleUseItem, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.Function.Message.Enable", messageEnable, yamlConfiguration);
|
||||||
|
set("Slots.Function.Message.Message", message, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.Function.SetConfig.Enable", setConfigEnable, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.File.Path", configFilePath == null ? "" : configFilePath, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Option.Path", configOptionPath == null ? "" : configOptionPath, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Option.Premat", configOptionPremat == null ? "" : configOptionPremat, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.LeftClick.String", configStringValueLeft == null ? "" : configStringValueLeft, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.LeftClick.Boolean", configBooleanValueLeft, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.LeftClick.Integer", configIntegerValueLeft, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.LeftClick.Double", configDoubleValueLeft, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.LeftClick.List", configListValueLeft, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.RightClick.String", configStringValueRight == null ? "" : configStringValueRight, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.RightClick.Boolean", configBooleanValueRight, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.RightClick.Integer", configIntegerValueRight, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.RightClick.Double", configDoubleValueRight, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.Value.RightClick.List", configListValueRight, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.PluginReload.Enable", pluginReloadEnable, yamlConfiguration);
|
||||||
|
set("Slots.Function.SetConfig.PluginReload.Command", pluginReloadCommand == null ? "" : pluginReloadCommand, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.Function.FunctionVotePoints.Enable", functionVotePoints, yamlConfiguration);
|
||||||
|
set("Slots.Function.FunctionVotePoints.Mode", functionVotePointsMode.toString(), yamlConfiguration);
|
||||||
|
set("Slots.Function.FunctionVotePoints.Amount", functionVotePointsAmount, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.Function.FunctionItem.Enable", functionItem, yamlConfiguration);
|
||||||
|
set("Slots.Function.FunctionItem.Mode", functionItemMode.toString(), yamlConfiguration);
|
||||||
|
set("Slots.Function.FunctionItem.Item", functionItemItem, yamlConfiguration);
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
T2Csend.console(Util.getPrefix() + " §2Function file (Functions/" + config.getName() + ") was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void set(String path, String value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, Integer value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, Boolean value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, List value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, Double value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,676 +0,0 @@
|
|||||||
// This class was created by JaTiTV.
|
|
||||||
|
|
||||||
package net.t2code.commandguiv2.Spigot.config.functions;
|
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
|
||||||
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
|
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Function;
|
|
||||||
import net.t2code.commandguiv2.Util;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
|
||||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
|
||||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class FunctionsFile {
|
|
||||||
public enum VALUES implements T2C_ConfigItem {
|
|
||||||
empty("Slots.Function.Item.Empty", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
itemAmount("Slots.Function.Item.Amount", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
playerHeadEnable("Slots.Function.Item.PlayerHead.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
base64Enable("Slots.Function.Item.PlayerHead.Base64.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
base64Value("Slots.Function.Item.PlayerHead.Base64.Base64Value", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
playerWhoHasOpenedTheGUI("Slots.Function.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
playerName("Slots.Function.Item.PlayerHead.PlayerName", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
itemMaterial("Slots.Function.Item.Material", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
name("Slots.Function.Item.Name", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
lore("Slots.Function.Item.Lore", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
noPermMessageEnable("Slots.Function.NoPermission.Message.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
customNoPermMessage("Slots.Function.NoPermission.Message.CustomNoPermMessage", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
noPermLoreEnable("Slots.Function.NoPermission.Item.Lore.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
noPermLore("Slots.Function.NoPermission.Item.Lore.Lore", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
customSoundEnable("Slots.Function.CustomSound.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
customSoundNoSound("Slots.Function.CustomSound.NoSound", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
customSoundSound("Slots.Function.CustomSound.Sound", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
costEnable("Slots.Function.Cost.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
ecoModule("Slots.Function.Cost.EcoModule", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
ecoItem("Slots.Function.Cost.Item", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
ecoVotePoints("Slots.Function.Cost.VotePoints", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
ecoPrice("Slots.Function.Cost.Price", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
commandEnable("Slots.Function.Command.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
commandBungeeCommand("Slots.Function.Command.BungeeCommand", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
commandAsConsole("Slots.Function.Command.CommandAsConsole", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
command("Slots.Function.Command.Command", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
serverChange("Slots.Function.ServerChange.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
serverChangeServer("Slots.Function.ServerChange.Server", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
openGUIEnable("Slots.Function.OpenGUI.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
openGUI("Slots.Function.OpenGUI.GUI", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
closeGUI("Slots.Function.CloseGUI.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
togglePermission("Slots.Function.Toggle.Permission.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
togglePermissionPerm("Slots.Function.Toggle.Permission.Permission", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
toggleUseItem("Slots.Function.Toggle.UseItem.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
messageEnable("Slots.Function.Message.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
message("Slots.Function.Message.Message", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
setConfigEnable("Slots.Function.SetConfig.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configFilePath("Slots.Function.SetConfig.File.Path", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configOptionPath("Slots.Function.SetConfig.Option.Path", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configOptionPremat("Slots.Function.SetConfig.Option.Premat", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
configStringValueLeft("Slots.Function.SetConfig.Value.LeftClick.String", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configBooleanValueLeft("Slots.Function.SetConfig.Value.LeftClick.Boolean", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configIntegerValueLeft("Slots.Function.SetConfig.Value.LeftClick.Integer", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configDoubleValueLeft("Slots.Function.SetConfig.Value.LeftClick.Double", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configListValueLeft("Slots.Function.SetConfig.Value.LeftClick.List", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
configStringValueRight("Slots.Function.SetConfig.Value.RightClick.String", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configBooleanValueRight("Slots.Function.SetConfig.Value.RightClick.Boolean", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configIntegerValueRight("Slots.Function.SetConfig.Value.RightClick.Integer", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configDoubleValueRight("Slots.Function.SetConfig.Value.RightClick.Double", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
configListValueRight("Slots.Function.SetConfig.Value.RightClick.List", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
pluginReloadEnable("Slots.Function.SetConfig.PluginReload.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
pluginReloadCommand("Slots.Function.SetConfig.PluginReload.Command", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
functionVotePoints("Slots.Function.FunctionVotePoints.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
functionVotePointsMode("Slots.Function.FunctionVotePoints.Mode", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
functionVotePointsAmount("Slots.Function.FunctionVotePoints.Amount", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
functionItem("Slots.Function.FunctionItem.Enable", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
functionItemMode("Slots.Function.FunctionItem.Mode", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
functionItemItem("Slots.Function.FunctionItem.Item", null, true,
|
|
||||||
new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
private final String path;
|
|
||||||
private Object value;
|
|
||||||
private final boolean forceSet;
|
|
||||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
|
||||||
|
|
||||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
|
||||||
this.path = path;
|
|
||||||
this.value = value;
|
|
||||||
this.forceSet = forceSet;
|
|
||||||
this.comments = comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getForceSet() {
|
|
||||||
return forceSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
|
||||||
return comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLanguagePath() {
|
|
||||||
return Config.VALUES.language.getValue().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setValue(Object newValue) {
|
|
||||||
value = newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void select(boolean isReload) {
|
|
||||||
Main.functionHashMap.clear();
|
|
||||||
File f = new File(Main.getPath() + "/Functions/");
|
|
||||||
File[] fileArray = f.listFiles();
|
|
||||||
|
|
||||||
assert fileArray != null;
|
|
||||||
for (File file : fileArray) {
|
|
||||||
String sub = file.getName().substring(file.getName().length() - 4);
|
|
||||||
if (sub.equals(".yml")) {
|
|
||||||
|
|
||||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), file, VALUES.values(), isReload, Util.getConfigLogo());
|
|
||||||
|
|
||||||
EcoEnum ecoModule = null;
|
|
||||||
if (VALUES.ecoModule.value != null) {
|
|
||||||
try {
|
|
||||||
ecoModule = EcoEnum.valueOf(VALUES.ecoModule.value.toString().toUpperCase());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
T2C_Send.error(Main.getPlugin(), "The EcoModule " + VALUES.ecoModule.value.toString().toUpperCase() + " in the function file "
|
|
||||||
+ file.getName() + " does not exist. Please use one of the supported modules. (VAULT, ITEM, VOTEPOINTS)");
|
|
||||||
}
|
|
||||||
} else ecoModule = EcoEnum.VAULT;
|
|
||||||
|
|
||||||
FunctionVoteEnum functionVotePointsMode = null;
|
|
||||||
if (VALUES.functionVotePointsMode.value != null) {
|
|
||||||
try {
|
|
||||||
functionVotePointsMode = FunctionVoteEnum.valueOf(VALUES.functionVotePointsMode.value.toString().toUpperCase());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
T2C_Send.error(Main.getPlugin(), "The VotePoints Mode " + VALUES.functionVotePointsMode.value.toString().toUpperCase() + " in the function file "
|
|
||||||
+ file.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FunctionItemEnum functionItemMode = null;
|
|
||||||
if (VALUES.functionItemMode.value != null) {
|
|
||||||
try {
|
|
||||||
functionItemMode = FunctionItemEnum.valueOf(VALUES.functionItemMode.value.toString().toUpperCase());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
T2C_Send.error(Main.getPlugin(), "The Item Mode " + VALUES.functionItemMode.value.toString().toUpperCase() + " in the function file "
|
|
||||||
+ f.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Util.replace(VALUES.name);
|
|
||||||
Util.replace(VALUES.lore);
|
|
||||||
Util.replace(VALUES.noPermLore);
|
|
||||||
Util.replace(VALUES.message);
|
|
||||||
|
|
||||||
String key = file.getName().replace(".yml", "");
|
|
||||||
Function function = new Function(key, (boolean) VALUES.empty.value, (int) VALUES.itemAmount.value, (boolean) VALUES.playerHeadEnable.value, (boolean) VALUES.base64Enable.value,
|
|
||||||
VALUES.base64Value.value.toString(), (boolean) VALUES.playerWhoHasOpenedTheGUI.value, VALUES.playerName.value.toString(), VALUES.itemMaterial.value.toString(),
|
|
||||||
VALUES.name.value.toString(), (List<String>) VALUES.lore.value, (boolean) VALUES.noPermMessageEnable.value, VALUES.customNoPermMessage.value.toString(),
|
|
||||||
(boolean) VALUES.noPermLoreEnable.value, (List<String>) VALUES.noPermLore.value, (boolean) VALUES.customSoundEnable.value, (boolean) VALUES.customSoundNoSound.value,
|
|
||||||
VALUES.customSoundSound.value.toString(), (boolean) VALUES.costEnable.value, ecoModule, VALUES.ecoItem.value.toString(),
|
|
||||||
(int) VALUES.ecoVotePoints.value, (double) VALUES.ecoPrice.value, (boolean) VALUES.commandEnable.value, (boolean) VALUES.commandBungeeCommand.value,
|
|
||||||
(boolean) VALUES.commandAsConsole.value, (List<String>) VALUES.command.value, (boolean) VALUES.serverChange.value, VALUES.serverChangeServer.value.toString(),
|
|
||||||
(boolean) VALUES.openGUIEnable.value, VALUES.openGUI.value.toString(), (boolean) VALUES.closeGUI.value, (boolean) VALUES.togglePermission.value,
|
|
||||||
VALUES.togglePermissionPerm.value.toString(), (boolean) VALUES.toggleUseItem.value, (boolean) VALUES.messageEnable.value, (List<String>) VALUES.message.value,
|
|
||||||
(boolean) VALUES.setConfigEnable.value, VALUES.configFilePath.value.toString(), VALUES.configOptionPath.value.toString(), VALUES.configOptionPremat.value.toString(),
|
|
||||||
VALUES.configStringValueLeft.value.toString(), (boolean) VALUES.configBooleanValueLeft.value, (int) VALUES.configIntegerValueLeft.value, (double) VALUES.configDoubleValueLeft.value,
|
|
||||||
(List<String>) VALUES.configListValueLeft.value, VALUES.configStringValueRight.value.toString(), (boolean) VALUES.configBooleanValueRight.value, (int) VALUES.configIntegerValueRight.value,
|
|
||||||
(double) VALUES.configDoubleValueRight.value, (List<String>) VALUES.configListValueRight.value, (boolean) VALUES.pluginReloadEnable.value, VALUES.pluginReloadCommand.value.toString(),
|
|
||||||
(boolean) VALUES.functionVotePoints.value, functionVotePointsMode, (int) VALUES.functionVotePointsAmount.value, (boolean) VALUES.functionItem.value,
|
|
||||||
functionItemMode, VALUES.functionItemItem.value.toString());
|
|
||||||
Main.functionHashMap.put(key, function);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void createDefault(boolean isReload) {
|
|
||||||
createFunction("useItem", isReload,false, 1, false, false, "", false, "", "",
|
|
||||||
"&6Toggle UseItem", List.of("&bYou currently have the UseItem set to: %commandgui_useitem%"), true, "", true,
|
|
||||||
List.of("&8-----------------", "&4No Permission for this Function", "&8-----------------"), false, false,
|
|
||||||
"", false, "VAULT", "DIRT;5", 0, 0.0, false, false, false, List.of(), false,
|
|
||||||
"", false, "", false, false, "", true, true,
|
|
||||||
List.of("&bYour UseItem was set to: %commandgui_useitem%&b."), false, "", "", "String",
|
|
||||||
"", false, 0, 0.0, List.of(), "", false,
|
|
||||||
0, 0.0, List.of(), false, "",
|
|
||||||
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
|
|
||||||
|
|
||||||
|
|
||||||
List<String> dclist;
|
|
||||||
if (T2C_Main.getMmIsLoad()) {
|
|
||||||
dclist = List.of("<dark_gray>[<dark_red>T<gray>2</gray>Code</dark_red>]</dark_gray> <gold><hover:show_text:'<color:#7289da>http://dc.t2code.net</color>'><click:open_url:'http://dc.t2code.net'>You can find more information on Discord</click></hover></gold>");
|
|
||||||
} else dclist = List.of("&6You can find more information on Discord: &ehttp://dc.t2code.net");
|
|
||||||
|
|
||||||
|
|
||||||
createFunction("supportDiscord",isReload, false, 1, true, true, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19",
|
|
||||||
false, "", "",
|
|
||||||
"&3Support Discord", List.of("&8-----------------", "&bIf you need help setting up the plugin,", "&bfeel free to contact me on the Suport Discord.",
|
|
||||||
"&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, List.of(), false, "", false, "", false, false, "",
|
|
||||||
false, true, dclist, false, "",
|
|
||||||
"", "String", "", false, 0, 0.0, List.of(),
|
|
||||||
"", false, 0, 0.0, List.of(), false, "",
|
|
||||||
false, FunctionVoteEnum.ADD, 0, false, FunctionItemEnum.REMOVE, "DIRT;5");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void createFunction(String fileName, boolean isReload,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 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,
|
|
||||||
Boolean configBooleanValueRight, Integer configIntegerValueRight, Double configDoubleValueRight, List<String> configListValueRight,
|
|
||||||
Boolean pluginReloadEnable, String pluginReloadCommand, Boolean functionVotePoints, FunctionVoteEnum functionVotePointsMode,
|
|
||||||
Integer functionVotePointsAmount, Boolean functionItem, FunctionItemEnum functionItemMode, String functionItemItem) {
|
|
||||||
VALUES.empty.setValue(empty);
|
|
||||||
VALUES.itemAmount.setValue(itemAmount);
|
|
||||||
VALUES.playerHeadEnable.setValue(playerHeadEnable);
|
|
||||||
VALUES.base64Enable.setValue(base64Enable);
|
|
||||||
VALUES.base64Value.setValue(base64Value);
|
|
||||||
VALUES.playerWhoHasOpenedTheGUI.setValue(playerWhoHasOpenedTheGUI);
|
|
||||||
VALUES.playerName.setValue(playerName);
|
|
||||||
// }
|
|
||||||
VALUES.itemMaterial.setValue(itemMaterial == null ? "" : itemMaterial);
|
|
||||||
VALUES.name.setValue(name == null ? "" : name);
|
|
||||||
VALUES.lore.setValue(lore);
|
|
||||||
VALUES.noPermMessageEnable.setValue(noPermMessageEnable);
|
|
||||||
VALUES.customNoPermMessage.setValue(customNoPermMessage);
|
|
||||||
VALUES.noPermLoreEnable.setValue(noPermLoreEnable);
|
|
||||||
VALUES.noPermLore.setValue(noPermLore);
|
|
||||||
VALUES.customSoundEnable.setValue(customSoundEnable);
|
|
||||||
VALUES.customSoundNoSound.setValue(customSoundNoSound);
|
|
||||||
VALUES.customSoundSound.setValue(customSoundSound == null ? "" : customSoundSound);
|
|
||||||
VALUES.costEnable.setValue(costEnable);
|
|
||||||
VALUES.ecoModule.setValue(ecoModule);
|
|
||||||
VALUES.ecoItem.setValue(ecoItem);
|
|
||||||
VALUES.ecoVotePoints.setValue(ecoVotePoints);
|
|
||||||
VALUES.ecoPrice.setValue(ecoPrice);
|
|
||||||
VALUES.commandEnable.setValue(commandEnable);
|
|
||||||
VALUES.commandBungeeCommand.setValue(commandBungeeCommand);
|
|
||||||
VALUES.commandAsConsole.setValue(commandAsConsole);
|
|
||||||
VALUES.command.setValue(command);
|
|
||||||
VALUES.serverChange.setValue(serverChange);
|
|
||||||
VALUES.serverChangeServer.setValue(serverChangeServer == null ? "" : serverChangeServer);
|
|
||||||
VALUES.openGUIEnable.setValue(openGUIEnable);
|
|
||||||
VALUES.openGUI.setValue(openGUI == null ? "" : openGUI);
|
|
||||||
VALUES.closeGUI.setValue(closeGUI);
|
|
||||||
|
|
||||||
VALUES.togglePermission.setValue(togglePermission);
|
|
||||||
VALUES.togglePermissionPerm.setValue(togglePermissionPerm == null ? "" : togglePermissionPerm);
|
|
||||||
VALUES.toggleUseItem.setValue(toggleUseItem);
|
|
||||||
|
|
||||||
VALUES.messageEnable.setValue(messageEnable);
|
|
||||||
VALUES.message.setValue(message);
|
|
||||||
|
|
||||||
VALUES.setConfigEnable.setValue(setConfigEnable);
|
|
||||||
VALUES.configFilePath.setValue(configFilePath == null ? "" : configFilePath);
|
|
||||||
VALUES.configOptionPath.setValue(configOptionPath == null ? "" : configOptionPath);
|
|
||||||
VALUES.configOptionPremat.setValue(configOptionPremat == null ? "" : configOptionPremat);
|
|
||||||
VALUES.configStringValueLeft.setValue(configStringValueLeft == null ? "" : configStringValueLeft);
|
|
||||||
VALUES.configBooleanValueLeft.setValue(configBooleanValueLeft);
|
|
||||||
VALUES.configIntegerValueLeft.setValue(configIntegerValueLeft);
|
|
||||||
VALUES.configDoubleValueLeft.setValue(configDoubleValueLeft);
|
|
||||||
VALUES.configListValueLeft.setValue(configListValueLeft);
|
|
||||||
VALUES.configStringValueRight.setValue(configStringValueRight == null ? "" : configStringValueRight);
|
|
||||||
VALUES.configBooleanValueRight.setValue(configBooleanValueRight);
|
|
||||||
VALUES.configIntegerValueRight.setValue(configIntegerValueRight);
|
|
||||||
VALUES.configDoubleValueRight.setValue(configDoubleValueRight);
|
|
||||||
VALUES.configListValueRight.setValue(configListValueRight);
|
|
||||||
VALUES.pluginReloadEnable.setValue(pluginReloadEnable);
|
|
||||||
VALUES.pluginReloadCommand.setValue(pluginReloadCommand == null ? "" : pluginReloadCommand);
|
|
||||||
|
|
||||||
VALUES.functionVotePoints.setValue(functionVotePoints);
|
|
||||||
VALUES.functionVotePointsMode.setValue(functionVotePointsMode.toString());
|
|
||||||
VALUES.functionVotePointsAmount.setValue(functionVotePointsAmount);
|
|
||||||
|
|
||||||
VALUES.functionItem.setValue(functionItem);
|
|
||||||
VALUES.functionItemMode.setValue(functionItemMode.toString());
|
|
||||||
VALUES.functionItemItem.setValue(functionItemItem);
|
|
||||||
|
|
||||||
File file = new File(Main.getPath(), "Functions/" + fileName + ".yml");
|
|
||||||
int i = 1;
|
|
||||||
while (file.exists()) {
|
|
||||||
file = new File(Main.getPath(), "Functions/" + fileName + "-" + i + ".yml");
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), file, VALUES.values(), isReload, Util.getConfigLogo());
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,71 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.gui;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
public class CreateGUI {
|
||||||
|
public static void configCreate() {
|
||||||
|
long long_ = System.currentTimeMillis();
|
||||||
|
T2Csend.console(Util.getPrefix() + " §4Default GUI file (GUIs/default.yml) is loaded...");
|
||||||
|
File config = new File(Main.getPath(), "GUIs/default.yml");
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
set("GUI.Enable", true, yamlConfiguration);
|
||||||
|
set("GUI.Lines", 1, yamlConfiguration);
|
||||||
|
set("GUI.Name", "&5default &9GUI", yamlConfiguration);
|
||||||
|
set("GUI.FillItem.Enable", true, yamlConfiguration);
|
||||||
|
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
set("GUI.FillItem.GlassPaneColor", 15, yamlConfiguration);
|
||||||
|
} else set("GUI.FillItem.Item", "BLACK_STAINED_GLASS_PANE", yamlConfiguration);
|
||||||
|
|
||||||
|
set("Command.Alias", true, yamlConfiguration);
|
||||||
|
set("Command.Permission.Required", true, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.SupportDiscord.Slot", 4, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.Enable", true, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.Function", "SupportDiscord", yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.Permission.Required", false, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.UseItem.Slot", 6, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Enable", true, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Function", "UseItem", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Permission.Required", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Permission.See", "commandgui.gui.[function].slot.[slot].see", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Permission.Use", "commandgui.gui.[function].slot.[slot].use", yamlConfiguration);
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
T2Csend.console(Util.getPrefix() + " §2Default GUI file (GUIs/default.yml) was loaded." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, String value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, Integer value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, Boolean value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,245 +0,0 @@
|
|||||||
// This class was created by JaTiTV.
|
|
||||||
|
|
||||||
package net.t2code.commandguiv2.Spigot.config.gui;
|
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Function;
|
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Slot;
|
|
||||||
import net.t2code.commandguiv2.Util;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
|
||||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
|
||||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class GuiFile {
|
|
||||||
|
|
||||||
public enum VALUES implements T2C_ConfigItem {
|
|
||||||
|
|
||||||
guiEnable("GUI.Enable", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
guiLines("GUI.Lines", 1, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
guiName("GUI.Name", "&5default &9GUI", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
guiFillItemEnable("GUI.FillItem.Enable", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
guiFillItemItem(isGlassColor() ? "GUI.FillItem.GlassPaneColor" : "GUI.FillItem.Item", isGlassColor() ? 15 : "BLACK_STAINED_GLASS_PANE", true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
commandAliasEnable("Command.Alias", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
commandPermission("Command.Permission.Required", true, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotSection("Slots", null, true,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
slotDiscordNumber("Slots.SupportDiscord.Slot", 4, false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotDiscordEnable("Slots.SupportDiscord.Enable", true, false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotDiscordFunction("Slots.SupportDiscord.Function", "supportDiscord", false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotDiscordPermRequired("Slots.SupportDiscord.Permission.Required", false, false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotDiscordPermSee("Slots.SupportDiscord.Permission.See", "commandgui.gui.[function].slot.[slot].see", false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotDiscordPermUse("Slots.SupportDiscord.Permission.Use", "commandgui.gui.[function].slot.[slot].use", false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotUseItemNumber("Slots.UseItem.Slot", 6, false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotUseItemEnable("Slots.UseItem.Enable", true, false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotUseItemFunction("Slots.UseItem.Function", "useItem", false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotUseItemPermRequired("Slots.UseItem.Permission.Required", false, false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotUseItemPermSee("Slots.UseItem.Permission.See", "commandgui.gui.[function].slot.[slot].see", false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
slotUseItemPermUse("Slots.UseItem.Permission.Use", "commandgui.gui.[function].slot.[slot].use", false,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
;
|
|
||||||
|
|
||||||
private final String path;
|
|
||||||
private Object value;
|
|
||||||
private final boolean forceSet;
|
|
||||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
|
||||||
|
|
||||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
|
||||||
this.path = path;
|
|
||||||
this.value = value;
|
|
||||||
this.forceSet = forceSet;
|
|
||||||
this.comments = comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getForceSet() {
|
|
||||||
return forceSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
|
||||||
return comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLanguagePath() {
|
|
||||||
return Config.VALUES.language.getValue().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setValue(Object newValue) {
|
|
||||||
value = newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isGlassColor() {
|
|
||||||
if (T2C_McVersion.isMc1_8() || T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createDefault(boolean isReload) {
|
|
||||||
File file = new File(Main.getPath(), "GUIs/default.yml");
|
|
||||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), file, VALUES.values(), isReload, Util.getConfigLogo());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set(boolean isReload) {
|
|
||||||
Main.guiHashMap.clear();
|
|
||||||
Main.allAliases.clear();
|
|
||||||
File f = new File(Main.getPath() + "/GUIs/");
|
|
||||||
f.mkdirs();
|
|
||||||
File[] fileArray = f.listFiles();
|
|
||||||
|
|
||||||
for (File file : fileArray) {
|
|
||||||
String sub = file.getName().substring(file.getName().length() - 4);
|
|
||||||
if (sub.equals(".yml")) {
|
|
||||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), file, VALUES.values(), isReload, Util.getConfigLogo());
|
|
||||||
String guiName = file.getName().replace(".yml", "");
|
|
||||||
Main.allAliases.add(guiName);
|
|
||||||
|
|
||||||
Util.replace(VALUES.guiName);
|
|
||||||
|
|
||||||
Gui gui = new Gui(
|
|
||||||
(boolean) VALUES.guiEnable.value,
|
|
||||||
(int) VALUES.guiLines.value,
|
|
||||||
VALUES.guiName.value.toString(),
|
|
||||||
(boolean) VALUES.guiFillItemEnable.value,
|
|
||||||
VALUES.guiFillItemItem.value.toString(),
|
|
||||||
guiName,
|
|
||||||
(boolean) VALUES.commandAliasEnable.value,
|
|
||||||
(boolean) VALUES.commandPermission.value,
|
|
||||||
getSlots(file, guiName));
|
|
||||||
Main.guiHashMap.put(guiName, gui);
|
|
||||||
CmdExecuter_GUI.arg1.put(file.getName()
|
|
||||||
.replace(".yml", ""), "commandgui.gui." + guiName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ArrayList<Slot> getSlots(File file, String guiName) {
|
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(file);
|
|
||||||
ArrayList<Slot> slots = new ArrayList<>();
|
|
||||||
for (String key : yamlConfiguration.getConfigurationSection(VALUES.slotSection.getPath()).getKeys(false)) {
|
|
||||||
int slotNumber = yamlConfiguration.getInt("Slots." + key + ".Slot") - 1;
|
|
||||||
Boolean enable = yamlConfiguration.getBoolean("Slots." + key + ".Enable");
|
|
||||||
String function = yamlConfiguration.getString("Slots." + key + ".Function");
|
|
||||||
Function functionCheck = Main.functionHashMap.get(function);
|
|
||||||
if (functionCheck == null) {
|
|
||||||
T2C_Send.error(Main.getPlugin(), "The Function " + function + " in the GUI " + guiName + " does not exist!");
|
|
||||||
}
|
|
||||||
Boolean permRequired = yamlConfiguration.getBoolean("Slots." + key + ".Permission.Required");
|
|
||||||
String permSee = yamlConfiguration.getString("Slots." + key + ".Permission.See");
|
|
||||||
String permUse = yamlConfiguration.getString("Slots." + key + ".Permission.Use");
|
|
||||||
|
|
||||||
Slot slot = new Slot(slotNumber, enable, function, permRequired,
|
|
||||||
permSee.replace("[function]", guiName).replace("[slot]", String.valueOf(slotNumber + 1))
|
|
||||||
.replace("[slotname]", key.toLowerCase()),
|
|
||||||
permUse.replace("[function]", guiName).replace("[slot]", String.valueOf(slotNumber + 1))
|
|
||||||
.replace("[slotname]", key.toLowerCase()));
|
|
||||||
slots.add(slot);
|
|
||||||
}
|
|
||||||
return slots;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,624 +0,0 @@
|
|||||||
// This class was created by JaTiTV.
|
|
||||||
|
|
||||||
package net.t2code.commandguiv2.Spigot.config.languages;
|
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
|
||||||
import net.t2code.commandguiv2.Util;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_LanguageWriter;
|
|
||||||
import net.t2code.t2codelib.util.T2C_ConfigItemLanguages;
|
|
||||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class Languages {
|
|
||||||
public enum VALUES implements T2C_ConfigItemLanguages {
|
|
||||||
|
|
||||||
VaultNotSetUp("Plugin.VaultNotSetUp", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_red>Vault / Economy nicht eingerichtet!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_red>Vault / Economy not set up!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
SoundNotFound("Plugin.SoundNotFound", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_red>Der Sound <gold>[sound] <dark_red>wurde nicht gefunden! Bitte überprüfe die Einstellungen."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_red>The sound <gold>[sound] <dark_red>was not found! Please check the settings."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
OnlyForPlayer("Plugin.OnlyForPlayer", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Dieser Command ist nur für Spieler!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>This command is for players only!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
DefaultGUIcreate("Plugin.DefaultGUI.create", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>DefaultGUI wurde erstellt. Du findest sie im Verzeichnis: <yellow>[directory]<dark_green>!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>DefaultGUI was created. You can find it in the directory: <yellow>[directory]<dark_green>!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
ReloadStart("Plugin.Reload.Start", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Plugin wird neu geladen..."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>Plugin is reloaded..."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
ReloadEnd("Plugin.Reload.End", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Du hast keine Permission für <dark_red>Command<blue>GUI<red>!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>Plugin was successfully reloaded."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
NoPermission("NoPermission.ForCommandGUI", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Du hast keine Permission für <dark_red>Command<blue>GUI<red>!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>You do not have permission for <dark_red>Command<blue>GUI<red>!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
NoPermissionForCommand("NoPermission.ForCommand", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Für <aqua>[cmd] <red>fehlt dir die Permission <gold>[perm]<red>!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>For <aqua>[cmd] <red>you lack the permission <gold>[perm]<red>!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
NoPermissionForUseItem("NoPermission.ForUseItem", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Dir fehlt die Permission <gold>[perm] <red>um das Item für die GUI: <gold>[gui] <red>nutzen zu können."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>You lack the permission <gold>[perm] <red>to use the item for the GUI: <gold>[gui]."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
NoPermissionForItem("NoPermission.ForItem", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Für <aqua>[item] <red>fehlt dir die Permission <gold>[perm]<red>!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>For <aqua>[item] <red>you lack the permission <gold>[perm]<red>!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
ItemON("UseItem.UseItem_ON", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Du hast das GUI-Item aktiviert."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You have activated the GUI item."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
ItemOFF("UseItem.UseItem_OFF", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Du hast das GUI-Item deaktiviert."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You have disabled the GUI item."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
ItemSlot("UseItem.Change_Slot", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Du hast das GUI-Item auf Slot <gold>[slot] <dark_green>umgestellt."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You have changed the GUI item to slot: <gold>[slot]<dark_green>."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
ItemSlotNotEmpty("UseItem.SlotNotEmpty", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Der Slot §e[slot] §6ist derzeit belegt!."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>The slot <yellow>[slot] <gold>is currently occupied!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
ItemSlotAlreadySet("UseItem.SlotAlreadySet", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Der Slot §e[slot] §6ist bereits eingestellt!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>The slot §e[slot] §6is already set!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
ItemSlot_wrongValue("UseItem.ItemSlot_wrongValue", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Der angegebene Slot muss sich zwischen 1 und 9 befinden!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>The specified slot must be between 1 and 9!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
UseItemDisabledInGameMode("UseItem.DisabledInGameMode", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Das UseItem ist in diesem GameMode deaktiviert!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>The UseItem is disabled in this GameMode!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
UseItemDisabledInWorld("UseItem.DisabledInWorld", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Das UseItem ist in dieser Welt deaktiviert!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>The UseItem is disabled in this World!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
Buy_msg("Cost.Buy_msg", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Du hast dir [itemname] <dark_green>für <gold>[price] <dark_green>gekauft."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You bought [itemname] <dark_green>for <gold>[price]<dark_green>."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
noMoney("Cost.noMoney", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<red>Du benötigst [price].'>[prefix] <red>Du hast nicht genügend Geld!</hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<red>You need: <gold>[price]<red>.'>[prefix] <red>You don't have enough money!</hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
noMoneyItem("Cost.noItem", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<red>Du benötigst: <gold>[amount]<red>.'>[prefix] <red>Du hast nicht genügend Items von <gold>[item] <red>im Inventar!</hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<red>You need: <gold>[amount]<red>.'>[prefix] <red>You don't have enough items of <gold>[item] <red>in your inventory!</hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
noMoneyVote("Cost.noVote", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<red>Du benötigst: <gold>[amount]<red>.'>[prefix] <red>Du hast nicht genügend Vote Punkte!</hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<red>You need: <gold>[amount]<red>.'>[prefix] <red>You do not have enough vote points!</hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
NoInventorySpace("Cost.NoInventorySpace", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Du hast keinen Platz in deinem Inventar!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>You have no room in your inventory!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
onServerChange("ServerChange.onServerChange", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Du wirst auf den Server §e[server] §2verbunden."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You will be connected to the server <yellow>[server]§2."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
guiNotFound("GUI.GUInotFound", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Die von die gew[ae]hlte GUI gibt es nicht."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>The GUI chosen by the does not exist."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
GUIIsDisabled("GUI.GUIisDisabled", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Die GUI [gui] <red>ist derzeit Deaktiviert!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>The GUI [gui] <red>is currently Disabled!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
Give_Sender("Give.Sender", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Du hast <gold>[player] <dark_green>ein [item] <dark_green>gegeben!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You have given <gold>[player] <dark_green>an [item] <dark_green>!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
Give_Receiver("Give.Receiver", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Du hast von <gold>[sender] <dark_green>, [item] <dark_green>bekommen!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You got <dark_green>, [item] <dark_green>from <gold>[sender]!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerNotFond("Player.PlayerNotFond", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Der Spieler <gold>[player] <red>wurde nicht gefunden oder ist nicht Online!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>The player <gold>[player] <red>was not found or is not online!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerNoInventorySpace("Player.PlayerNoInventorySpace", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>[player] <red>hat keinen freien Platz in seinem Inventar!"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>[player] <red>has no free space in his inventory!"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
functionItemAdd("FunctionItem.Add", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Dir wurden <gold>[amount] [item] <dark_green>in dein Inventar gelegt."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You have <gold>[amount] [item] <dark_green>placed in your inventory."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
functionItemRemove("FunctionItem.Remove", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Dir wurden <gold>[amount] [item] <dark_green>entfernt."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You have been <gold>[amount] [item] <dark_green>removed."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
functionItemRemoveError("FunctionItem.RemoveError", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<red>Du benötigst <gold>[amount] [item]<red>!'>[prefix] <red>Du hast nicht so viele Items!</hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<red>You need <gold>[amount] [item]<red>!'>[prefix] <red>You don't have so many items!</hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
functionVoteAdd("FunctionVote.Add", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Dir wurden <gold>[amount] <dark_green>Vote Punkte gegeben."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You were given <gold>[amount] <dark_green>Vote points."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
functionVoteRemove("FunctionVote.Remove", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Dir wurden <gold>[amount] <dark_green>Vote Punkte entfernt."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You have been removed <gold>[amount] <dark_green>Vote points."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
functionVoteRemoveError("FunctionVote.RemoveError", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<red>Du benötigst <gold>[amount]<red>!'>[prefix] <red>Du hast nicht so viele VotePunkte!</hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<red>You need <gold>[amount]<red>!'>[prefix] <red>You don't have so many VotePoints!</hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
HelpCgui("Help.CGUI", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/commandgui <dark_gray>| <aqua>/cgui<dark_gray>'' <yellow>Öffne die default GUI <gray>(<yellow>[gui]<gray>)<yellow>."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/commandgui <dark_gray>| <aqua>/cgui<dark_gray>'' <yellow>Open the default GUI <gray>(<yellow>[gui]<gray>)<yellow>."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
HelpHelp("Help.Help", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/commandguihelp<dark_gray>'' <yellow>Öffne diese help."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/commandguihelp<dark_gray>'' <yellow>Open this help."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
HelpInfo("Help.Info", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/commandgui admin info<dark_gray>'' <yellow>Rufe die Infos von <dark_red>Command<blue>GUI <yellow>auf."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/commandgui admin info<dark_gray>'' <yellow>Call the info from <dark_red>Command<blue>GUI <yellow>."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
HelpOpen("Help.Open", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/commandgui [gui]<dark_gray>'' <yellow>Öffne die GUI: <gold>[guiname]<yellow>."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/commandgui [gui]<dark_gray>'' <yellow>Open the GUI: <gold>[guiname]<yellow>."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
HelpGive("Help.Give", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/commandgui admin give <gray><player><dark_gray>'' <yellow>Gebe einem Spieler das GUI-Item."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/commandgui admin give <gray><player><dark_gray>'' <yellow>Give a player the GUI item."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
HelpCreateDefaultGUI("Help.CreateDefaultGUI", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/commandgui admin createdefaultgui<dark_gray>'' <yellow>Lasse eine default GUI erstellen <gray>([directory])<yellow>."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/commandgui admin createdefaultgui<dark_gray>'' <yellow>Create a default GUI <gray>([directory])<yellow>."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
HelpReload("Help.Reload", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/commandgui admin reload<dark_gray>'' <yellow>Lade das Plugin neu."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/commandgui admin reload<dark_gray>'' <yellow>Reload the plugin."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
GUIItemHelp_on("Help.UseItem_On", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/gui-item on<dark_gray>'' <yellow>Aktiviere für dich das GUIItem."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/gui-item on<dark_gray>'' <yellow>Activate the GUIItem for you."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
GUIItemHelp_off("Help.UseItem_Off", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/gui-item off<dark_gray>'' <yellow>Deaktiviere für dich das GUIItem."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/gui-item off<dark_gray>'' <yellow>Disable the GUIItem for yourself."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
GUIItemHelp_Slot("Help.UseItem_Slot", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<dark_gray>''<aqua>/gui-item slot <gray><slot><dark_gray>'' <yellow>Stelle den Slot ein, auf den du das GUIItem haben möchtest."));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<dark_gray>''<aqua>/gui-item slot <gray><slot><dark_gray>'' <yellow>Set the slot where you want to have the GUIItem."));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerHelpCgui("Help.Player.CGUI", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Öffne die default GUI <gray>(<yellow>[gui]<gray>)<yellow>.'><click:suggest_command:'/commandgui'><aqua>/commandgui <dark_gray>| <aqua>/cgui</click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Open the default GUI <gray>(<yellow>[gui]<gray>)<yellow>.'><click:suggest_command:'/commandgui'><aqua>/commandgui <dark_gray>| <aqua>/cgui</click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerHelpHelp("Help.Player.Help", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Öffne die GUI: <gold>[guiname]<yellow>.'><click:suggest_command:'/commandgui'><aqua>/commandgui [gui]</click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Open the GUI: <gold>[guiname]<yellow>.'><click:suggest_command:'/commandgui'><aqua>/commandgui [gui]</click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerHelpInfo("Help.Player.Info", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Öffne diese help.'><click:suggest_command:'/commandguihelp'><aqua>/commandguihelp</click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Open this help.'><click:suggest_command:'/commandguihelp'><aqua>/commandguihelp</click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerHelpOpen("Help.Player.Open", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Rufe die Infos von <dark_red>Command<blue>GUI <yellow>auf.'><click:suggest_command:'/commandgui admin info'><aqua>/commandgui admin info</click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Call the info from <dark_red>Command<blue>GUI <yellow>'><click:suggest_command:'/commandgui admin info'><aqua>/commandgui admin info</click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerHelpGive("Help.Player.Give", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Gebe einem Spieler das GUI-Item.'><click:suggest_command:'/commandgui admin give'><aqua>/commandgui admin give <gray><player></click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Give a player the GUI item.'><click:suggest_command:'/commandgui admin give'><aqua>/commandgui admin give <gray><player></click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerHelpCreateDefaultGUI("Help.Player.CreateDefaultGUI", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Lasse eine default GUI erstellen <gray>([directory])<yellow>.'><click:suggest_command:'/commandgui admin createdefaultgui'><aqua>/commandgui admin createdefaultgui</click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Create a default GUI <gray>([directory])<yellow>.'><click:suggest_command:'/commandgui admin createdefaultgui'><aqua>/commandgui admin createdefaultgui</click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerHelpReload("Help.Player.Reload", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Lade das Plugin neu.'><click:suggest_command:'/commandgui admin reload'><aqua>/commandgui admin reload</click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Reload the plugin.'><click:suggest_command:'/commandgui admin reload'><aqua>/commandgui admin reload</click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerGUIItemHelp_on("Help.Player.UseItem_On", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Aktiviere für dich das GUIItem.'><click:suggest_command:'/gui-item on'><aqua>/gui-item on</click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Activate the GUIItem for you.'><click:suggest_command:'/gui-item on'><aqua>/gui-item on</click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerGUIItemHelp_off("Help.Player.UseItem_Off", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Deaktiviere für dich das GUIItem.'><click:suggest_command:'/gui-item off'><aqua>/gui-item off</click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Disable the GUIItem for yourself.'><click:suggest_command:'/gui-item off'><aqua>/gui-item off</click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
|
|
||||||
PlayerGUIItemHelp_Slot("Help.Player.UseItem_Slot", null,
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of("<hover:show_text:'<yellow>Stelle den Slot ein, auf den du das GUIItem haben möchtest.'><click:suggest_command:'/gui-item slot'><aqua>/gui-item slot <gray><slot></click></hover>"));
|
|
||||||
put(T2C_LanguageEnum.english, List.of("<hover:show_text:'<yellow>Set the slot where you want to have the GUIItem.'><click:suggest_command:'/gui-item slot'><aqua>/gui-item slot <gray><slot></click></hover>"));
|
|
||||||
}},
|
|
||||||
new HashMap<>() {{
|
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
|
||||||
put(T2C_LanguageEnum.english, List.of());
|
|
||||||
}}),
|
|
||||||
;
|
|
||||||
|
|
||||||
private final String path;
|
|
||||||
private Object value;
|
|
||||||
private final HashMap<T2C_LanguageEnum, List<String>> lang;
|
|
||||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
|
||||||
|
|
||||||
VALUES(String path, Object value, HashMap<T2C_LanguageEnum, List<String>> lang, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
|
||||||
this.path = path;
|
|
||||||
this.value = value;
|
|
||||||
this.lang = lang;
|
|
||||||
this.comments = comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getValue() {
|
|
||||||
if (value == null) {
|
|
||||||
return lang.get(T2C_LanguageEnum.english);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashMap<T2C_LanguageEnum, List<String>> getLanguage() {
|
|
||||||
return lang;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
|
||||||
return comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setValue(Object newValue) {
|
|
||||||
value = T2C_Replace.replace(Config.VALUES.prefix.getValue().toString(), newValue.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set(boolean isReload) {
|
|
||||||
T2C_LanguageWriter.createConfig(Util.getPrefix(), Main.getPath(), VALUES.values(), Config.VALUES.language.getValue().toString(), isReload, Util.getConfigLogo());
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,282 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.languages;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class LanguagesCreate {
|
||||||
|
private static Plugin plugin = Main.getPlugin();
|
||||||
|
|
||||||
|
public static void langCreate() {
|
||||||
|
T2Csend.debug(plugin, "§4Language files are created / updated...");
|
||||||
|
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ENGLISH
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
File messagesEN = new File(Main.getPath(), "languages/english_messages.yml");
|
||||||
|
YamlConfiguration yamlConfigurationEN = YamlConfiguration.loadConfiguration(messagesEN);
|
||||||
|
|
||||||
|
set("Plugin.VaultNotSetUp", MSG.EN_VaultNotSetUp, yamlConfigurationEN);
|
||||||
|
set("Plugin.SoundNotFound", MSG.EN_SoundNotFound, yamlConfigurationEN);
|
||||||
|
set("Plugin.OnlyForPlayer", MSG.EN_OnlyForPlayer, yamlConfigurationEN);
|
||||||
|
set("Plugin.DefaultGUI.create", MSG.EN_DefaultGUI, yamlConfigurationEN);
|
||||||
|
set("Plugin.Reload.Start", MSG.EN_ReloadStart, yamlConfigurationEN);
|
||||||
|
set("Plugin.Reload.End", MSG.EN_ReloadEnd, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("NoPermission.ForCommandGUI", MSG.EN_NoPermission, yamlConfigurationEN);
|
||||||
|
set("NoPermission.ForCommand", MSG.EN_NoPermissionForCommand, yamlConfigurationEN);
|
||||||
|
set("NoPermission.ForUseItem", MSG.EN_NoPermissionForUseItem, yamlConfigurationEN);
|
||||||
|
set("NoPermission.ForItem", MSG.EN_NoPermissionForItem, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("UseItem.UseItem_ON", MSG.EN_ItemON, yamlConfigurationEN);
|
||||||
|
set("UseItem.UseItem_OFF", MSG.EN_ItemOFF, yamlConfigurationEN);
|
||||||
|
set("UseItem.Change_Slot", MSG.EN_ItemSlot, yamlConfigurationEN);
|
||||||
|
set("UseItem.SlotNotEmpty", MSG.EN_ItemSlotNotEmpty, yamlConfigurationEN);
|
||||||
|
set("UseItem.SlotAlreadySet", MSG.EN_ItemSlotAlreadySet, yamlConfigurationEN);
|
||||||
|
set("UseItem.ItemSlot_wrongValue", MSG.EN_ItemSlot_wrongValue, yamlConfigurationEN);
|
||||||
|
set("UseItem.DisabledInGameMode", MSG.EN_UseItemDisabledInGameMode, yamlConfigurationEN);
|
||||||
|
set("UseItem.DisabledInWorld", MSG.EN_UseItemDisabledInWorld, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("Cost.Buy_msg", MSG.EN_Buy_msg, yamlConfigurationEN);
|
||||||
|
set("Cost.No.Money", MSG.EN_No_money, yamlConfigurationEN);
|
||||||
|
set("Cost.No.Item", MSG.EN_No_moneyItem, yamlConfigurationEN);
|
||||||
|
set("Cost.No.Vote", MSG.EN_No_moneyVote, yamlConfigurationEN);
|
||||||
|
set("Cost.NoInventorySpace", MSG.EN_NoInventorySpace, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("ServerChange.onServerChange", MSG.EN_onServerChange, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("GUI.GUInotFound", MSG.EN_GUInotFound, yamlConfigurationEN);
|
||||||
|
set("GUI.GUIisDisabled", MSG.EN_GUIisDisabled, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("Give.Sender", MSG.EN_GiveSender, yamlConfigurationEN);
|
||||||
|
set("Give.Receiver", MSG.EN_GiveReceiver, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("Player.PlayerNotFond", MSG.EN_PlayerNotFond, yamlConfigurationEN);
|
||||||
|
set("Player.PlayerNoInventorySpace", MSG.EN_PlayerNoInventorySpace, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("FunctionItem.Add", MSG.EN_FunctionItemAdd, yamlConfigurationEN);
|
||||||
|
set("FunctionItem.Remove", MSG.EN_FunctionItemRemove, yamlConfigurationEN);
|
||||||
|
set("FunctionItem.RemoveError", MSG.EN_FunctionItemRemoveError, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("FunctionVote.Add", MSG.EN_FunctionVoteAdd, yamlConfigurationEN);
|
||||||
|
set("FunctionVote.Remove", MSG.EN_FunctionVoteRemove, yamlConfigurationEN);
|
||||||
|
set("FunctionVote.RemoveError", MSG.EN_FunctionVoteRemoveError, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("Help.CGUI", MSG.EN_Help_CGUI, yamlConfigurationEN);
|
||||||
|
set("Help.Help", MSG.EN_Help_Help, yamlConfigurationEN);
|
||||||
|
set("Help.Info", MSG.EN_Help_Info, yamlConfigurationEN);
|
||||||
|
set("Help.Open", MSG.EN_Help_Open, yamlConfigurationEN);
|
||||||
|
set("Help.Give", MSG.EN_Help_Give, yamlConfigurationEN);
|
||||||
|
set("Help.CreateDefaultGUI", MSG.EN_Help_CreateDefaultGUI, yamlConfigurationEN);
|
||||||
|
set("Help.Reload", MSG.EN_Help_Reload, yamlConfigurationEN);
|
||||||
|
set("Help.UseItem_On", MSG.EN_GUIItemHelp_on, yamlConfigurationEN);
|
||||||
|
set("Help.UseItem_Off", MSG.EN_GUIItemHelp_off, yamlConfigurationEN);
|
||||||
|
set("Help.UseItem_Slot", MSG.EN_GUIItemHelp_Slot, yamlConfigurationEN);
|
||||||
|
|
||||||
|
set("Help.Player.CGUI", MSG.EN_PlayerHelp_CGUI, yamlConfigurationEN);
|
||||||
|
set("Help.Player.Help", MSG.EN_PlayerHelp_Help, yamlConfigurationEN);
|
||||||
|
set("Help.Player.Info", MSG.EN_PlayerHelp_Info, yamlConfigurationEN);
|
||||||
|
set("Help.Player.Open", MSG.EN_PlayerHelp_Open, yamlConfigurationEN);
|
||||||
|
set("Help.Player.Give", MSG.EN_PlayerHelp_Give, yamlConfigurationEN);
|
||||||
|
set("Help.Player.CreateDefaultGUI", MSG.EN_PlayerHelp_CreateDefaultGUI, yamlConfigurationEN);
|
||||||
|
set("Help.Player.Reload", MSG.EN_PlayerHelp_Reload, yamlConfigurationEN);
|
||||||
|
set("Help.Player.UseItem_On", MSG.EN_GUIItemPlayerHelp_on, yamlConfigurationEN);
|
||||||
|
set("Help.Player.UseItem_Off", MSG.EN_GUIItemPlayerHelp_off, yamlConfigurationEN);
|
||||||
|
set("Help.Player.UseItem_Slot", MSG.EN_GUIItemPlayerHelp_Slot, yamlConfigurationEN);
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfigurationEN.save(messagesEN);
|
||||||
|
} catch (IOException e) {
|
||||||
|
T2Csend.warning(plugin, e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* GERMAN
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
File messagesDE = new File(Main.getPath(), "languages/german_messages.yml");
|
||||||
|
YamlConfiguration yamlConfigurationDE = YamlConfiguration.loadConfiguration(messagesDE);
|
||||||
|
|
||||||
|
set("Plugin.VaultNotSetUp", MSG.DE_VaultNotSetUp, yamlConfigurationDE);
|
||||||
|
set("Plugin.SoundNotFound", MSG.DE_SoundNotFound, yamlConfigurationDE);
|
||||||
|
set("Plugin.OnlyForPlayer", MSG.DE_OnlyForPlayer, yamlConfigurationDE);
|
||||||
|
set("Plugin.DefaultGUI.create", MSG.DE_DefaultGUI, yamlConfigurationDE);
|
||||||
|
set("Plugin.Reload.Start", MSG.DE_ReloadStart, yamlConfigurationDE);
|
||||||
|
set("Plugin.Reload.End", MSG.DE_ReloadEnd, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("NoPermission.ForCommandGUI", MSG.DE_NoPermission, yamlConfigurationDE);
|
||||||
|
set("NoPermission.ForCommand", MSG.DE_NoPermissionForCommand, yamlConfigurationDE);
|
||||||
|
set("NoPermission.ForUseItem", MSG.DE_NoPermissionForUseItem, yamlConfigurationDE);
|
||||||
|
set("NoPermission.ForItem", MSG.DE_NoPermissionForItem, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("UseItem.UseItem_ON", MSG.DE_ItemON, yamlConfigurationDE);
|
||||||
|
set("UseItem.UseItem_OFF", MSG.DE_ItemOFF, yamlConfigurationDE);
|
||||||
|
set("UseItem.Change_Slot", MSG.DE_ItemSlot, yamlConfigurationDE);
|
||||||
|
set("UseItem.SlotNotEmpty", MSG.DE_ItemSlotNotEmpty, yamlConfigurationDE);
|
||||||
|
set("UseItem.SlotAlreadySet", MSG.DE_ItemSlotAlreadySet, yamlConfigurationDE);
|
||||||
|
set("UseItem.ItemSlot_wrongValue", MSG.DE_ItemSlot_wrongValue, yamlConfigurationDE);
|
||||||
|
set("UseItem.DisabledInGameMode", MSG.DE_UseItemDisabledInGameMode, yamlConfigurationDE);
|
||||||
|
set("UseItem.DisabledInWorld", MSG.DE_UseItemDisabledInWorld, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("Cost.Buy_msg", MSG.DE_Buy_msg, yamlConfigurationDE);
|
||||||
|
set("Cost.No.Money", MSG.DE_No_money, yamlConfigurationDE);
|
||||||
|
set("Cost.No.Item", MSG.DE_No_moneyItem, yamlConfigurationDE);
|
||||||
|
set("Cost.No.Vote", MSG.DE_No_moneyVote, yamlConfigurationDE);
|
||||||
|
set("Cost.NoInventorySpace", MSG.DE_NoInventorySpace, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("ServerChange.onServerChange", MSG.DE_onServerChange, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("GUI.GUInotFound", MSG.DE_GUInotFound, yamlConfigurationDE);
|
||||||
|
set("GUI.GUIisDisabled", MSG.DE_GUIisDisabled, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("Give.Sender", MSG.DE_GiveSender, yamlConfigurationDE);
|
||||||
|
set("Give.Receiver", MSG.DE_GiveReceiver, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("Player.PlayerNotFond", MSG.DE_PlayerNotFond, yamlConfigurationDE);
|
||||||
|
set("Player.PlayerNoInventorySpace", MSG.DE_PlayerNoInventorySpace, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("FunctionItem.Add", MSG.DE_FunctionItemAdd, yamlConfigurationDE);
|
||||||
|
set("FunctionItem.Remove", MSG.DE_FunctionItemRemove, yamlConfigurationDE);
|
||||||
|
set("FunctionItem.RemoveError", MSG.DE_FunctionItemRemoveError, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("FunctionVote.Add", MSG.DE_FunctionVoteAdd, yamlConfigurationDE);
|
||||||
|
set("FunctionVote.Remove", MSG.DE_FunctionVoteRemove, yamlConfigurationDE);
|
||||||
|
set("FunctionVote.RemoveError", MSG.DE_FunctionVoteRemoveError, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("Help.CGUI", MSG.DE_Help_CGUI, yamlConfigurationDE);
|
||||||
|
set("Help.Help", MSG.DE_Help_Help, yamlConfigurationDE);
|
||||||
|
set("Help.Info", MSG.DE_Help_Info, yamlConfigurationDE);
|
||||||
|
set("Help.Open", MSG.DE_Help_Open, yamlConfigurationDE);
|
||||||
|
set("Help.Give", MSG.DE_Help_Give, yamlConfigurationDE);
|
||||||
|
set("Help.CreateDefaultGUI", MSG.DE_Help_CreateDefaultGUI, yamlConfigurationDE);
|
||||||
|
set("Help.Reload", MSG.DE_Help_Reload, yamlConfigurationDE);
|
||||||
|
set("Help.UseItem_On", MSG.DE_GUIItemHelp_on, yamlConfigurationDE);
|
||||||
|
set("Help.UseItem_Off", MSG.DE_GUIItemHelp_off, yamlConfigurationDE);
|
||||||
|
set("Help.UseItem_Slot", MSG.DE_GUIItemHelp_Slot, yamlConfigurationDE);
|
||||||
|
|
||||||
|
set("Help.Player.CGUI", MSG.DE_PlayerHelp_CGUI, yamlConfigurationDE);
|
||||||
|
set("Help.Player.Help", MSG.DE_PlayerHelp_Help, yamlConfigurationDE);
|
||||||
|
set("Help.Player.Info", MSG.DE_PlayerHelp_Info, yamlConfigurationDE);
|
||||||
|
set("Help.Player.Open", MSG.DE_PlayerHelp_Open, yamlConfigurationDE);
|
||||||
|
set("Help.Player.Give", MSG.DE_PlayerHelp_Give, yamlConfigurationDE);
|
||||||
|
set("Help.Player.CreateDefaultGUI", MSG.DE_PlayerHelp_CreateDefaultGUI, yamlConfigurationDE);
|
||||||
|
set("Help.Player.Reload", MSG.DE_PlayerHelp_Reload, yamlConfigurationDE);
|
||||||
|
set("Help.Player.UseItem_On", MSG.DE_GUIItemPlayerHelp_on, yamlConfigurationDE);
|
||||||
|
set("Help.Player.UseItem_Off", MSG.DE_GUIItemPlayerHelp_off, yamlConfigurationDE);
|
||||||
|
set("Help.Player.UseItem_Slot", MSG.DE_GUIItemPlayerHelp_Slot, yamlConfigurationDE);
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfigurationDE.save(messagesDE);
|
||||||
|
} catch (IOException e) {
|
||||||
|
T2Csend.warning(plugin, e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* norwegian
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
File messagesNO = new File(Main.getPath(), "languages/norwegian_messages.yml");
|
||||||
|
YamlConfiguration yamlConfigurationNO = YamlConfiguration.loadConfiguration(messagesNO);
|
||||||
|
|
||||||
|
set("Plugin.VaultNotSetUp", MSG.NO_VaultNotSetUp, yamlConfigurationNO);
|
||||||
|
set("Plugin.SoundNotFound", MSG.NO_SoundNotFound, yamlConfigurationNO);
|
||||||
|
set("Plugin.OnlyForPlayer", MSG.NO_OnlyForPlayer, yamlConfigurationNO);
|
||||||
|
set("Plugin.DefaultGUI.create", MSG.NO_DefaultGUI, yamlConfigurationNO);
|
||||||
|
set("Plugin.Reload.Start", MSG.NO_ReloadStart, yamlConfigurationNO);
|
||||||
|
set("Plugin.Reload.End", MSG.NO_ReloadEnd, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("NoPermission.ForCommandGUI", MSG.NO_NoPermission, yamlConfigurationNO);
|
||||||
|
set("NoPermission.ForCommand", MSG.NO_NoPermissionForCommand, yamlConfigurationNO);
|
||||||
|
set("NoPermission.ForUseItem", MSG.NO_NoPermissionForUseItem, yamlConfigurationNO);
|
||||||
|
set("NoPermission.ForItem", MSG.NO_NoPermissionForItem, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("UseItem.UseItem_ON", MSG.NO_ItemON, yamlConfigurationNO);
|
||||||
|
set("UseItem.UseItem_OFF", MSG.NO_ItemOFF, yamlConfigurationNO);
|
||||||
|
set("UseItem.Change_Slot", MSG.NO_ItemSlot, yamlConfigurationNO);
|
||||||
|
set("UseItem.SlotNotEmpty", MSG.NO_ItemSlotNotEmpty, yamlConfigurationNO);
|
||||||
|
set("UseItem.SlotAlreadySet", MSG.NO_ItemSlotAlreadySet, yamlConfigurationNO);
|
||||||
|
set("UseItem.ItemSlot_wrongValue", MSG.NO_ItemSlot_wrongValue, yamlConfigurationNO);
|
||||||
|
set("UseItem.DisabledInGameMode", MSG.NO_UseItemDisabledInGameMode, yamlConfigurationNO);
|
||||||
|
set("UseItem.DisabledInWorld", MSG.NO_UseItemDisabledInWorld, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("Cost.Buy_msg", MSG.NO_Buy_msg, yamlConfigurationNO);
|
||||||
|
set("Cost.No.Money", MSG.NO_No_money, yamlConfigurationNO);
|
||||||
|
set("Cost.No.Item", MSG.NO_No_moneyItem, yamlConfigurationNO);
|
||||||
|
set("Cost.No.Vote", MSG.NO_No_moneyVote, yamlConfigurationNO);
|
||||||
|
set("Cost.NoInventorySpace", MSG.NO_NoInventorySpace, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("ServerChange.onServerChange", MSG.NO_onServerChange, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("GUI.GUInotFound", MSG.NO_GUInotFound, yamlConfigurationNO);
|
||||||
|
set("GUI.GUIisDisabled", MSG.NO_GUIisDisabled, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("Give.Sender", MSG.NO_GiveSender, yamlConfigurationNO);
|
||||||
|
set("Give.Receiver", MSG.NO_GiveReceiver, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("Player.PlayerNotFond", MSG.NO_PlayerNotFond, yamlConfigurationNO);
|
||||||
|
set("Player.PlayerNoInventorySpace", MSG.NO_PlayerNoInventorySpace, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("FunctionItem.Add", MSG.NO_FunctionItemAdd, yamlConfigurationNO);
|
||||||
|
set("FunctionItem.Remove", MSG.NO_FunctionItemRemove, yamlConfigurationNO);
|
||||||
|
set("FunctionItem.RemoveError", MSG.NO_FunctionItemRemoveError, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("FunctionVote.Add", MSG.NO_FunctionVoteAdd, yamlConfigurationNO);
|
||||||
|
set("FunctionVote.Remove", MSG.NO_FunctionVoteRemove, yamlConfigurationNO);
|
||||||
|
set("FunctionVote.RemoveError", MSG.NO_FunctionVoteRemoveError, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("Help.CGUI", MSG.NO_Help_CGUI, yamlConfigurationNO);
|
||||||
|
set("Help.Help", MSG.NO_Help_Help, yamlConfigurationNO);
|
||||||
|
set("Help.Info", MSG.NO_Help_Info, yamlConfigurationNO);
|
||||||
|
set("Help.Open", MSG.NO_Help_Open, yamlConfigurationNO);
|
||||||
|
set("Help.Give", MSG.NO_Help_Give, yamlConfigurationNO);
|
||||||
|
set("Help.CreateDefaultGUI", MSG.NO_Help_CreateDefaultGUI, yamlConfigurationNO);
|
||||||
|
set("Help.Reload", MSG.NO_Help_Reload, yamlConfigurationNO);
|
||||||
|
set("Help.UseItem_On", MSG.NO_GUIItemHelp_on, yamlConfigurationNO);
|
||||||
|
set("Help.UseItem_Off", MSG.NO_GUIItemHelp_off, yamlConfigurationNO);
|
||||||
|
set("Help.UseItem_Slot", MSG.NO_GUIItemHelp_Slot, yamlConfigurationNO);
|
||||||
|
|
||||||
|
set("Help.Player.CGUI", MSG.NO_PlayerHelp_CGUI, yamlConfigurationNO);
|
||||||
|
set("Help.Player.Help", MSG.NO_PlayerHelp_Help, yamlConfigurationNO);
|
||||||
|
set("Help.Player.Info", MSG.NO_PlayerHelp_Info, yamlConfigurationNO);
|
||||||
|
set("Help.Player.Open", MSG.NO_PlayerHelp_Open, yamlConfigurationNO);
|
||||||
|
set("Help.Player.Give", MSG.NO_PlayerHelp_Give, yamlConfigurationNO);
|
||||||
|
set("Help.Player.CreateDefaultGUI", MSG.NO_PlayerHelp_CreateDefaultGUI, yamlConfigurationNO);
|
||||||
|
set("Help.Player.Reload", MSG.NO_PlayerHelp_Reload, yamlConfigurationNO);
|
||||||
|
set("Help.Player.UseItem_On", MSG.NO_GUIItemPlayerHelp_on, yamlConfigurationNO);
|
||||||
|
set("Help.Player.UseItem_Off", MSG.NO_GUIItemPlayerHelp_off, yamlConfigurationNO);
|
||||||
|
set("Help.Player.UseItem_Slot", MSG.NO_GUIItemPlayerHelp_Slot, yamlConfigurationNO);
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfigurationNO.save(messagesNO);
|
||||||
|
} catch (IOException e) {
|
||||||
|
T2Csend.warning(plugin, e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
T2Csend.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, String value, YamlConfiguration config) {
|
||||||
|
if (!config.contains(path)) {
|
||||||
|
config.set(path, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,233 @@
|
|||||||
|
// This claas was created by JaTiTV
|
||||||
|
|
||||||
|
// -----------------------------
|
||||||
|
// _____ _____ _ _ _____
|
||||||
|
// / ____/ ____| | | |_ _|
|
||||||
|
// | | | | __| | | | | |
|
||||||
|
// | | | | |_ | | | | | |
|
||||||
|
// | |___| |__| | |__| |_| |_
|
||||||
|
// \_____\_____|\____/|_____|
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
package net.t2code.commandguiv2.Spigot.config.languages;
|
||||||
|
|
||||||
|
public class MSG {
|
||||||
|
|
||||||
|
// EN
|
||||||
|
public static String EN_VaultNotSetUp = "[prefix] &4Vault / Economy not set up!";
|
||||||
|
public static String EN_SoundNotFound = "[prefix] &4The sound &6[sound] &4was not found! Please check the settings.";
|
||||||
|
public static String EN_OnlyForPlayer = "[prefix] &cThis command is for players only!";
|
||||||
|
public static String EN_DefaultGUI = "[prefix] &2DefaultGUI was created. You can find it in the directory: &e[directory]&2!";
|
||||||
|
public static String EN_ReloadStart = "[prefix] &6Plugin is reloaded...";
|
||||||
|
public static String EN_ReloadEnd = "[prefix] &2Plugin was successfully reloaded.";
|
||||||
|
|
||||||
|
public static String EN_NoPermission = "[prefix] &cYou do not have permission for &4Command&9GUI&c!";
|
||||||
|
public static String EN_NoPermissionForCommand = "[prefix] &cFor &b[cmd] &cyou lack the permission &6[perm]&c!";
|
||||||
|
public static String EN_NoPermissionForUseItem = "[prefix] &cYou lack the permission &6[perm] &cto use the item for the GUI: &6[gui].";
|
||||||
|
public static String EN_NoPermissionForItem = "[prefix] &cFor &b[item] &cyou lack the permission &6[perm]&c!";
|
||||||
|
|
||||||
|
public static String EN_Buy_msg = "[prefix] &2You bought [itemname] &2for &6[price]&2.";
|
||||||
|
public static String EN_No_money = "[prefix] &cYou don't have enough money!/*/&cYou need: &6[price]&c.";
|
||||||
|
public static String EN_No_moneyItem = "[prefix] &cYou don't have enough items of &6[item] &cin your inventory!/*/&cYou need: &6[amount]&c.";
|
||||||
|
public static String EN_No_moneyVote = "[prefix] &cYou do not have enough vote points!/*/&cYou need: &6[amount]&c.";
|
||||||
|
public static String EN_NoInventorySpace = "[prefix] &cYou have no room in your inventory!";
|
||||||
|
|
||||||
|
public static String EN_onServerChange = "[prefix] &2You will be connected to the server &e[server]§2.";
|
||||||
|
|
||||||
|
public static String EN_ItemON = "[prefix] &2You have activated the GUI item.";
|
||||||
|
public static String EN_ItemOFF = "[prefix] &2You have disabled the GUI item.";
|
||||||
|
public static String EN_ItemSlot = "[prefix] &2You have changed the GUI item to slot: &6[slot]&2.";
|
||||||
|
public static String EN_ItemSlotNotEmpty = "[prefix] &6The slot &e[slot] &6is currently occupied!";
|
||||||
|
public static String EN_ItemSlotAlreadySet = "[prefix] &6The slot §e[slot] §6is already set!";
|
||||||
|
public static String EN_ItemSlot_wrongValue = "[prefix] &cThe specified slot must be between 1 and 9!";
|
||||||
|
public static String EN_UseItemDisabledInGameMode = "[prefix] &cThe UseItem is disabled in this GameMode!";
|
||||||
|
public static String EN_UseItemDisabledInWorld = "[prefix] &cThe UseItem is disabled in this World!";
|
||||||
|
|
||||||
|
public static String EN_GUInotFound = "[prefix] &cThe GUI chosen by the does not exist.";
|
||||||
|
public static String EN_GUIisDisabled = "[prefix] &cThe GUI [gui] &cis currently Disabled!";
|
||||||
|
|
||||||
|
public static String EN_GiveSender = "[prefix] &2You have given &6[player] &2an [item] &2!";
|
||||||
|
public static String EN_GiveReceiver = "[prefix] &2You got &2, [item] &2from &6[sender]!";
|
||||||
|
|
||||||
|
public static String EN_PlayerNotFond = "[prefix] &cThe player &6[player] &cwas not found or is not online!";
|
||||||
|
public static String EN_PlayerNoInventorySpace = "[prefix] &6[player] &chas no free space in his inventory!";
|
||||||
|
|
||||||
|
public static String EN_FunctionItemAdd = "[prefix] &2You have &6[amount] [item] &2placed in your inventory.";
|
||||||
|
public static String EN_FunctionItemRemove = "[prefix] &2You have been &6[amount] [item] &2removed.";
|
||||||
|
public static String EN_FunctionItemRemoveError = "[prefix] &cYou don't have so many items!/*/&cYou need &6[amount] [item]&c!";
|
||||||
|
|
||||||
|
public static String EN_FunctionVoteAdd = "[prefix] &2You were given &6[amount] &2Vote points.";
|
||||||
|
public static String EN_FunctionVoteRemove = "[prefix] &2You have been removed &6[amount] &2Vote points.";
|
||||||
|
public static String EN_FunctionVoteRemoveError = "[prefix] &cYou don't have so many VotePoints!/*/&cYou need &6[amount]&c!";
|
||||||
|
|
||||||
|
public static String EN_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &eOpen the default GUI &7(&r[gui]&7)&e.";
|
||||||
|
public static String EN_Help_Open = "&8''&b/commandgui [gui]&8'' &eOpen the GUI: &6[guiname]&e.";
|
||||||
|
public static String EN_Help_Help = "&8''&b/commandguihelp&8'' &eOpen this help.";
|
||||||
|
public static String EN_Help_Info = "&8''&b/commandgui admin info&8'' &eCall the info from &4Command&9GUI &e.";
|
||||||
|
public static String EN_Help_Give = "&8''&b/commandgui admin give &7<player>&8'' &eGive a player the GUI item.";
|
||||||
|
public static String EN_Help_CreateDefaultGUI = "&8''&b/commandgui admin createdefaultgui&8'' &eCreate a default GUI &7([directory])&e.";
|
||||||
|
public static String EN_Help_Reload = "&8''&b/commandgui admin reload&8'' &eReload the plugin.";
|
||||||
|
|
||||||
|
public static String EN_GUIItemHelp_on = "&8''&b/gui-item on&8'' &eActivate the GUIItem for you.";
|
||||||
|
public static String EN_GUIItemHelp_off = "&8''&b/gui-item off&8'' &eDisable the GUIItem for yourself.";
|
||||||
|
public static String EN_GUIItemHelp_Slot = "&8''&b/gui-item slot &7<slot>&8'' &eSet the slot where you want to have the GUIItem.";
|
||||||
|
public static String EN_PlayerHelp_CGUI = "&b/commandgui &8| &b/cgui/*/&eOpen the default GUI &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui";
|
||||||
|
public static String EN_PlayerHelp_Open = "&b/commandgui [gui]/*/&eOpen the GUI: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui ";
|
||||||
|
public static String EN_PlayerHelp_Help = "&b/commandguihelp/*/&eOpen this help./*/SUGGEST_COMMAND/*//commandguihelp";
|
||||||
|
public static String EN_PlayerHelp_Info = "&b/commandgui admin info/*/&eCall the info from &4Command&9GUI &e./*/SUGGEST_COMMAND/*//commandgui admin info";
|
||||||
|
public static String EN_PlayerHelp_Give = "&b/commandgui admin give &7<player>/*/&eGive a player the GUI item./*/SUGGEST_COMMAND/*//commandgui admin give ";
|
||||||
|
public static String EN_PlayerHelp_CreateDefaultGUI = "&b/commandgui admin createdefaultgui/*/&eCreate a default GUI &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui";
|
||||||
|
public static String EN_PlayerHelp_Reload = "&b/commandgui admin reload/*/&eReload the plugin./*/SUGGEST_COMMAND/*//commandgui admin reload";
|
||||||
|
|
||||||
|
public static String EN_GUIItemPlayerHelp_on = "&b/gui-item on/*/&eActivate the GUIItem for you./*/SUGGEST_COMMAND/*//gui-item on";
|
||||||
|
public static String EN_GUIItemPlayerHelp_off = "&b/gui-item off/*/&eDisable the GUIItem for yourself./*/SUGGEST_COMMAND/*//gui-item off";
|
||||||
|
public static String EN_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eSet the slot where you want to have the GUIItem./*/SUGGEST_COMMAND/*//gui-item slot ";
|
||||||
|
|
||||||
|
// DE
|
||||||
|
public static String DE_VaultNotSetUp = "[prefix] &4Vault / Economy nicht eingerichtet!";
|
||||||
|
public static String DE_SoundNotFound = "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte [ue]berpr[ue]fe die Einstellungen.";
|
||||||
|
public static String DE_OnlyForPlayer = "[prefix] &cDieser Command ist nur f[ue]r Spieler!";
|
||||||
|
public static String DE_DefaultGUI = "[prefix] &2DefaultGUI wurde erstellt. Du findst sie im Verzeichnis: &e[directory]&2!";
|
||||||
|
public static String DE_ReloadStart = "[prefix] &6Plugin wird neu geladen...";
|
||||||
|
public static String DE_ReloadEnd = "[prefix] &2Plugin wurde erfolgreich neu geladen.";
|
||||||
|
|
||||||
|
public static String DE_NoPermission = "[prefix] &cDu hast keine Permission f[ue]r &4Command&9GUI&c!";
|
||||||
|
public static String DE_NoPermissionForCommand = "[prefix] &cF[ue]r &b[cmd] &cfehlt dir die Permission &6[perm]&c!";
|
||||||
|
public static String DE_NoPermissionForUseItem = "[prefix] &cDir fehlt die Permission &6[perm] &cum das Item f[ue]r die GUI: &6[gui] &cnutzen zu k[oe]nnen.";
|
||||||
|
public static String DE_NoPermissionForItem = "[prefix] &cF[ue]r &b[item] &cfehlt dir die Permission &6[perm]&c!";
|
||||||
|
|
||||||
|
public static String DE_ItemON = "[prefix] &2Du hast das GUI-Item aktiviert.";
|
||||||
|
public static String DE_ItemOFF = "[prefix] &2Du hast das GUI-Item deaktiviert.";
|
||||||
|
public static String DE_ItemSlot = "[prefix] &2Du hast das GUI-Item auf Slot &6[slot] &2umgestellt.";
|
||||||
|
public static String DE_ItemSlotNotEmpty = "[prefix] &6Der Slot §e[slot] §6ist derzeit belegt!.";
|
||||||
|
public static String DE_ItemSlotAlreadySet = "[prefix] &6Der Slot §e[slot] §6ist bereits eingestellt!";
|
||||||
|
public static String DE_ItemSlot_wrongValue = "[prefix] &cDer angegebene Slot muss sich zwischen 1 und 9 befinden!";
|
||||||
|
public static String DE_UseItemDisabledInGameMode = "[prefix] &cDas UseItem ist in diesem GameMode deaktiviert!";
|
||||||
|
public static String DE_UseItemDisabledInWorld = "[prefix] &cDas UseItem ist in dieser Welt deaktiviert!";
|
||||||
|
|
||||||
|
public static String DE_Buy_msg = "[prefix] &2Du hast dir [itemname] &2f[ue]r &6[price] &2gekauft.";
|
||||||
|
public static String DE_No_money = "[prefix] &cDu hast nicht gen[ue]gend Geld!/*/&cDu ben[oe]tigst [price].";
|
||||||
|
public static String DE_No_moneyItem = "[prefix] &cDu hast nicht gen[ue]gent Items von &6[item] &cim Inventar!/*/&cDu ben[oe]tigst: &6[amount]&c.";
|
||||||
|
public static String DE_No_moneyVote = "[prefix] &cDu hast nicht gen[ue]gent Vote Punkte!/*/&cDu ben[oe]tigst: &6[amount]&c.";
|
||||||
|
public static String DE_NoInventorySpace = "[prefix] &cDu hast keinen Platz in deinem Inventar!";
|
||||||
|
|
||||||
|
public static String DE_onServerChange = "[prefix] &2Du wirst auf den Server §e[server] §2verbunden.";
|
||||||
|
|
||||||
|
public static String DE_GUInotFound = "[prefix] &cDie von die gew[ae]hlte GUI gibt es nicht.";
|
||||||
|
public static String DE_GUIisDisabled = "[prefix] &cDie GUI [gui] &cist derzeit Deaktiviert!";
|
||||||
|
|
||||||
|
public static String DE_GiveSender = "[prefix] &2Du hast &6[player] &2ein [item] &2gegeben!";
|
||||||
|
public static String DE_GiveReceiver = "[prefix] &2Du hast von &6[sender] &2, [item] &2bekommen!";
|
||||||
|
|
||||||
|
public static String DE_PlayerNotFond = "[prefix] &cDer Spieler &6[player] &cwurde nicht gefunden oder ist nicht Online!";
|
||||||
|
public static String DE_PlayerNoInventorySpace = "[prefix] &6[player] &chat keinen freien Platz in seinem Inventar!";
|
||||||
|
|
||||||
|
public static String DE_FunctionItemAdd = "[prefix] &2Dir wurden &6[amount] [item] &2in dein Inventar gelegt.";
|
||||||
|
public static String DE_FunctionItemRemove = "[prefix] &2Dir wurden &6[amount] [item] &2entfernt.";
|
||||||
|
public static String DE_FunctionItemRemoveError = "[prefix] &cDu hast nicht so viele Items!/*/&cDu benötigets &6[amount] [item]&c!";
|
||||||
|
|
||||||
|
public static String DE_FunctionVoteAdd = "[prefix] &2Dir wurden &6[amount] &2Vote Punkte gegeben.";
|
||||||
|
public static String DE_FunctionVoteRemove = "[prefix] &2Dir wurden &6[amount] &2Vote Punkte entfernt.";
|
||||||
|
public static String DE_FunctionVoteRemoveError = "[prefix] &cDu hast nicht so viele VotePunkte!/*/&cDu benötigets &6[amount]&c!";
|
||||||
|
|
||||||
|
public static String DE_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &e[OE]ffne die default GUI &7(&r[gui]&7)&e.";
|
||||||
|
public static String DE_Help_Open = "&8''&b/commandgui [gui]&8'' &e[OE]ffne die GUI: &6[guiname]&e.";
|
||||||
|
public static String DE_Help_Help = "&8''&b/commandguihelp&8'' &e[OE]ffne diese help.";
|
||||||
|
public static String DE_Help_Info = "&8''&b/commandgui admin info&8'' &eRufe die Infos von &4Command&9GUI &eauf.";
|
||||||
|
public static String DE_Help_Give = "&8''&b/commandgui admin give &7<player>&8'' &eGebe einem Spieler das GUI-Item.";
|
||||||
|
public static String DE_Help_CreateDefaultGUI = "&8''&b/commandgui admin createdefaultgui&8'' &eLasse eine default GUI erstellen &7([directory])&e.";
|
||||||
|
public static String DE_Help_Reload = "&8''&b/commandgui admin reload&8'' &eLade das Plugin neu.";
|
||||||
|
|
||||||
|
public static String DE_GUIItemHelp_on = "&8''&b/gui-item on&8'' &eAktiviere f[ue]r dich das GUIItem.";
|
||||||
|
public static String DE_GUIItemHelp_off = "&8''&b/gui-item off&8'' &eDeaktiviere f[ue]r dich das GUIItem.";
|
||||||
|
public static String DE_GUIItemHelp_Slot = "&8''&b/gui-item slot &7<slot>&8'' &eStelle den Slot ein, auf den du das GUIItem haben möchtest.";
|
||||||
|
|
||||||
|
public static String DE_PlayerHelp_CGUI = "&b/commandgui &8| &b/cgui/*/&e[OE]ffne die default GUI &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui";
|
||||||
|
public static String DE_PlayerHelp_Open = "&b/commandgui [gui]/*/&e[OE]ffne die GUI: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui ";
|
||||||
|
public static String DE_PlayerHelp_Help = "&b/commandguihelp/*/&e[OE]ffne diese help./*/SUGGEST_COMMAND/*//commandguihelp";
|
||||||
|
public static String DE_PlayerHelp_Info = "&b/commandgui admin info/*/&eRufe die Infos von &4Command&9GUI &eauf./*/SUGGEST_COMMAND/*//commandgui admin info";
|
||||||
|
public static String DE_PlayerHelp_Give = "&b/commandgui admin give &7<player>/*/&eGebe einem Spieler das GUI-Item./*/SUGGEST_COMMAND/*//commandgui admin give ";
|
||||||
|
public static String DE_PlayerHelp_CreateDefaultGUI = "&b/commandgui admin createdefaultgui/*/&eLasse eine default GUI erstellen &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui";
|
||||||
|
public static String DE_PlayerHelp_Reload = "&b/commandgui admin reload/*/&eLade das Plugin neu./*/SUGGEST_COMMAND/*//commandgui admin reload";
|
||||||
|
|
||||||
|
public static String DE_GUIItemPlayerHelp_on = "&b/gui-item on/*/&eAktiviere f[ue]r dich das GUIItem./*/SUGGEST_COMMAND/*//gui-item on";
|
||||||
|
public static String DE_GUIItemPlayerHelp_off = "&b/gui-item off/*/&eDeaktiviere f[ue]r dich das GUIItem./*/SUGGEST_COMMAND/*//gui-item off";
|
||||||
|
public static String DE_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eStelle den Slot ein, auf den du das GUIItem haben möchtest./*/SUGGEST_COMMAND/*//gui-item slot ";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// FR
|
||||||
|
|
||||||
|
|
||||||
|
// NO
|
||||||
|
public static String NO_VaultNotSetUp = "[prefix] &4Vault / Økonomi har ikke blitt satt opp!";
|
||||||
|
public static String NO_SoundNotFound = "[prefix] &4Lyden &6[sound] &4ble ikke bli funnet! Vennligst sjekk innstillingene.";
|
||||||
|
public static String NO_OnlyForPlayer = "[prefix] &cDenne kommandoen er for spillere kun!";
|
||||||
|
public static String NO_DefaultGUI = "[prefix] &2DefaultGUI har blitt laget. Du kan finne den i mappen: &e[directory]&2!";
|
||||||
|
public static String NO_ReloadStart = "[prefix] &6Pluginet blir relastet...";
|
||||||
|
public static String NO_ReloadEnd = "[prefix] &2Pluginet har blitt lastet inn på nytt.";
|
||||||
|
|
||||||
|
public static String NO_NoPermission = "[prefix] &cDu har ikke tilgang til &4Command&9GUI&c!";
|
||||||
|
public static String NO_NoPermissionForCommand = "[prefix] &cFor &b[cmd] &cmangler du tillatelsen &6[perm]&c!";
|
||||||
|
public static String NO_NoPermissionForUseItem = "[prefix] &cDu mangler tillatelsen &6[perm] &cfor å bruke gjenstanden i GUI: &6[gui].";
|
||||||
|
public static String NO_NoPermissionForItem = "[prefix] &cFor &b[item] &cmangler du tillatelsen &6[perm]&c!";
|
||||||
|
|
||||||
|
public static String NO_ItemON = "[prefix] &2You have activated the GUI item.";
|
||||||
|
public static String NO_ItemOFF = "[prefix] &2You have disabled the GUI item.";
|
||||||
|
public static String NO_ItemSlot = "[prefix] &2You have changed the GUI item to slot: &6[slot]&2.";
|
||||||
|
public static String NO_ItemSlotNotEmpty = "[prefix] &6Plassen &e[slot] &6er opptatt for øyeblikket!";
|
||||||
|
public static String NO_ItemSlotAlreadySet = "[prefix] &6Plassen §e[slot] §6er allerede satt!";
|
||||||
|
public static String NO_ItemSlot_wrongValue = "[prefix] &cDen spesifiserte plassen må være mellom 1 og 9!";
|
||||||
|
public static String NO_UseItemDisabledInGameMode = "[prefix] &cBrukselementet er deaktivert i denne spillmodusen!!";
|
||||||
|
public static String NO_UseItemDisabledInWorld = "[prefix] &cUseItem er deaktivert i denne verden!";
|
||||||
|
|
||||||
|
public static String NO_Buy_msg = "[prefix] &2Du kjøpte [itemname] &2for &6[price]&2.";
|
||||||
|
public static String NO_No_money = "[prefix] &cDu har ikke nok penger!/*/&cDu trenger &6[price]&c.";
|
||||||
|
public static String NO_No_moneyItem = "[prefix] &cDu har ikke nok varer av &6[item] &ci inventaret ditt!/*/&cDu trenger: &6[amount]&c.";
|
||||||
|
public static String NO_No_moneyVote = "[prefix] &cDu har ikke nok stemmepoeng!/*/&cDu trenger: &6[amount]&c.";
|
||||||
|
public static String NO_NoInventorySpace = "[prefix] &cDu har ikke nok plass i inventaret ditt!";
|
||||||
|
|
||||||
|
public static String NO_onServerChange = "[prefix] &2Du vil bli tilkoblet serveren &e[server]&2.";
|
||||||
|
|
||||||
|
public static String NO_GUInotFound = "[prefix] &cGUIen som ble spesifisert finnes ikke.";
|
||||||
|
public static String NO_GUIisDisabled = "[prefix] &cGUIen [gui] &cer slått av for øyeblikket!";
|
||||||
|
|
||||||
|
public static String NO_GiveSender = "[prefix] &2Du har gitt &6[player] &2en [item]&2!";
|
||||||
|
public static String NO_GiveReceiver = "[prefix] &2Du fikk &2, [item] &2fra &6[sender]!";
|
||||||
|
|
||||||
|
public static String NO_PlayerNotFond = "[prefix] &cSpilleren &6[player] &cble ikke funnet eller er ikke pålogget!";
|
||||||
|
public static String NO_PlayerNoInventorySpace = "[prefix] &6[player] &char ikke nok plass i inventaret sitt!";
|
||||||
|
|
||||||
|
public static String NO_FunctionItemAdd = "[prefix] &2Du har &6[amount] [item] &2plassert i beholdningen din.";
|
||||||
|
public static String NO_FunctionItemRemove = "[prefix] &2Du har blitt &6[amount] [item] &2fjernet.";
|
||||||
|
public static String NO_FunctionItemRemoveError = "[prefix] &cDu har ikke så mange varer!/*/&cDu trenger &6[amount] [item]&c!";
|
||||||
|
|
||||||
|
public static String NO_FunctionVoteAdd = "[prefix] &2Du fikk &6[amount] &2stemmepoeng.";
|
||||||
|
public static String NO_FunctionVoteRemove = "[prefix] &2Du har blitt fjernet &6[amount] &2Stemmepoeng.";
|
||||||
|
public static String NO_FunctionVoteRemoveError = "[prefix] &cDu har ikke så mange stemmepoeng!/*/&cDu trenger &6[amount]&c!";
|
||||||
|
|
||||||
|
public static String NO_Help_CGUI = "&8''&b/commandgui &8| &b/cgui&8'' &eÅpne default GUIen &7(&r[gui]&7)&e.";
|
||||||
|
public static String NO_Help_Open = "&8''&b/commandgui [gui]&8'' &eÅpne GUIen: &6[guiname]&e.";
|
||||||
|
public static String NO_Help_Help = "&8''&b/commandguihelp&8'' &eSender denne hjelpe meldingen.";
|
||||||
|
public static String NO_Help_Info = "&8''&b/commandgui admin info&8'' &eKall informasjon fra &4Command&9GUI&e.";
|
||||||
|
public static String NO_Help_Give = "&8''&b/commandgui admin give &7<player>&8'' &eGi en spiller GUI gjenstanden.";
|
||||||
|
public static String NO_Help_CreateDefaultGUI = "&8''&b/commandgui admin createdefaultgui&8'' &eLag en normalverdi GUI &7([directory])&e.";
|
||||||
|
public static String NO_Help_Reload = "&8''&b/commandgui admin reload&8'' &eLast inn pluginet på nytt.";
|
||||||
|
|
||||||
|
public static String NO_GUIItemHelp_on = "&8''&b/gui-item on&8'' &eAktiverer en GUI gjenstand for deg.";
|
||||||
|
public static String NO_GUIItemHelp_off = "&8''&b/gui-item off&8'' &eDeaktiverer en GUI gjenstand for deg.";
|
||||||
|
public static String NO_GUIItemHelp_Slot = "&8''&b/gui-item slot &7<slot>&8'' &eSett sporet for GUIItem for deg.";
|
||||||
|
|
||||||
|
public static String NO_PlayerHelp_CGUI = "&b/commandgui &8| &b/cgui/*/&eÅpne default GUIen &7(&r[gui]&7)&e./*/SUGGEST_COMMAND/*//commandgui";
|
||||||
|
public static String NO_PlayerHelp_Open = "&b/commandgui [gui]/*/&eÅpne GUIen: &6[guiname]&e./*/SUGGEST_COMMAND/*//commandgui ";
|
||||||
|
public static String NO_PlayerHelp_Help = "&b/commandguihelp/*/&eSender denne hjelpe meldingen./*/SUGGEST_COMMAND/*//commandguihelp";
|
||||||
|
public static String NO_PlayerHelp_Info = "&b/commandgui admin info/*/&eKall informasjon fra &4Command&9GUI&e./*/SUGGEST_COMMAND/*//commandgui admin info";
|
||||||
|
public static String NO_PlayerHelp_Give = "&b/commandgui admin give &7<player>/*/&eGi en spiller GUI gjenstanden./*/SUGGEST_COMMAND/*//commandgui admin give ";
|
||||||
|
public static String NO_PlayerHelp_CreateDefaultGUI = "&b/commandgui admin createdefaultgui/*/&eLag en normalverdi GUI &7([directory])&e./*/SUGGEST_COMMAND/*//commandgui admin createdefaultgui";
|
||||||
|
public static String NO_PlayerHelp_Reload = "&b/commandgui admin reload/*/&eLast inn pluginet på nytt./*/SUGGEST_COMMAND/*//commandgui admin reload";
|
||||||
|
|
||||||
|
public static String NO_GUIItemPlayerHelp_on = "&b/gui-item on/*/&eAktiverer en GUI gjenstand for deg./*/SUGGEST_COMMAND/*//gui-item on";
|
||||||
|
public static String NO_GUIItemPlayerHelp_off = "&b/gui-item off/*/&eDeaktiverer en GUI gjenstand for deg./*/SUGGEST_COMMAND/*//gui-item off";
|
||||||
|
public static String NO_GUIItemPlayerHelp_Slot = "&b/gui-item slot &7<slot>/*/&eSett sporet for GUIItem for deg./*/SUGGEST_COMMAND/*//gui-item slot ";
|
||||||
|
}
|
@ -0,0 +1,179 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.languages;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
|
import net.t2code.commandguiv2.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class SelectMessages {
|
||||||
|
|
||||||
|
|
||||||
|
public static String selectMSG;
|
||||||
|
|
||||||
|
public static String VaultNotSetUp;
|
||||||
|
public static String SoundNotFound;
|
||||||
|
public static String OnlyForPlayer;
|
||||||
|
public static String DefaultGUIcreate;
|
||||||
|
public static String ReloadStart;
|
||||||
|
public static String ReloadEnd;
|
||||||
|
|
||||||
|
public static String NoPermission;
|
||||||
|
public static String NoPermissionForCommand;
|
||||||
|
public static String NoPermissionForUseItem;
|
||||||
|
public static String NoPermissionForItem;
|
||||||
|
|
||||||
|
public static String ItemON;
|
||||||
|
public static String ItemOFF;
|
||||||
|
public static String ItemSlot;
|
||||||
|
public static String ItemSlotNotEmpty;
|
||||||
|
public static String ItemSlotAlreadySet;
|
||||||
|
public static String ItemSlot_wrongValue;
|
||||||
|
public static String UseItemDisabledInGameMode;
|
||||||
|
public static String UseItemDisabledInWorld;
|
||||||
|
|
||||||
|
public static String Buy_msg;
|
||||||
|
public static String noMoney;
|
||||||
|
public static String noMoneyItem;
|
||||||
|
public static String noMoneyVote;
|
||||||
|
public static String NoInventorySpace;
|
||||||
|
|
||||||
|
public static String onServerChange;
|
||||||
|
|
||||||
|
public static String guiNotFound;
|
||||||
|
public static String GUIIsDisabled;
|
||||||
|
|
||||||
|
public static String Give_Sender;
|
||||||
|
public static String Give_Receiver;
|
||||||
|
|
||||||
|
public static String PlayerNotFond;
|
||||||
|
public static String PlayerNoInventorySpace;
|
||||||
|
|
||||||
|
public static String functionItemAdd;
|
||||||
|
public static String functionItemRemove;
|
||||||
|
public static String functionItemRemoveError;
|
||||||
|
public static String functionVoteAdd;
|
||||||
|
public static String functionVoteRemove;
|
||||||
|
public static String functionVoteRemoveError;
|
||||||
|
|
||||||
|
public static String HelpCgui;
|
||||||
|
public static String HelpHelp;
|
||||||
|
public static String HelpInfo;
|
||||||
|
public static String HelpOpen;
|
||||||
|
public static String HelpGive;
|
||||||
|
public static String HelpCreateDefaultGUI;
|
||||||
|
public static String HelpReload;
|
||||||
|
public static String GUIItemHelp_on;
|
||||||
|
public static String GUIItemHelp_off;
|
||||||
|
public static String GUIItemHelp_Slot;
|
||||||
|
public static String PlayerHelpCgui;
|
||||||
|
public static String PlayerHelpHelp;
|
||||||
|
public static String PlayerHelpInfo;
|
||||||
|
public static String PlayerHelpOpen;
|
||||||
|
public static String PlayerHelpGive;
|
||||||
|
public static String PlayerHelpCreateDefaultGUI;
|
||||||
|
public static String PlayerHelpReload;
|
||||||
|
public static String PlayerGUIItemHelp_on;
|
||||||
|
public static String PlayerGUIItemHelp_off;
|
||||||
|
public static String PlayerGUIItemHelp_Slot;
|
||||||
|
|
||||||
|
public static void onSelect(String Prefix) {
|
||||||
|
T2Csend.debug(Main.getPlugin(), "§4Select language...");
|
||||||
|
long long_ = System.currentTimeMillis();
|
||||||
|
|
||||||
|
File msg;
|
||||||
|
|
||||||
|
msg = new File(Main.getPath(), "languages/" + SelectConfig.getLanguage() + "_messages.yml");
|
||||||
|
if (!msg.isFile()) {
|
||||||
|
T2Csend.console(Prefix);
|
||||||
|
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
T2Csend.console(Prefix + " §4The selected §c" + SelectConfig.getLanguage() + " §4language file was not found.");
|
||||||
|
T2Csend.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||||
|
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
T2Csend.console(Prefix);
|
||||||
|
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||||
|
selectMSG = "english";
|
||||||
|
} else selectMSG = SelectConfig.getLanguage();
|
||||||
|
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
|
||||||
|
|
||||||
|
VaultNotSetUp = select("Plugin.VaultNotSetUp", yamlConfiguration_msg);
|
||||||
|
SoundNotFound = select("Plugin.SoundNotFound", yamlConfiguration_msg);
|
||||||
|
OnlyForPlayer = select("Plugin.OnlyForPlayer", yamlConfiguration_msg);
|
||||||
|
DefaultGUIcreate = select("Plugin.DefaultGUI.create", yamlConfiguration_msg);
|
||||||
|
ReloadStart = select("Plugin.Reload.Start", yamlConfiguration_msg);
|
||||||
|
ReloadEnd = select("Plugin.Reload.End", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
NoPermission = select("NoPermission.ForCommandGUI", yamlConfiguration_msg);
|
||||||
|
NoPermissionForCommand = select("NoPermission.ForCommand", yamlConfiguration_msg);
|
||||||
|
NoPermissionForUseItem = select("NoPermission.ForUseItem", yamlConfiguration_msg);
|
||||||
|
NoPermissionForItem = select("NoPermission.ForItem", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
ItemON = select("UseItem.UseItem_ON", yamlConfiguration_msg);
|
||||||
|
ItemOFF = select("UseItem.UseItem_OFF", yamlConfiguration_msg);
|
||||||
|
ItemSlot = select("UseItem.Change_Slot", yamlConfiguration_msg);
|
||||||
|
ItemSlotNotEmpty = select("UseItem.SlotNotEmpty", yamlConfiguration_msg);
|
||||||
|
ItemSlotAlreadySet = select("UseItem.SlotAlreadySet", yamlConfiguration_msg);
|
||||||
|
ItemSlot_wrongValue = select("UseItem.ItemSlot_wrongValue", yamlConfiguration_msg);
|
||||||
|
UseItemDisabledInGameMode = select("UseItem.DisabledInGameMode", yamlConfiguration_msg);
|
||||||
|
UseItemDisabledInWorld = select("UseItem.DisabledInWorld", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
Buy_msg = select("Cost.Buy_msg", yamlConfiguration_msg);
|
||||||
|
noMoney = select("Cost.No.Money", yamlConfiguration_msg);
|
||||||
|
noMoneyItem = select("Cost.No.Item", yamlConfiguration_msg);
|
||||||
|
noMoneyVote = select("Cost.No.Vote", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
NoInventorySpace = select("Cost.NoInventorySpace", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
onServerChange = select("ServerChange.onServerChange", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
guiNotFound = select("GUI.GUInotFound", yamlConfiguration_msg);
|
||||||
|
GUIIsDisabled = select("GUI.GUIisDisabled", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
Give_Sender = select("Give.Sender", yamlConfiguration_msg);
|
||||||
|
Give_Receiver = select("Give.Receiver", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
PlayerNotFond = select("Player.PlayerNotFond", yamlConfiguration_msg);
|
||||||
|
PlayerNoInventorySpace = select("Player.PlayerNoInventorySpace", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
functionItemAdd = select("FunctionItem.Add", yamlConfiguration_msg);
|
||||||
|
functionItemRemove = select("FunctionItem.Remove", yamlConfiguration_msg);
|
||||||
|
functionItemRemoveError = select("FunctionItem.RemoveError", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
functionVoteAdd = select("FunctionVote.Add", yamlConfiguration_msg);
|
||||||
|
functionVoteRemove = select("FunctionVote.Remove", yamlConfiguration_msg);
|
||||||
|
functionVoteRemoveError = select("FunctionVote.RemoveError", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
HelpCgui = select("Help.CGUI", yamlConfiguration_msg);
|
||||||
|
HelpHelp = select("Help.Help", yamlConfiguration_msg);
|
||||||
|
HelpInfo = select("Help.Info", yamlConfiguration_msg);
|
||||||
|
HelpOpen = select("Help.Open", yamlConfiguration_msg);
|
||||||
|
HelpGive = select("Help.Give", yamlConfiguration_msg);
|
||||||
|
HelpCreateDefaultGUI = select("Help.CreateDefaultGUI", yamlConfiguration_msg);
|
||||||
|
HelpReload = select("Help.Reload", yamlConfiguration_msg);
|
||||||
|
GUIItemHelp_on = select("Help.UseItem_On", yamlConfiguration_msg);
|
||||||
|
GUIItemHelp_off = select("Help.UseItem_Off", yamlConfiguration_msg);
|
||||||
|
GUIItemHelp_Slot = select("Help.UseItem_Slot", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
PlayerHelpCgui = select("Help.Player.CGUI", yamlConfiguration_msg);
|
||||||
|
PlayerHelpHelp = select("Help.Player.Help", yamlConfiguration_msg);
|
||||||
|
PlayerHelpInfo = select("Help.Player.Info", yamlConfiguration_msg);
|
||||||
|
PlayerHelpOpen = select("Help.Player.Open", yamlConfiguration_msg);
|
||||||
|
PlayerHelpGive = select("Help.Player.Give", yamlConfiguration_msg);
|
||||||
|
PlayerHelpCreateDefaultGUI = select("Help.Player.CreateDefaultGUI", yamlConfiguration_msg);
|
||||||
|
PlayerHelpReload = select("Help.Player.Reload", yamlConfiguration_msg);
|
||||||
|
PlayerGUIItemHelp_on = select("Help.Player.UseItem_On", yamlConfiguration_msg);
|
||||||
|
PlayerGUIItemHelp_off = select("Help.Player.UseItem_Off", yamlConfiguration_msg);
|
||||||
|
PlayerGUIItemHelp_Slot = select("Help.Player.UseItem_Slot", yamlConfiguration_msg);
|
||||||
|
|
||||||
|
|
||||||
|
T2Csend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String select(String path, YamlConfiguration yamlConfiguration) {
|
||||||
|
return T2Creplace.replace(SelectConfig.getPrefix(), Objects.requireNonNull(yamlConfiguration.getString(path)));
|
||||||
|
}
|
||||||
|
}
|
@ -3,10 +3,9 @@ package net.t2code.commandguiv2.Spigot.database;
|
|||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
@ -23,34 +22,34 @@ public class MySQL {
|
|||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
Calendar now = Calendar.getInstance();
|
Calendar now = Calendar.getInstance();
|
||||||
ZoneId timeZone = now.getTimeZone().toZoneId();
|
ZoneId timeZone = now.getTimeZone().toZoneId();
|
||||||
T2C_Debug.debug(Main.getPlugin(), "Server TimeZone is : " + timeZone);
|
T2Csend.debug(Main.getPlugin(), "Server TimeZone is : " + timeZone);
|
||||||
try {
|
try {
|
||||||
config.setJdbcUrl("jdbc:mysql://" + Config.VALUES.mysqlIp.getValue().toString() + ":" + Config.VALUES.mysqlPort.getValue().toString() + "/" + Config.VALUES.mysqlDatabase.getValue().toString()
|
config.setJdbcUrl("jdbc:mysql://" + SelectConfig.getMysqlIp() + ":" + SelectConfig.getMysqlPort() + "/" + SelectConfig.getMysqlDatabase()
|
||||||
+ "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone
|
+ "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone
|
||||||
+ "&useSSL=" + Config.VALUES.mysqlSSL.getValue().toString());
|
+ "&useSSL=" + SelectConfig.getMysqlSSL());
|
||||||
config.setUsername(Config.VALUES.mysqlUser.getValue().toString());
|
config.setUsername(SelectConfig.getMysqlUser());
|
||||||
config.setPassword(Config.VALUES.mysqlPassword.getValue().toString());
|
config.setPassword(SelectConfig.getMysqlPassword());
|
||||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||||
ds = new HikariDataSource(config);
|
ds = new HikariDataSource(config);
|
||||||
T2C_Send.sendStartTextCenter(Util.getPrefix(),"§2MYSQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms",false);
|
T2Csend.console(Util.getPrefix() + " §2MYSQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
T2C_Send.sendStartTextCenter(Util.getPrefix(),"§4MYSQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms",false);
|
T2Csend.console(Util.getPrefix() + " §4MYSQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
T2C_Send.error(Main.getPlugin(), ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
T2Csend.error(Main.getPlugin(), ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((boolean) Config.VALUES.debug.getValue() || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
|
if (SelectConfig.getDebug() || Main.version.toLowerCase().contains("dev") || Main.version.toLowerCase().contains("beta") || Main.version.toLowerCase().contains("snapshot")) {
|
||||||
try {
|
try {
|
||||||
T2C_Send.error(Main.getPlugin(), "MySQL DEBUG:");
|
T2Csend.error(Main.getPlugin(), "MySQL DEBUG:");
|
||||||
Connection con = ds.getConnection();
|
Connection con = ds.getConnection();
|
||||||
DatabaseMetaData dbmd = con.getMetaData();
|
DatabaseMetaData dbmd = con.getMetaData();
|
||||||
T2C_Debug.debugmsg(Main.getPlugin(), "§6Metadata of the database:");
|
T2Csend.debugmsg(Main.getPlugin(), "§6Metadata of the database:");
|
||||||
T2C_Debug.debugmsg(Main.getPlugin(), "§6DB: §e" + dbmd.getDatabaseProductName());
|
T2Csend.debugmsg(Main.getPlugin(), "§6DB: §e" + dbmd.getDatabaseProductName());
|
||||||
T2C_Debug.debugmsg(Main.getPlugin(), "§6Version: §e" + dbmd.getDatabaseProductVersion());
|
T2Csend.debugmsg(Main.getPlugin(), "§6Version: §e" + dbmd.getDatabaseProductVersion());
|
||||||
T2C_Debug.debugmsg(Main.getPlugin(), "§6Driver: §e" + dbmd.getDriverName());
|
T2Csend.debugmsg(Main.getPlugin(), "§6Driver: §e" + dbmd.getDriverName());
|
||||||
T2C_Debug.debugmsg(Main.getPlugin(), "§6Driver MajorVersion: §e" + dbmd.getDriverMajorVersion() + "." + dbmd.getDriverMinorVersion());
|
T2Csend.debugmsg(Main.getPlugin(), "§6Driver MajorVersion: §e" + dbmd.getDriverMajorVersion() + "." + dbmd.getDriverMinorVersion());
|
||||||
T2C_Debug.debugmsg(Main.getPlugin(), "§6Driver Version: §e" + dbmd.getDriverVersion());
|
T2Csend.debugmsg(Main.getPlugin(), "§6Driver Version: §e" + dbmd.getDriverVersion());
|
||||||
con.close();
|
con.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@ -66,7 +65,7 @@ public class MySQL {
|
|||||||
if (ds == null) {
|
if (ds == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
Connection con = ds.getConnection();
|
Connection con = ds.getConnection();
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
stmt.execute(query);
|
stmt.execute(query);
|
||||||
@ -76,7 +75,7 @@ public class MySQL {
|
|||||||
|
|
||||||
|
|
||||||
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
||||||
try (Connection con = ds.getConnection()) {
|
try (Connection con = ds.getConnection()) {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
@ -98,7 +97,7 @@ public class MySQL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String select(String query) {
|
public static String select(String query) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
String Ausgabe = "";
|
String Ausgabe = "";
|
||||||
try (Connection con = ds.getConnection()) {
|
try (Connection con = ds.getConnection()) {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
@ -115,7 +114,7 @@ public class MySQL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int count(String query) {
|
public static int count(String query) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
try (Connection con = ds.getConnection()) {
|
try (Connection con = ds.getConnection()) {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
@ -132,7 +131,7 @@ public class MySQL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<String> selectRow(String query) {
|
public static ArrayList<String> selectRow(String query) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
ArrayList<String> Result = new ArrayList<>();
|
ArrayList<String> Result = new ArrayList<>();
|
||||||
try (Connection con = ds.getConnection()) {
|
try (Connection con = ds.getConnection()) {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
|
@ -2,8 +2,7 @@ package net.t2code.commandguiv2.Spigot.database;
|
|||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -23,13 +22,13 @@ public class SQLITE {
|
|||||||
}
|
}
|
||||||
url = "jdbc:sqlite:" + Main.getPlugin().getDataFolder() + "/Storage/data.db";
|
url = "jdbc:sqlite:" + Main.getPlugin().getDataFolder() + "/Storage/data.db";
|
||||||
con = DriverManager.getConnection(url);
|
con = DriverManager.getConnection(url);
|
||||||
T2C_Send.sendStartTextCenter(Util.getPrefix(),"§2SQLITE successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms",false);
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2SQLITE successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
DatabaseMetaData dbmd = con.getMetaData();
|
DatabaseMetaData dbmd = con.getMetaData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void query(String query) {
|
public static void query(String query) {
|
||||||
|
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
try {
|
try {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
stmt.execute(query);
|
stmt.execute(query);
|
||||||
@ -43,7 +42,7 @@ public class SQLITE {
|
|||||||
try {
|
try {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
for (String query : queryList) {
|
for (String query : queryList) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
stmt.addBatch(query);
|
stmt.addBatch(query);
|
||||||
}
|
}
|
||||||
stmt.executeBatch();
|
stmt.executeBatch();
|
||||||
@ -55,7 +54,7 @@ public class SQLITE {
|
|||||||
|
|
||||||
|
|
||||||
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
@ -77,7 +76,7 @@ public class SQLITE {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String select(String query) {
|
public static String select(String query) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
String Ausgabe = "";
|
String Ausgabe = "";
|
||||||
try {
|
try {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
@ -94,7 +93,7 @@ public class SQLITE {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int count(String query) {
|
public static int count(String query) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
try {
|
try {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
@ -111,7 +110,7 @@ public class SQLITE {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<String> selectRow(String query) {
|
public static ArrayList<String> selectRow(String query) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), query);
|
T2Csend.debug(Main.getPlugin(), query);
|
||||||
ArrayList<String> Result = new ArrayList<>();
|
ArrayList<String> Result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.database;
|
package net.t2code.commandguiv2.Spigot.database;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -45,6 +46,7 @@ public class YML {
|
|||||||
try {
|
try {
|
||||||
yamlConfigurationStorage.save(storage);
|
yamlConfigurationStorage.save(storage);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,11 +58,11 @@ public class YML {
|
|||||||
|
|
||||||
|
|
||||||
public static Integer selectSlot(Player player) {
|
public static Integer selectSlot(Player player) {
|
||||||
T2C_Debug.debug(plugin, "yml-1");
|
T2Csend.debug(plugin, "yml-1");
|
||||||
if (!yamlConfigurationStorage.contains(String.valueOf(player.getUniqueId()))) return null;
|
if (!yamlConfigurationStorage.contains(String.valueOf(player.getUniqueId()))) return null;
|
||||||
if (yamlConfigurationStorage.getString(player.getUniqueId() + ".Slot") == null) return null;
|
if (yamlConfigurationStorage.getString(player.getUniqueId() + ".Slot") == null) return null;
|
||||||
T2C_Debug.debug(plugin, "yml-2");
|
T2Csend.debug(plugin, "yml-2");
|
||||||
T2C_Debug.debug(plugin, String.valueOf(yamlConfigurationStorage.getInt(player.getUniqueId() + ".Slot")));
|
T2Csend.debug(plugin, String.valueOf(yamlConfigurationStorage.getInt(player.getUniqueId() + ".Slot")));
|
||||||
return yamlConfigurationStorage.getInt(player.getUniqueId() + ".Slot");
|
return yamlConfigurationStorage.getInt(player.getUniqueId() + ".Slot");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.gui;
|
package net.t2code.commandguiv2.Spigot.gui;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
|
||||||
import net.t2code.commandguiv2.Spigot.listener.ServerChange;
|
import net.t2code.commandguiv2.Spigot.listener.ServerChange;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Function;
|
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Slot;
|
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||||
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
||||||
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.eco.T2C_Eco;
|
import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -46,8 +46,8 @@ public class GUIListener implements Listener {
|
|||||||
if (e.getInventory() == null) return;
|
if (e.getInventory() == null) return;
|
||||||
if (e.getCurrentItem() == null) return;
|
if (e.getCurrentItem() == null) return;
|
||||||
for (Gui gui : Main.guiHashMap.values()) {
|
for (Gui gui : Main.guiHashMap.values()) {
|
||||||
if (player.getOpenInventory().getTitle().equals(T2C_Replace.replace(prefix, GUICode + gui.guiName))
|
if (player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, GUICode + gui.guiName))
|
||||||
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(T2C_Replace.replace(prefix, player, GUICode + gui.guiName)))) {
|
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(T2Creplace.replace(prefix, player, GUICode + gui.guiName)))) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (player.getOpenInventory().getTopInventory() != e.getClickedInventory()) {
|
if (player.getOpenInventory().getTopInventory() != e.getClickedInventory()) {
|
||||||
continue;
|
continue;
|
||||||
@ -67,16 +67,16 @@ public class GUIListener implements Listener {
|
|||||||
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
|
if (slot.permission && !player.hasPermission(slot.permissionToUse)) {
|
||||||
if (function.noPermMessageEnable) {
|
if (function.noPermMessageEnable) {
|
||||||
if (function.customNoPermMessage == null || function.customNoPermMessage.equals("")) {
|
if (function.customNoPermMessage == null || function.customNoPermMessage.equals("")) {
|
||||||
T2C_Send.player(player, Languages.VALUES.NoPermissionForItem.getValue().toString().replace("[item]", T2C_Replace.replace(prefix, function.name))
|
T2Csend.player(player, SelectMessages.NoPermissionForItem.replace("[item]", T2Creplace.replace(prefix, function.name))
|
||||||
.replace("[perm]", slot.permissionToUse));
|
.replace("[perm]", slot.permissionToUse));
|
||||||
} else T2C_Send.player(player, function.customNoPermMessage.replace("[item]", T2C_Replace.replace(prefix, function.name))
|
} else T2Csend.player(player, function.customNoPermMessage.replace("[item]", T2Creplace.replace(prefix, function.name))
|
||||||
.replace("[perm]", slot.permissionToUse));
|
.replace("[perm]", slot.permissionToUse));
|
||||||
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.getCurrentItem().getType() == T2C_ItemVersion.getHead() || e.getCurrentItem().getType() == T2C_ItemVersion.getGreenWool().getType() ||
|
if (e.getCurrentItem().getType() == T2CitemVersion.getHead() || e.getCurrentItem().getType() == T2CitemVersion.getGreenWool().getType() ||
|
||||||
e.getCurrentItem().getType() == T2C_ItemVersion.getRedWool().getType() ||
|
e.getCurrentItem().getType() == T2CitemVersion.getRedWool().getType() ||
|
||||||
e.getCurrentItem().getType() == Material.valueOf(function.item.toUpperCase().replace(".", "_"))) {
|
e.getCurrentItem().getType() == Material.valueOf(function.item.toUpperCase().replace(".", "_"))) {
|
||||||
if (!slot.enable) return;
|
if (!slot.enable) return;
|
||||||
if (function.cost_Enable) {
|
if (function.cost_Enable) {
|
||||||
@ -112,11 +112,7 @@ public class GUIListener implements Listener {
|
|||||||
if (function.setConfigEnable) setConfig(function, player, e);
|
if (function.setConfigEnable) setConfig(function, player, e);
|
||||||
if (function.functionVotePoints) votePoints(e, function, player);
|
if (function.functionVotePoints) votePoints(e, function, player);
|
||||||
if (function.functionItem) item(function, player);
|
if (function.functionItem) item(function, player);
|
||||||
try {
|
|
||||||
Sound.play(player, SoundEnum.Click, function, slot, gui);
|
Sound.play(player, SoundEnum.Click, function, slot, gui);
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void command(Function slot, Player player) {
|
private static void command(Function slot, Player player) {
|
||||||
@ -125,13 +121,13 @@ public class GUIListener implements Listener {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (slot.command_BungeeCommand) {
|
if (slot.command_BungeeCommand) {
|
||||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
if (SelectLibConfig.getBungee()) {
|
||||||
for (String cmd : slot.command) {
|
for (String cmd : slot.command) {
|
||||||
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.commandAsConsole);
|
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.commandAsConsole);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
T2C_Send.console(prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2Csend.console(prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
T2C_Send.player(player, prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2Csend.player(player, prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (String cmd : slot.command) {
|
for (String cmd : slot.command) {
|
||||||
@ -163,12 +159,12 @@ public class GUIListener implements Listener {
|
|||||||
for (String msg : slot.message) {
|
for (String msg : slot.message) {
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
if (slot.cost_Enable) {
|
if (slot.cost_Enable) {
|
||||||
T2C_Send.player(player, T2C_Replace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + Config.VALUES.currency.getValue().toString()));
|
T2Csend.player(player, T2Creplace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.getCurrency()));
|
||||||
} else T2C_Send.player(player, T2C_Replace.replace(prefix, player, Placeholder.replace(msg, player)));
|
} else T2Csend.player(player, T2Creplace.replace(prefix, player, Placeholder.replace(msg, player)));
|
||||||
} else {
|
} else {
|
||||||
if (slot.cost_Enable) {
|
if (slot.cost_Enable) {
|
||||||
T2C_Send.player(player, T2C_Replace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + Config.VALUES.currency.getValue().toString()));
|
T2Csend.player(player, T2Creplace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.getCurrency()));
|
||||||
} else T2C_Send.player(player, T2C_Replace.replace(prefix, Placeholder.replace(msg, player)));
|
} else T2Csend.player(player, T2Creplace.replace(prefix, Placeholder.replace(msg, player)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,7 +176,7 @@ public class GUIListener implements Listener {
|
|||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 1L);
|
}.runTaskLater(plugin, 1L);
|
||||||
T2C_Send.player(player, Languages.VALUES.onServerChange.getValue().toString().replace("[server]", slot.serverChangeServer));
|
T2Csend.player(player, SelectMessages.onServerChange.replace("[server]", slot.serverChangeServer));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -211,7 +207,7 @@ public class GUIListener implements Listener {
|
|||||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueLeft);
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueLeft);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
T2C_Send.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
T2Csend.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -234,7 +230,7 @@ public class GUIListener implements Listener {
|
|||||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueRight);
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueRight);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
T2C_Send.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
T2Csend.player(player, "§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -257,7 +253,7 @@ public class GUIListener implements Listener {
|
|||||||
|
|
||||||
private static void togglePerm(Function function, Gui gui, Player player) {
|
private static void togglePerm(Function function, Gui gui, Player player) {
|
||||||
if (player.hasPermission(function.togglePermissionPerm)) {
|
if (player.hasPermission(function.togglePermissionPerm)) {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), Config.VALUES.togglePermFalse.getValue().toString().replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.getTogglePermFalse().replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -266,7 +262,7 @@ public class GUIListener implements Listener {
|
|||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 4L);
|
}.runTaskLater(plugin, 4L);
|
||||||
} else
|
} else
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), Config.VALUES.togglePermTrue.getValue().toString().replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.getTogglePermTrue().replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -277,8 +273,8 @@ public class GUIListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void toggleUseItem(Player player, Gui gui) {
|
private static void toggleUseItem(Player player, Gui gui) {
|
||||||
if (!(boolean)Config.VALUES.useItemAllowToggle.getValue()) {
|
if (!SelectConfig.getUseItem_AllowToggle()) {
|
||||||
T2C_Send.sender(player, "§4UseItem toggle is disabled!");
|
T2Csend.sender(player, "§4UseItem toggle is disabled!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Events.useItemHashMap.get(player.getName())) {
|
if (Events.useItemHashMap.get(player.getName())) {
|
||||||
@ -299,13 +295,13 @@ public class GUIListener implements Listener {
|
|||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
switch (function.functionVotePointsMode) {
|
switch (function.functionVotePointsMode) {
|
||||||
case ADD:
|
case ADD:
|
||||||
T2C_Eco.votePointsAdd(prefix, player, function.functionVotePointsAmount);
|
T2Ceco.votePointsAdd(prefix, player, function.functionVotePointsAmount);
|
||||||
T2C_Send.player(player, Languages.VALUES.functionVoteAdd.getValue().toString().replace("[amount]", function.functionVotePointsAmount.toString()));
|
T2Csend.player(player, SelectMessages.functionVoteAdd.replace("[amount]", function.functionVotePointsAmount.toString()));
|
||||||
break;
|
break;
|
||||||
case REMOVE:
|
case REMOVE:
|
||||||
if (T2C_Eco.votePointsRemove(prefix, player, function.functionVotePointsAmount)) {
|
if (T2Ceco.votePointsRemove(prefix, player, function.functionVotePointsAmount)) {
|
||||||
T2C_Send.player(player, Languages.VALUES.functionVoteRemove.getValue().toString().replace("[amount]", function.functionVotePointsAmount.toString()));
|
T2Csend.player(player, SelectMessages.functionVoteRemove.replace("[amount]", function.functionVotePointsAmount.toString()));
|
||||||
} else T2C_Send.player(player, Languages.VALUES.functionVoteRemoveError.getValue().toString().replace("[amount]", function.functionVotePointsAmount.toString()));
|
} else T2Csend.player(player, SelectMessages.functionVoteRemoveError.replace("[amount]", function.functionVotePointsAmount.toString()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,14 +311,14 @@ public class GUIListener implements Listener {
|
|||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
switch (function.functionItemMode) {
|
switch (function.functionItemMode) {
|
||||||
case ADD:
|
case ADD:
|
||||||
T2C_Eco.itemAdd(player, new ItemStack(Material.valueOf(item[0])), Integer.parseInt(item[1]));
|
T2Ceco.itemAdd(player, new ItemStack(Material.valueOf(item[0])), Integer.parseInt(item[1]));
|
||||||
T2C_Send.player(player, Languages.VALUES.functionItemAdd.getValue().toString().replace("[amount]", item[1]).replace("[item]", item[0]));
|
T2Csend.player(player, SelectMessages.functionItemAdd.replace("[amount]", item[1]).replace("[item]", item[0]));
|
||||||
break;
|
break;
|
||||||
case REMOVE:
|
case REMOVE:
|
||||||
if (T2C_Eco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
|
if (T2Ceco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
|
||||||
T2C_Send.player(player, Languages.VALUES.functionItemRemove.getValue().toString().replace("[amount]", item[1]).replace("[item]", item[0]));
|
T2Csend.player(player, SelectMessages.functionItemRemove.replace("[amount]", item[1]).replace("[item]", item[0]));
|
||||||
|
|
||||||
} else T2C_Send.player(player, Languages.VALUES.functionItemRemoveError.getValue().toString().replace("[amount]", item[1]));
|
} else T2Csend.player(player, SelectMessages.functionItemRemoveError.replace("[amount]", item[1]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,24 +327,24 @@ public class GUIListener implements Listener {
|
|||||||
switch (function.ecoModule) {
|
switch (function.ecoModule) {
|
||||||
case ITEM:
|
case ITEM:
|
||||||
String[] item = function.ecoItem.split(";");
|
String[] item = function.ecoItem.split(";");
|
||||||
if (!T2C_Eco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
|
if (!T2Ceco.itemRemove(player, item[0], Integer.parseInt(item[1]))) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 1L);
|
}.runTaskLater(plugin, 1L);
|
||||||
T2C_Send.player(player, Languages.VALUES.noMoneyItem.getValue().toString().replace("[item]", item[0]).replace("[amount]", item[1]));
|
T2Csend.player(player, SelectMessages.noMoneyItem.replace("[item]", item[0]).replace("[amount]", item[1]));
|
||||||
Sound.play(player, SoundEnum.NoMoney);
|
Sound.play(player, SoundEnum.NoMoney);
|
||||||
} else {
|
} else {
|
||||||
T2C_Send.player(player, Languages.VALUES.Buy_msg.getValue().toString().replace("[itemname]", T2C_Replace.replace(prefix, function.name))
|
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||||
.replace("[price]", item[1] + " " + item[0]));
|
.replace("[price]", item[1] + " " + item[0]));
|
||||||
execute(function, slot, player, e, gui);
|
execute(function, slot, player, e, gui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VOTEPOINTS:
|
case VOTEPOINTS:
|
||||||
if (T2C_Eco.votePointsRemove(prefix, player, function.votePoints)) {
|
if (T2Ceco.votePointsRemove(prefix, player, function.votePoints)) {
|
||||||
T2C_Send.player(player, Languages.VALUES.Buy_msg.getValue().toString().replace("[itemname]", T2C_Replace.replace(prefix, function.name))
|
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||||
.replace("[price]", function.votePoints + " VotePoints"));
|
.replace("[price]", function.votePoints + " VotePoints"));
|
||||||
execute(function, slot, player, e, gui);
|
execute(function, slot, player, e, gui);
|
||||||
} else {
|
} else {
|
||||||
@ -358,15 +354,15 @@ public class GUIListener implements Listener {
|
|||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 1L);
|
}.runTaskLater(plugin, 1L);
|
||||||
T2C_Send.player(player, Languages.VALUES.noMoneyVote.getValue().toString().replace("[amount]", function.votePoints.toString()));
|
T2Csend.player(player, SelectMessages.noMoneyVote.replace("[amount]", function.votePoints.toString()));
|
||||||
Sound.play(player, SoundEnum.NoMoney);
|
Sound.play(player, SoundEnum.NoMoney);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VAULT:
|
case VAULT:
|
||||||
case MONEY:
|
case MONEY:
|
||||||
if (T2C_Eco.moneyRemove(prefix, player, function.price)) {
|
if (T2Ceco.moneyRemove(prefix, player, function.price)) {
|
||||||
T2C_Send.player(player, Languages.VALUES.Buy_msg.getValue().toString().replace("[itemname]", T2C_Replace.replace(prefix, function.name))
|
T2Csend.player(player, SelectMessages.Buy_msg.replace("[itemname]", T2Creplace.replace(prefix, function.name))
|
||||||
.replace("[price]", function.price + " " + Config.VALUES.currency.getValue().toString()));
|
.replace("[price]", function.price + " " + SelectConfig.getCurrency()));
|
||||||
execute(function, slot, player, e, gui);
|
execute(function, slot, player, e, gui);
|
||||||
} else {
|
} else {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@ -375,7 +371,7 @@ public class GUIListener implements Listener {
|
|||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 1L);
|
}.runTaskLater(plugin, 1L);
|
||||||
T2C_Send.player(player, T2C_Replace.replacePrice(prefix, Languages.VALUES.noMoney.getValue().toString(), String.valueOf(function.price)));
|
T2Csend.player(player, T2Creplace.replacePrice(prefix, SelectMessages.noMoney, String.valueOf(function.price)));
|
||||||
Sound.play(player, SoundEnum.NoMoney);
|
Sound.play(player, SoundEnum.NoMoney);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1,22 +1,32 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.gui;
|
package net.t2code.commandguiv2.Spigot.gui;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.properties.Property;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Function;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Slot;
|
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
import net.t2code.commandguiv2.Spigot.system.Placeholder;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemBuilder;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemBuilder;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
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 {
|
public class GuiBuilder {
|
||||||
|
|
||||||
@ -62,21 +72,21 @@ public class GuiBuilder {
|
|||||||
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Slot slot) {
|
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Slot slot) {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
Function function = Main.functionHashMap.get(slot.function);
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
itemMeta.setDisplayName(T2C_Replace.replace(prefix, player, Placeholder.replace(function.name, player)));
|
itemMeta.setDisplayName(T2Creplace.replace(prefix, player, Placeholder.replace(function.name, player)));
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||||
itemMeta.setLore(T2C_Replace.replacePrice(prefix, player, Placeholder.replace(function.noPermLore, player), function.price + " " + Config.VALUES.currency.getValue().toString()));
|
itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||||
} else itemMeta.setLore(T2C_Replace.replacePrice(prefix, player, Placeholder.replace(function.lore, player), function.price + " " + Config.VALUES.currency.getValue().toString()));
|
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, player, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||||
} else {
|
} else {
|
||||||
itemMeta.setDisplayName(T2C_Replace.replace(prefix, Placeholder.replace(function.name, player)));
|
itemMeta.setDisplayName(T2Creplace.replace(prefix, Placeholder.replace(function.name, player)));
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
if (slot.permission && !player.hasPermission(slot.permissionToUse) && function.noPermLoreEnable) {
|
||||||
itemMeta.setLore(T2C_Replace.replacePrice(prefix, Placeholder.replace(function.noPermLore, player), function.price + " " + Config.VALUES.currency.getValue().toString()));
|
itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.noPermLore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||||
} else itemMeta.setLore(T2C_Replace.replacePrice(prefix, Placeholder.replace(function.lore, player), function.price + " " + Config.VALUES.currency.getValue().toString()));
|
} else itemMeta.setLore(T2Creplace.replacePrice(prefix, Placeholder.replace(function.lore, player), function.price + " " + SelectConfig.getCurrency()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void base64(String base64Value, Slot slot, Player player, Inventory inventory) {
|
protected static void base64(String base64Value, Slot slot, Player player, Inventory inventory) {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
Function function = Main.functionHashMap.get(slot.function);
|
||||||
ItemStack item = T2C_ItemBuilder.base64(base64Value);
|
ItemStack item = T2CitemBuilder.base64(base64Value);
|
||||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
setDisplayNameAndLore(itemMeta, player, slot);
|
setDisplayNameAndLore(itemMeta, player, slot);
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(itemMeta);
|
||||||
@ -97,7 +107,7 @@ public class GuiBuilder {
|
|||||||
|
|
||||||
protected static void playerHead(Slot slot, Player player, Inventory inventory, String skullName) {
|
protected static void playerHead(Slot slot, Player player, Inventory inventory, String skullName) {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
Function function = Main.functionHashMap.get(slot.function);
|
||||||
ItemStack item = T2C_ItemVersion.getHeadIS();
|
ItemStack item = T2CitemVersion.getHeadIS();
|
||||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
setDisplayNameAndLore(itemMeta, player, slot);
|
setDisplayNameAndLore(itemMeta, player, slot);
|
||||||
itemMeta.setOwner(skullName);
|
itemMeta.setOwner(skullName);
|
||||||
@ -112,7 +122,7 @@ public class GuiBuilder {
|
|||||||
|
|
||||||
public static void fillItem(Inventory inventory, Gui gui) {
|
public static void fillItem(Inventory inventory, Gui gui) {
|
||||||
ItemStack glass;
|
ItemStack glass;
|
||||||
if (T2C_McVersion.isMc1_8() || T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12()) {
|
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.parseShort(gui.guiFillItemItem));
|
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.parseShort(gui.guiFillItemItem));
|
||||||
} else glass = new ItemStack(Material.valueOf(gui.guiFillItemItem.toUpperCase().replace(".", "_")));
|
} else glass = new ItemStack(Material.valueOf(gui.guiFillItemItem.toUpperCase().replace(".", "_")));
|
||||||
ItemMeta itemMetaglass = glass.getItemMeta();
|
ItemMeta itemMetaglass = glass.getItemMeta();
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.gui;
|
package net.t2code.commandguiv2.Spigot.gui;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
|
||||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Function;
|
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Slot;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||||
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
import net.t2code.commandguiv2.Spigot.sound.Sound;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
||||||
import net.t2code.luckyBox.api.LuckyBoxAPI;
|
import net.t2code.luckyBox.api.LuckyBoxAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -26,20 +25,12 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class OpenGUI {
|
public class OpenGUI {
|
||||||
private static final Plugin plugin = Main.getPlugin();
|
private static Plugin plugin = Main.getPlugin();
|
||||||
private static final String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
public static void openGUI(Player player, String guiString, Boolean sound) {
|
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);
|
Gui gui = Main.guiHashMap.get(guiString);
|
||||||
|
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||||
long long_ = System.currentTimeMillis();
|
|
||||||
switch (guiString) {
|
switch (guiString) {
|
||||||
//case "plugin.PlotSquaredGUI":
|
//case "plugin.PlotSquaredGUI":
|
||||||
// if (Main.PlotSquaredGUI) {
|
// if (Main.PlotSquaredGUI) {
|
||||||
@ -56,7 +47,7 @@ public class OpenGUI {
|
|||||||
player.openInventory((new PluginListGUI(54, 1)).getInventory());
|
player.openInventory((new PluginListGUI(54, 1)).getInventory());
|
||||||
} else {
|
} else {
|
||||||
if (player.hasPermission(Permissions.admin)) {
|
if (player.hasPermission(Permissions.admin)) {
|
||||||
T2C_Send.player(player, prefix + " §4PlugManGUI could not be found! §9Please download it here: " +
|
T2Csend.player(player, prefix + " §4PlugManGUI could not be found! §9Please download it here: " +
|
||||||
"§6https://spigotmc.org/resources/plugmangui.87599/");
|
"§6https://spigotmc.org/resources/plugmangui.87599/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,21 +57,21 @@ public class OpenGUI {
|
|||||||
LuckyBoxAPI.openShop(player);
|
LuckyBoxAPI.openShop(player);
|
||||||
} else {
|
} else {
|
||||||
if (player.hasPermission(Permissions.admin)) {
|
if (player.hasPermission(Permissions.admin)) {
|
||||||
T2C_Send.player(player, prefix + " §4T2C-LuckyBox could not be found! §9Please download it here: " +
|
T2Csend.player(player, prefix + " §4T2C-LuckyBox could not be found! §9Please download it here: " +
|
||||||
"§6https://www.spigotmc.org/resources/luckybox.98154/");
|
"§6https://www.spigotmc.org/resources/luckybox.98154/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (T2C_McVersion.isMc1_13()) {
|
if (T2CmcVersion.isMc1_13()) {
|
||||||
GUIListener.GUICode = "";
|
GUIListener.GUICode = "";
|
||||||
} else GUIListener.GUICode = "§6§8§9§r";
|
} else GUIListener.GUICode = "§6§8§9§r";
|
||||||
if (gui.guiEnable || player.hasPermission(Permissions.updatemsg)) {
|
if (gui.guiEnable || player.hasPermission(Permissions.updatemsg)) {
|
||||||
Inventory inventory;
|
Inventory inventory;
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (T2C_Replace.replace(prefix, player, GUIListener.GUICode + gui.guiName)));
|
inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (T2Creplace.replace(prefix, player, GUIListener.GUICode + gui.guiName)));
|
||||||
} else inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (T2C_Replace.replace(prefix, GUIListener.GUICode + gui.guiName)));
|
} else inventory = Bukkit.createInventory((InventoryHolder) null, 9 * gui.guiLines, (T2Creplace.replace(prefix, GUIListener.GUICode + gui.guiName)));
|
||||||
|
|
||||||
if (gui.guiFillItemEnable) {
|
if (gui.guiFillItemEnable) {
|
||||||
GuiBuilder.fillItem(inventory, gui);
|
GuiBuilder.fillItem(inventory, gui);
|
||||||
@ -89,7 +80,7 @@ public class OpenGUI {
|
|||||||
try {
|
try {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
Function function = Main.functionHashMap.get(slot.function);
|
||||||
if (function == null) {
|
if (function == null) {
|
||||||
T2C_Send.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
T2Csend.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
|
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
|
||||||
@ -140,19 +131,19 @@ public class OpenGUI {
|
|||||||
Sound.play(player, SoundEnum.OpenInventory);
|
Sound.play(player, SoundEnum.OpenInventory);
|
||||||
}
|
}
|
||||||
player.openInventory(inventory);
|
player.openInventory(inventory);
|
||||||
T2C_Debug.debug(plugin, "§6" + player.getName() + " §5Open §6" + T2C_Replace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
T2Csend.debug(plugin, "§6" + player.getName() + " §5Open §6" + T2Creplace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||||
} else T2C_Send.player(player, Languages.VALUES.GUIIsDisabled.getValue().toString().replace("[gui]", T2C_Replace.replace(prefix, gui.guiName)));
|
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", T2Creplace.replace(prefix, gui.guiName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void toggleOn(Function function, Slot slot, Player player, Inventory inventory) {
|
private static void toggleOn(Function function, Slot slot, Player player, Inventory inventory) {
|
||||||
if ((boolean) Config.VALUES.toggleItemOnOrYesBase64.getValue()) {
|
if (SelectConfig.getToggleItemOnOrYesBase64()) {
|
||||||
GuiBuilder.base64(Config.VALUES.toggleItemOnOrYesBase64Value.getValue().toString(), slot, player, inventory);
|
GuiBuilder.base64(SelectConfig.getToggleItemOnOrYesBase64Value(), slot, player, inventory);
|
||||||
} else GuiBuilder.item(Config.VALUES.toggleItemOnOrYesMaterial.getValue().toString(), slot, player, inventory);
|
} else GuiBuilder.item(SelectConfig.getToggleItemOnOrYesMaterial(), slot, player, inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void toggleOff(Function function, Slot slot, Player player, Inventory inventory) {
|
private static void toggleOff(Function function, Slot slot, Player player, Inventory inventory) {
|
||||||
if ((boolean) Config.VALUES.toggleItemOffOrNoBase64.getValue()) {
|
if (SelectConfig.getToggleItemOffOrNoBase64()) {
|
||||||
GuiBuilder.base64(Config.VALUES.toggleItemOffOrNoBase64Value.getValue().toString(), slot, player, inventory);
|
GuiBuilder.base64(SelectConfig.getToggleItemOffOrNoBase64Value(), slot, player, inventory);
|
||||||
} else GuiBuilder.item(Config.VALUES.toggleItemOffOrNoMaterial.getValue().toString(), slot, player, inventory);
|
} else GuiBuilder.item(SelectConfig.getToggleItemOffOrNoMaterial(), slot, player, inventory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.listener;
|
package net.t2code.commandguiv2.Spigot.listener;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -43,21 +42,21 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
||||||
T2C_Debug.debug(Main.getPlugin(),"stream: "+stream.toString());
|
T2Csend.debug(Main.getPlugin(),"stream: "+stream.toString());
|
||||||
try {
|
try {
|
||||||
String subChannel = stream.readUTF();
|
String subChannel = stream.readUTF();
|
||||||
String input = stream.readUTF();
|
String input = stream.readUTF();
|
||||||
T2C_Debug.debug(Main.getPlugin(),"subChannel: " +subChannel);
|
T2Csend.debug(Main.getPlugin(),"subChannel: " +subChannel);
|
||||||
T2C_Debug.debug(Main.getPlugin(),"input: " +input);
|
T2Csend.debug(Main.getPlugin(),"input: " +input);
|
||||||
switch (subChannel) {
|
switch (subChannel) {
|
||||||
case "join":
|
case "join":
|
||||||
Main.proxyJoinPlayers.add(input);
|
Main.bungeejoinplayers.add(input);
|
||||||
break;
|
break;
|
||||||
case "left":
|
case "left":
|
||||||
Main.proxyJoinPlayers.remove(input);
|
Main.bungeejoinplayers.remove(input);
|
||||||
break;
|
break;
|
||||||
case "clear":
|
case "clear":
|
||||||
Main.proxyJoinPlayers.clear();
|
Main.bungeejoinplayers.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -6,7 +6,7 @@ import net.t2code.commandguiv2.Spigot.Main;
|
|||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -19,6 +19,6 @@ public class PluginEvent implements Listener {
|
|||||||
public void onJoinEvent(PlayerLoginEvent event) {
|
public void onJoinEvent(PlayerLoginEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
SelectDatabase.nameCheck(player);
|
SelectDatabase.nameCheck(player);
|
||||||
T2C_UpdateAPI.join(Main.getPlugin(),prefix, Permissions.updatemsg, event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
|
T2CupdateAPI.join(Main.getPlugin(),prefix, Permissions.updatemsg, event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,223 @@
|
|||||||
|
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.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;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
|
import net.t2code.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Obj_Select {
|
||||||
|
public static void onSelect() {
|
||||||
|
onSelectFunction();
|
||||||
|
onSelectGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onSelectGui() {
|
||||||
|
Main.guiHashMap.clear();
|
||||||
|
Main.allAliases.clear();
|
||||||
|
File f = new File(Main.getPath() + "/GUIs/");
|
||||||
|
File[] fileArray = f.listFiles();
|
||||||
|
|
||||||
|
for (File config : fileArray) {
|
||||||
|
try {
|
||||||
|
if (config.getName().equals("guiDeclaration.yml")) continue;
|
||||||
|
String sub = config.getName().substring(config.getName().length() - 4);
|
||||||
|
if (sub.equals(".yml")) {
|
||||||
|
String key = config.getName().replace(".yml", "");
|
||||||
|
Main.allAliases.add(key);
|
||||||
|
YamlConfiguration yamlConfiguration_gui = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
Boolean guiEnable = yamlConfiguration_gui.getBoolean("GUI.Enable");
|
||||||
|
Integer guiLines = yamlConfiguration_gui.getInt("GUI.Lines");
|
||||||
|
if (yamlConfiguration_gui.getInt("GUI.Lines") > 6) {
|
||||||
|
yamlConfiguration_gui.set("GUI.Lines", 6);
|
||||||
|
}
|
||||||
|
if (yamlConfiguration_gui.getInt("GUI.Lines") < 1) {
|
||||||
|
yamlConfiguration_gui.set("GUI.Lines", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
String guiName = yamlConfiguration_gui.getString("GUI.Name");
|
||||||
|
Boolean guiFillItemEnable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
|
||||||
|
String guiFillItemItem;
|
||||||
|
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
|
guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneColor");
|
||||||
|
} else guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.Item");
|
||||||
|
|
||||||
|
Boolean commandAliasEnable = yamlConfiguration_gui.getBoolean("Command.Alias");
|
||||||
|
Boolean commandPermission = yamlConfiguration_gui.getBoolean("Command.Permission.Required");
|
||||||
|
|
||||||
|
ArrayList<Slot> slots = new ArrayList<>();
|
||||||
|
for (String slotKey : yamlConfiguration_gui.getConfigurationSection("Slots").getKeys(false)) {
|
||||||
|
Integer slotNumber = yamlConfiguration_gui.getInt("Slots." + slotKey + ".Slot") - 1;
|
||||||
|
Boolean enable = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Enable");
|
||||||
|
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
|
||||||
|
Function functionCheck = Main.functionHashMap.get(function);
|
||||||
|
if (functionCheck == null) {
|
||||||
|
T2Csend.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
|
||||||
|
}
|
||||||
|
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Permission.Required");
|
||||||
|
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
|
||||||
|
String permUse = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.Use");
|
||||||
|
|
||||||
|
Slot slot = new Slot(slotNumber, enable, function, permRequired,
|
||||||
|
permSee.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
|
||||||
|
.replace("[slotname]", slotKey.toLowerCase()),
|
||||||
|
permUse.replace("[function]", key).replace("[slot]", String.valueOf(slotNumber + 1))
|
||||||
|
.replace("[slotname]", slotKey.toLowerCase()));
|
||||||
|
slots.add(slot);
|
||||||
|
}
|
||||||
|
Gui gui = new Gui(guiEnable, guiLines, guiName, guiFillItemEnable, guiFillItemItem,
|
||||||
|
key, commandAliasEnable, commandPermission, slots);
|
||||||
|
|
||||||
|
Main.guiHashMap.put(key, gui);
|
||||||
|
CmdExecuter_GUI.arg1.put(config.getName()
|
||||||
|
.replace(".yml", ""), "commandgui.gui." + key);
|
||||||
|
|
||||||
|
|
||||||
|
yamlConfiguration_gui.save(config);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Main.sendTryCatch(Obj_Select.class, e.getStackTrace()[0]);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onSelectFunction() {
|
||||||
|
Main.functionHashMap.clear();
|
||||||
|
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);
|
||||||
|
|
||||||
|
String key = config.getName().replace(".yml", "");
|
||||||
|
Boolean empty = yamlConfiguration.getBoolean("Slots.Function.Item.Empty");
|
||||||
|
Integer itemAmount = yamlConfiguration.getInt("Slots.Function.Item.Amount");
|
||||||
|
Boolean playerHead_Enable = yamlConfiguration.getBoolean("Slots.Function.Item.PlayerHead.Enable");
|
||||||
|
Boolean base64_Enable = yamlConfiguration.getBoolean("Slots.Function.Item.PlayerHead.Base64.Enable");
|
||||||
|
String base64Value = yamlConfiguration.getString("Slots.Function.Item.PlayerHead.Base64.Base64Value");
|
||||||
|
Boolean playerWhoHasOpenedTheGUI = yamlConfiguration.getBoolean("Slots.Function.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
||||||
|
String playerName = yamlConfiguration.getString("Slots.Function.Item.PlayerHead.PlayerName");
|
||||||
|
String item = yamlConfiguration.getString("Slots.Function.Item.Material");
|
||||||
|
String name = yamlConfiguration.getString("Slots.Function.Item.Name");
|
||||||
|
List<String> lore = yamlConfiguration.getStringList("Slots.Function.Item.Lore");
|
||||||
|
if (yamlConfiguration.get("Slots.Function.NoPermission") == null) {
|
||||||
|
ConfigConverter.noPermLore(yamlConfiguration, config);
|
||||||
|
}
|
||||||
|
Boolean noPermMessageEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Message.Enable");
|
||||||
|
String customNoPermMessage = yamlConfiguration.getString("Slots.Function.NoPermission.Message.CustomNoPermMessage");
|
||||||
|
Boolean noPermLoreEnable = yamlConfiguration.getBoolean("Slots.Function.NoPermission.Item.Lore.Enable");
|
||||||
|
List<String> noPermLore = yamlConfiguration.getStringList("Slots.Function.NoPermission.Item.Lore.Lore");
|
||||||
|
Boolean customSound_Enable = yamlConfiguration.getBoolean("Slots.Function.CustomSound.Enable");
|
||||||
|
Boolean customSound_NoSound = yamlConfiguration.getBoolean("Slots.Function.CustomSound.NoSound");
|
||||||
|
String customSound_Sound = yamlConfiguration.getString("Slots.Function.CustomSound.Sound");
|
||||||
|
Boolean cost_Enable = yamlConfiguration.getBoolean("Slots.Function.Cost.Enable");
|
||||||
|
EcoEnum ecoModule = null;
|
||||||
|
if (yamlConfiguration.get("Slots.Function.Cost.EcoModule") != null) {
|
||||||
|
try {
|
||||||
|
ecoModule = EcoEnum.valueOf(yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
T2Csend.error(Main.getPlugin(), "The EcoModule " + yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase() + " in the function file "
|
||||||
|
+ config.getName() + " does not exist. Please use one of the supported modules. (VAULT, ITEM, VOTEPOINTS)");
|
||||||
|
}
|
||||||
|
} else ecoModule = EcoEnum.VAULT;
|
||||||
|
|
||||||
|
String ecoItem = yamlConfiguration.getString("Slots.Function.Cost.Item");
|
||||||
|
Integer votePoints = yamlConfiguration.getInt("Slots.Function.Cost.VotePoints");
|
||||||
|
Double price = yamlConfiguration.getDouble("Slots.Function.Cost.Price");
|
||||||
|
Boolean command_Enable = yamlConfiguration.getBoolean("Slots.Function.Command.Enable");
|
||||||
|
Boolean command_BungeeCommand = yamlConfiguration.getBoolean("Slots.Function.Command.BungeeCommand");
|
||||||
|
Boolean commandAsConsole = yamlConfiguration.getBoolean("Slots.Function.Command.CommandAsConsole");
|
||||||
|
List<String> command = yamlConfiguration.getStringList("Slots.Function.Command.Command");
|
||||||
|
Boolean serverChange = yamlConfiguration.getBoolean("Slots.Function.ServerChange.Enable");
|
||||||
|
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");
|
||||||
|
Boolean message_Enable = yamlConfiguration.getBoolean("Slots.Function.Message.Enable");
|
||||||
|
List<String> message = yamlConfiguration.getStringList("Slots.Function.Message.Message");
|
||||||
|
Boolean setConfigEnable = yamlConfiguration.getBoolean("Slots.Function.SetConfig.Enable");
|
||||||
|
String configFilePath = yamlConfiguration.getString("Slots.Function.SetConfig.File.Path");
|
||||||
|
String configOptionPath = yamlConfiguration.getString("Slots.Function.SetConfig.Option.Path");
|
||||||
|
String configOptionPremat = yamlConfiguration.getString("Slots.Function.SetConfig.Option.Premat");
|
||||||
|
// Boolean ConfigChatInput = ;
|
||||||
|
|
||||||
|
String configStringValueLeft = yamlConfiguration.getString("Slots.Function.SetConfig.Value.LeftClick.String");
|
||||||
|
Boolean configBooleanValueLeft = yamlConfiguration.getBoolean("Slots.Function.SetConfig.Value.LeftClick.Boolean");
|
||||||
|
Integer configIntegerValueLeft = yamlConfiguration.getInt("Slots.Function.SetConfig.Value.LeftClick.Integer");
|
||||||
|
Double configDoubleValueLeft = yamlConfiguration.getDouble("Slots.Function.SetConfig.Value.LeftClick.Double");
|
||||||
|
List<String> configListValueLeft = yamlConfiguration.getStringList("Slots.Function.SetConfig.Value.LeftClick.List");
|
||||||
|
|
||||||
|
String configStringValueRight = yamlConfiguration.getString("Slots.Function.SetConfig.Value.RightClick.String");
|
||||||
|
Boolean configBooleanValueRight = yamlConfiguration.getBoolean("Slots.Function.SetConfig.Value.RightClick.Boolean");
|
||||||
|
Integer configIntegerValueRight = yamlConfiguration.getInt("Slots.Function.SetConfig.Value.RightClick.Integer");
|
||||||
|
Double configDoubleValueRight = yamlConfiguration.getDouble("Slots.Function.SetConfig.Value.RightClick.Double");
|
||||||
|
List<String> configListValueRight = yamlConfiguration.getStringList("Slots.Function.SetConfig.RightClick.Value.List");
|
||||||
|
|
||||||
|
|
||||||
|
Boolean pluginReloadEnable = yamlConfiguration.getBoolean("Slots.Function.SetConfig.PluginReload.Enable");
|
||||||
|
String pluginReloadCommand = yamlConfiguration.getString("Slots.Function.SetConfig.PluginReload.Command");
|
||||||
|
|
||||||
|
Boolean functionVotePoints = yamlConfiguration.getBoolean("Slots.Function.FunctionVotePoints.Enable");
|
||||||
|
FunctionVoteEnum functionVotePointsMode = null;
|
||||||
|
if (yamlConfiguration.get("Slots.Function.FunctionVotePoints.Mode") != null) {
|
||||||
|
try {
|
||||||
|
functionVotePointsMode = FunctionVoteEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
T2Csend.error(Main.getPlugin(), "The VotePoints Mode " + yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase() + " in the function file "
|
||||||
|
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer functionVotePointsAmount = yamlConfiguration.getInt("Slots.Function.FunctionVotePoints.Amount");
|
||||||
|
Boolean functionItem = yamlConfiguration.getBoolean("Slots.Function.FunctionItem.Enable");
|
||||||
|
FunctionItemEnum functionItemMode = null;
|
||||||
|
if (yamlConfiguration.get("Slots.Function.FunctionItem.Mode") != null) {
|
||||||
|
try {
|
||||||
|
functionItemMode = FunctionItemEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
T2Csend.error(Main.getPlugin(), "The Item Mode " + yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase() + " in the function file "
|
||||||
|
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String functionItemItem = yamlConfiguration.getString("Slots.Function.FunctionItem.Item");
|
||||||
|
|
||||||
|
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, 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,
|
||||||
|
functionItem, functionItemMode, functionItemItem);
|
||||||
|
Main.functionHashMap.put(key, function);
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.objects;
|
package net.t2code.commandguiv2.Spigot.objects.functions;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
|
import net.t2code.commandguiv2.Spigot.enums.EcoEnum;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
import net.t2code.commandguiv2.Spigot.enums.FunctionItemEnum;
|
@ -1,4 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.objects;
|
package net.t2code.commandguiv2.Spigot.objects.guis;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.objects;
|
package net.t2code.commandguiv2.Spigot.objects.slots;
|
||||||
|
|
||||||
public class Slot {
|
public class Slot {
|
||||||
|
|
@ -1,38 +1,34 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.sound;
|
package net.t2code.commandguiv2.Spigot.sound;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Function;
|
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Slot;
|
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Sound {
|
public class Sound {
|
||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
public static void play(Player player, SoundEnum soundEnum) {
|
public static void play(Player player, SoundEnum soundEnum) {
|
||||||
if (!(boolean) Config.VALUES.soundEnable.getValue()) return;
|
if (!SelectConfig.getSound_Enable()) return;
|
||||||
try {
|
|
||||||
play(player, soundEnum, null, null, null);
|
play(player, soundEnum, null, null, null);
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void play(Player player, SoundEnum soundEnum, Function function, Slot slot, Gui gui) throws Exception {
|
public static void play(Player player, SoundEnum soundEnum, Function function, Slot slot, Gui gui) {
|
||||||
if (!(boolean) Config.VALUES.soundEnable.getValue()) return;
|
if (!SelectConfig.getSound_Enable()) return;
|
||||||
switch (soundEnum) {
|
switch (soundEnum) {
|
||||||
case OpenInventory:
|
case OpenInventory:
|
||||||
if (!(boolean)Config.VALUES.soundOpenInventoryEnable.getValue()) return;
|
if (!SelectConfig.getSound_OpenInventory_Enable()) return;
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf( Config.VALUES.soundOpenInventory.getValue().toString().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), SelectConfig.getSound_OpenInventory(), 3, 1);
|
||||||
break;
|
break;
|
||||||
case Click:
|
case Click:
|
||||||
if (!(boolean)Config.VALUES.soundClickEnable.getValue()) return;
|
if (!SelectConfig.getSound_Click_Enable()) return;
|
||||||
if (!function.customSound_Enable) {
|
if (!function.customSound_Enable) {
|
||||||
player.playSound(player.getLocation(),org.bukkit.Sound.valueOf( Config.VALUES.soundClick.getValue().toString().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,26 +36,26 @@ public class Sound {
|
|||||||
try {
|
try {
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(function.customSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(function.customSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
T2C_Send.console("§4\n§4\n§4\n" + Languages.VALUES.SoundNotFound.getValue().toString().replace("[prefix]", prefix)
|
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
||||||
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
|
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
|
||||||
player.playSound(player.getLocation(), Config.VALUES.soundClick.getValue().toString(), 3, 1);
|
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NoMoney:
|
case NoMoney:
|
||||||
if (!(boolean)Config.VALUES.soundNoMoneyEnable.getValue()) return;
|
if (!SelectConfig.getSound_NoMoney_Enable()) return;
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(Config.VALUES.soundNoMoney.getValue().toString().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), SelectConfig.getSound_NoMoney(), 3, 1);
|
||||||
break;
|
break;
|
||||||
case NoInventorySpace:
|
case NoInventorySpace:
|
||||||
if (!(boolean)Config.VALUES.soundNoInventorySpaceEnable.getValue()) return;
|
if (!SelectConfig.getSound_NoInventorySpace_Enable()) return;
|
||||||
player.playSound(player.getLocation(),org.bukkit.Sound.valueOf( Config.VALUES.soundNoInventorySpace.getValue().toString().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), SelectConfig.getSound_NoInventorySpace(), 3, 1);
|
||||||
break;
|
break;
|
||||||
case Give:
|
case Give:
|
||||||
if (!(boolean)Config.VALUES.soundGiveEnable.getValue()) return;
|
if (!SelectConfig.getSound_Give_Enable()) return;
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(Config.VALUES.soundGive.getValue().toString().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), SelectConfig.getSound_Give(), 3, 1);
|
||||||
break;
|
break;
|
||||||
case PlayerNotFound:
|
case PlayerNotFound:
|
||||||
if (!(boolean)Config.VALUES.soundPlayerNotFoundEnable.getValue()) return;
|
if (!SelectConfig.getSound_PlayerNotFound_Enable()) return;
|
||||||
player.playSound(player.getLocation(),org.bukkit.Sound.valueOf( Config.VALUES.soundPlayerNotFound.getValue().toString().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), SelectConfig.getSound_PlayerNotFound(), 3, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.system;
|
package net.t2code.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -13,14 +13,14 @@ public class Debug {
|
|||||||
private static final Plugin plugin = Main.getPlugin();
|
private static final Plugin plugin = Main.getPlugin();
|
||||||
|
|
||||||
public static void debugmsg() {
|
public static void debugmsg() {
|
||||||
T2C_Debug.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
T2C_Debug.debug(plugin, "§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
|
T2Csend.debug(plugin, "§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
|
||||||
T2C_Debug.debug(plugin, "§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
|
T2Csend.debug(plugin, "§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
|
||||||
T2C_Debug.debug(plugin, "§3Version: §e" + Bukkit.getVersion());
|
T2Csend.debug(plugin, "§3Version: §e" + Bukkit.getVersion());
|
||||||
T2C_Debug.debug(plugin, "§3Java: §e" + System.getProperty("java.version"));
|
T2Csend.debug(plugin, "§3Java: §e" + System.getProperty("java.version"));
|
||||||
T2C_Debug.debug(plugin, "§3Worlds: §e" + String.valueOf(Bukkit.getServer().getWorlds()));
|
T2Csend.debug(plugin, "§3Worlds: §e" + String.valueOf(Bukkit.getServer().getWorlds()));
|
||||||
T2C_Debug.debug(plugin, String.valueOf(Arrays.asList(Main.getPlugin().getServer().getPluginManager().getPlugins())));
|
T2Csend.debug(plugin, String.valueOf(Arrays.asList(Main.getPlugin().getServer().getPluginManager().getPlugins())));
|
||||||
T2C_Debug.debug(plugin, "§5----------------------------------");
|
T2Csend.debug(plugin, "§5----------------------------------");
|
||||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||||
File f = new File(String.valueOf(Main.getPath()));
|
File f = new File(String.valueOf(Main.getPath()));
|
||||||
File f2 = new File(String.valueOf(Main.getPath() + "/GUIs/"));
|
File f2 = new File(String.valueOf(Main.getPath() + "/GUIs/"));
|
||||||
@ -30,22 +30,22 @@ public class Debug {
|
|||||||
File[] fileArray3 = f3.listFiles();
|
File[] fileArray3 = f3.listFiles();
|
||||||
if (fileArray != null) {
|
if (fileArray != null) {
|
||||||
for (File config : fileArray) {
|
for (File config : fileArray) {
|
||||||
T2C_Debug.debug(plugin, String.valueOf(config).replace("plugins/CommandGUI/", ""));
|
T2Csend.debug(plugin, String.valueOf(config).replace("plugins/CommandGUI/", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fileArray2 != null) {
|
if (fileArray2 != null) {
|
||||||
for (File config2 : fileArray2) {
|
for (File config2 : fileArray2) {
|
||||||
T2C_Debug.debug(plugin, String.valueOf(config2).replace("plugins/CommandGUI/", ""));
|
T2Csend.debug(plugin, String.valueOf(config2).replace("plugins/CommandGUI/", ""));
|
||||||
}
|
}
|
||||||
} else T2C_Debug.debug(plugin, "No GUI files available");
|
} else T2Csend.debug(plugin, "No GUI files available");
|
||||||
|
|
||||||
if (fileArray3 != null) {
|
if (fileArray3 != null) {
|
||||||
for (File config3 : fileArray3) {
|
for (File config3 : fileArray3) {
|
||||||
T2C_Debug.debug(plugin, String.valueOf(config3).replace("plugins/CommandGUI/", ""));
|
T2Csend.debug(plugin, String.valueOf(config3).replace("plugins/CommandGUI/", ""));
|
||||||
}
|
}
|
||||||
} else T2C_Debug.debug(plugin, "No language files available");
|
} else T2Csend.debug(plugin, "No language files available");
|
||||||
|
|
||||||
}
|
}
|
||||||
T2C_Debug.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.system;
|
package net.t2code.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverter;
|
||||||
import net.t2code.commandguiv2.Spigot.config.functions.FunctionsFile;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.gui.GuiFile;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
|
||||||
import net.t2code.commandguiv2.Spigot.gui.GUIListener;
|
import net.t2code.commandguiv2.Spigot.gui.GUIListener;
|
||||||
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
import net.t2code.commandguiv2.Spigot.listener.Bungee_Sender_Reciver;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.EventsFrom110;
|
import net.t2code.commandguiv2.Spigot.useItem.EventsFrom110;
|
||||||
@ -11,22 +8,27 @@ import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
|||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.functions.CreateFunctions;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.database.MySQL;
|
import net.t2code.commandguiv2.Spigot.database.MySQL;
|
||||||
import net.t2code.commandguiv2.Spigot.listener.PluginEvent;
|
import net.t2code.commandguiv2.Spigot.listener.PluginEvent;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
import net.t2code.commandguiv2.Spigot.objects.Obj_Select;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.config.ConfigCreate;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SQLITE;
|
import net.t2code.commandguiv2.Spigot.database.SQLITE;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
|
||||||
import net.t2code.t2codelib.util.T2C_Util;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -39,91 +41,163 @@ public class Load {
|
|||||||
|
|
||||||
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
||||||
|
|
||||||
long long_ = T2C_Template.onLoadHeader(prefix, autor, version, spigot, discord);
|
long long_ = T2Ctemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||||
|
try {
|
||||||
Debug.debugmsg();
|
Debug.debugmsg();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
T2Csend.console(prefix + " §8-------------------------------");
|
||||||
|
try {
|
||||||
|
ConfigConverter.renameMainFolder();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!new File(Main.getPath(), "config.yml").exists()) {
|
if (!new File(Main.getPath(), "config.yml").exists()) {
|
||||||
GuiFile.createDefault(false);
|
try {
|
||||||
FunctionsFile.createDefault(false);
|
plugin.saveResource("configDeclaration.yml", false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Config.set(false);
|
try {
|
||||||
|
CreateGUI.configCreate();
|
||||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
} catch (Exception e) {
|
||||||
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, T2C_Util.getPluginChannel_ProxyCommand())) {
|
e.printStackTrace();
|
||||||
T2C_Debug.debug(plugin, "registerOutgoingPluginChannel §e" + T2C_Util.getPluginChannel_ProxyCommand());
|
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, T2C_Util.getPluginChannel_ProxyCommand());
|
|
||||||
}
|
}
|
||||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, T2C_Util.getPluginChannel_CGUIOnlinePlayers())) {
|
try {
|
||||||
T2C_Debug.debug(plugin, "registerIncomingPluginChannel §e" + T2C_Util.getPluginChannel_CGUIOnlinePlayers());
|
CreateFunctions.create();
|
||||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, T2C_Util.getPluginChannel_CGUIOnlinePlayers(), new Bungee_Sender_Reciver());
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (T2C_PluginCheck.papi()) {
|
try {
|
||||||
|
ConfigCreate.configCreate();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
SelectConfig.onSelect();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
plugin.saveResource("GUIs/guiDeclaration.yml", true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
plugin.saveResource("Functions/functionDeclaration.yml", true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectConfig.setConfigVersion();
|
||||||
|
|
||||||
|
if (SelectLibConfig.getBungee()) {
|
||||||
|
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "t2c:bcmd")) {
|
||||||
|
T2Csend.debug(plugin, "registerOutgoingPluginChannel §et2c:bcmd");
|
||||||
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||||
|
}
|
||||||
|
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:cguiopl")) {
|
||||||
|
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:cguiopl");
|
||||||
|
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "t2c:cguiopl", new Bungee_Sender_Reciver());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (T2CpluginCheck.papi()) {
|
||||||
new Papi().register();
|
new Papi().register();
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionsFile.select(false);
|
try {
|
||||||
GuiFile.set(false);
|
LanguagesCreate.langCreate();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Obj_Select.onSelect();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
Languages.set(false);
|
try {
|
||||||
Config.checkSounds();
|
SelectMessages.onSelect(prefix);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
SelectConfig.sound(prefix);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
CmdExecuter_GUI.arg1.put(SelectConfig.getAdminSubCommand(), Permissions.admin + ";" + Permissions.giveItemOther + ";" + Permissions.info);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
CmdExecuter_GUI.arg1.put(Config.VALUES.adminSubCommand.getValue().toString(), Permissions.admin + ";" + Permissions.giveItemOther + ";" + Permissions.info);
|
T2Csend.console(prefix + " §8-------------------------------");
|
||||||
|
|
||||||
T2C_Template.onLoadSeparateStroke(Util.getPrefix());
|
|
||||||
loadStorage(prefix);
|
loadStorage(prefix);
|
||||||
T2C_Template.onLoadSeparateStroke(Util.getPrefix());
|
T2Csend.console(prefix + " §8-------------------------------");
|
||||||
|
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
T2C_Send.sendStartTextCenter(Util.getPrefix(),"§2PlaceholderAPI successfully connected!",false);
|
T2Csend.console(prefix + " §2PlaceholderAPI successfully connected!");
|
||||||
} else {
|
} else {
|
||||||
T2C_Send.sendStartTextCenter(Util.getPrefix(),"§4PlaceholderAPI could not be connected / found!",false);
|
T2Csend.console(prefix + " §4PlaceholderAPI could not be connected / found!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
Permissions.onPermRegister();
|
Permissions.onPermRegister();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
if ((boolean) Config.VALUES.helpAlias.getValue()) {
|
if (SelectConfig.getHelpAlias()) {
|
||||||
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
||||||
T2C_Debug.debug(plugin, "CommandRegister: commandguihelp");
|
T2Csend.debug(plugin, "CommandRegister: commandguihelp");
|
||||||
}
|
}
|
||||||
Main.getPlugin().getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
|
Main.getPlugin().getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
|
||||||
T2C_Debug.debug(plugin, "CommandRegister: commandgui");
|
T2Csend.debug(plugin, "CommandRegister: commandgui");
|
||||||
Main.getPlugin().getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
Main.getPlugin().getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
||||||
T2C_Debug.debug(plugin, "CommandRegister: commandgui-item");
|
T2Csend.debug(plugin, "CommandRegister: commandgui-item");
|
||||||
|
|
||||||
AliasRegister.onRegister(false);
|
try {
|
||||||
|
AliasRegister.onRegister();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new GUIListener(), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new GUIListener(), plugin);
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.getPlugin());
|
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.getPlugin());
|
||||||
|
|
||||||
if (!T2C_McVersion.isMc1_8() && !T2C_McVersion.isMc1_9()) {
|
if (!T2CmcVersion.isMc1_8() && !T2CmcVersion.isMc1_9()) {
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new EventsFrom110(), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new EventsFrom110(), plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
T2C_UpdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), spigotID, discord
|
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(),spigotID,discord
|
||||||
, (boolean) Config.VALUES.updateCheckOnJoin.getValue(), (boolean) Config.VALUES.updateCheckSeePreReleaseUpdates.getValue(), (int) Config.VALUES.updateCheckTimeInterval.getValue());
|
,SelectConfig.getUpdateCheckOnJoin(),SelectConfig.getUpdateCheckSeePreReleaseUpdates(),SelectConfig.getUpdateCheckTimeInterval());
|
||||||
Metrics.Bstats();
|
Metrics.Bstats();
|
||||||
Main.addonLoad();
|
Main.addonLoad();
|
||||||
T2C_Template.onLoadFooter(prefix, long_);
|
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||||
Plugman.load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadStorage(String prefix) {
|
private static void loadStorage(String prefix) {
|
||||||
try {
|
try {
|
||||||
SelectDatabase.setStorage(StorageEnum.valueOf(Config.VALUES.storage.getValue().toString()));
|
SelectDatabase.setStorage(StorageEnum.valueOf(SelectConfig.getStorage()));
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
T2C_Send.error(plugin, "The storage medium " + Config.VALUES.storage.getValue().toString() + " is not supported!");
|
T2Csend.error(plugin, "The storage medium " + SelectConfig.getStorage() + " is not supported!");
|
||||||
T2C_Send.error(plugin, "Storage medium " + StorageEnum.SQLITE + " is used.");
|
T2Csend.error(plugin, "Storage medium " + StorageEnum.SQLITE + " is used.");
|
||||||
SelectDatabase.setStorage(StorageEnum.SQLITE);
|
SelectDatabase.setStorage(StorageEnum.SQLITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (SelectDatabase.getStorage()) {
|
switch (SelectDatabase.getStorage()) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
T2C_Send.sendStartTextCenter(prefix,"§2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.",false);
|
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||||
MySQL.main();
|
MySQL.main();
|
||||||
try {
|
try {
|
||||||
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||||
@ -146,11 +220,11 @@ public class Load {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case YML:
|
case YML:
|
||||||
T2C_Send.sendStartTextCenter(prefix,"§2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.",false);
|
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case SQLITE:
|
case SQLITE:
|
||||||
T2C_Send.sendStartTextCenter(prefix,"§2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.",false);
|
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||||
try {
|
try {
|
||||||
SQLITE.main();
|
SQLITE.main();
|
||||||
SQLITE.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
SQLITE.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.system;
|
package net.t2code.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.Slot;
|
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.register.T2C_Register;
|
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -27,53 +27,53 @@ public class Permissions {
|
|||||||
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
||||||
|
|
||||||
public static void onPermRegister() {
|
public static void onPermRegister() {
|
||||||
T2C_Register.permission(command, op, plugin);
|
T2Cregister.permission(command, op, plugin);
|
||||||
T2C_Register.permissionDescription(command, "Required permission to open GUIs via command", plugin);
|
T2Cregister.permissionDescription(command, "Required permission to open GUIs via command", plugin);
|
||||||
|
|
||||||
T2C_Register.permission(getGuiItemAtLogin, op, plugin);
|
T2Cregister.permission(getGuiItemAtLogin, op, plugin);
|
||||||
T2C_Register.permission(giveItemOther, op, plugin);
|
T2Cregister.permission(giveItemOther, op, plugin);
|
||||||
T2C_Register.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
|
T2Cregister.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
|
||||||
|
|
||||||
T2C_Register.permission(useitem, op, plugin);
|
T2Cregister.permission(useitem, op, plugin);
|
||||||
T2C_Register.permissionDescription(useitem, "Required permission to use the GUI Item", plugin);
|
T2Cregister.permissionDescription(useitem, "Required permission to use the GUI Item", plugin);
|
||||||
|
|
||||||
T2C_Register.permission(useitemToggle, op, plugin);
|
T2Cregister.permission(useitemToggle, op, plugin);
|
||||||
T2C_Register.permissionDescription(useitemToggle, "Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)", plugin);
|
T2Cregister.permissionDescription(useitemToggle, "Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)", plugin);
|
||||||
|
|
||||||
T2C_Register.permission(updatemsg, op, plugin);
|
T2Cregister.permission(updatemsg, op, plugin);
|
||||||
T2C_Register.permissionDescription(updatemsg, "Players with this permission get the update message when joining if an update is available", plugin);
|
T2Cregister.permissionDescription(updatemsg, "Players with this permission get the update message when joining if an update is available", plugin);
|
||||||
|
|
||||||
T2C_Register.permission(bypass, op, plugin);
|
T2Cregister.permission(bypass, op, plugin);
|
||||||
T2C_Register.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
|
T2Cregister.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
|
||||||
|
|
||||||
T2C_Register.permission(info, notOp, plugin);
|
T2Cregister.permission(info, notOp, plugin);
|
||||||
T2C_Register.permissionDescription(info, "Permission to view T2C-CommandGUI info", plugin);
|
T2Cregister.permissionDescription(info, "Permission to view T2C-CommandGUI info", plugin);
|
||||||
|
|
||||||
T2C_Register.permission(player, op, command, true, plugin);
|
T2Cregister.permission(player, op, command, true, plugin);
|
||||||
T2C_Register.permission(player, op, getGuiItemAtLogin, true, plugin);
|
T2Cregister.permission(player, op, getGuiItemAtLogin, true, plugin);
|
||||||
T2C_Register.permission(player, op, useitem, true, plugin);
|
T2Cregister.permission(player, op, useitem, true, plugin);
|
||||||
T2C_Register.permission(player, op, useitemToggle, true, plugin);
|
T2Cregister.permission(player, op, useitemToggle, true, plugin);
|
||||||
T2C_Register.permissionDescription(player, "All permissions from T2C-CommandGUI for Player", plugin);
|
T2Cregister.permissionDescription(player, "All permissions from T2C-CommandGUI for Player", plugin);
|
||||||
|
|
||||||
T2C_Register.permission(admin, op, command, true, plugin);
|
T2Cregister.permission(admin, op, command, true, plugin);
|
||||||
T2C_Register.permission(admin, op, getGuiItemAtLogin, true, plugin);
|
T2Cregister.permission(admin, op, getGuiItemAtLogin, true, plugin);
|
||||||
T2C_Register.permission(admin, op, giveItemOther, true, plugin);
|
T2Cregister.permission(admin, op, giveItemOther, true, plugin);
|
||||||
T2C_Register.permission(admin, op, useitem, true, plugin);
|
T2Cregister.permission(admin, op, useitem, true, plugin);
|
||||||
T2C_Register.permission(admin, op, useitemToggle, true, plugin);
|
T2Cregister.permission(admin, op, useitemToggle, true, plugin);
|
||||||
T2C_Register.permission(admin, op, updatemsg, true, plugin);
|
T2Cregister.permission(admin, op, updatemsg, true, plugin);
|
||||||
T2C_Register.permission(admin, op, bypass, true, plugin);
|
T2Cregister.permission(admin, op, bypass, true, plugin);
|
||||||
T2C_Register.permission(admin, op, info, true, plugin);
|
T2Cregister.permission(admin, op, info, true, plugin);
|
||||||
T2C_Register.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
|
T2Cregister.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
|
||||||
|
|
||||||
|
|
||||||
for (Gui gui : Main.guiHashMap.values()) {
|
for (Gui gui : Main.guiHashMap.values()) {
|
||||||
T2C_Register.permission(command + "." + gui.key, op, plugin);
|
T2Cregister.permission(command + "." + gui.key, op, plugin);
|
||||||
T2C_Register.permission(admin, op, command + "." + gui.key, true, plugin);
|
T2Cregister.permission(admin, op, command + "." + gui.key, true, plugin);
|
||||||
for (Slot slot : gui.slots) {
|
for (Slot slot : gui.slots) {
|
||||||
T2C_Register.permission(slot.permissionToUse, op, plugin);
|
T2Cregister.permission(slot.permissionToUse, op, plugin);
|
||||||
T2C_Register.permission(admin, op, slot.permissionToUse, true, plugin);
|
T2Cregister.permission(admin, op, slot.permissionToUse, true, plugin);
|
||||||
T2C_Register.permission(slot.permissionToSee, op, plugin);
|
T2Cregister.permission(slot.permissionToSee, op, plugin);
|
||||||
T2C_Register.permission(admin, op, slot.permissionToSee, true, plugin);
|
T2Cregister.permission(admin, op, slot.permissionToSee, true, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.system;
|
package net.t2code.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -10,8 +10,8 @@ import java.util.List;
|
|||||||
public class Placeholder {
|
public class Placeholder {
|
||||||
public static String useitem(Player p) {
|
public static String useitem(Player p) {
|
||||||
if (Events.useItemHashMap.get(p.getName())) {
|
if (Events.useItemHashMap.get(p.getName())) {
|
||||||
return Config.VALUES.placeholderTrue.getValue().toString();
|
return SelectConfig.getPlaceholderTrue();
|
||||||
} else return Config.VALUES.placeholderFalse.getValue().toString();
|
} else return SelectConfig.getPlaceholderFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String useitem_boolean(Player p) {
|
public static String useitem_boolean(Player p) {
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// This class was created by JaTiTV.
|
|
||||||
|
|
||||||
package net.t2code.commandguiv2.Spigot.system;
|
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class Plugman {
|
|
||||||
|
|
||||||
public static void load(){
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()){
|
|
||||||
Events.joinPlayer(player);
|
|
||||||
Commands.itemOn(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void unLoad(){
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()){
|
|
||||||
Commands.itemOff(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,14 +2,13 @@ package net.t2code.commandguiv2.Spigot.useItem;
|
|||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
import net.t2code.commandguiv2.Spigot.gui.OpenGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
import net.t2code.commandguiv2.api.CGuiAPI;
|
import net.t2code.commandguiv2.api.CGuiAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -27,7 +26,9 @@ import org.bukkit.event.server.ServerCommandEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class Events implements Listener {
|
public class Events implements Listener {
|
||||||
|
|
||||||
@ -36,46 +37,44 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
joinPlayer(e.getPlayer());
|
useItemHashMap.put(e.getPlayer().getName(), SelectDatabase.selectItemStatus(e.getPlayer()));
|
||||||
}
|
Integer i = SelectDatabase.selectSlot(e.getPlayer());
|
||||||
|
if (i == null) {
|
||||||
public static void joinPlayer(Player player) {
|
useItemSlotHashMap.put(e.getPlayer().getName(), SelectConfig.getUseItem_InventorySlot());
|
||||||
useItemHashMap.put(player.getName(), SelectDatabase.selectItemStatus(player));
|
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
|
||||||
Integer i = SelectDatabase.selectSlot(player);
|
|
||||||
useItemSlotHashMap.put(player.getName(), Objects.requireNonNullElseGet(i, () -> (int) Config.VALUES.useItemInventorySlot.getValue()));
|
|
||||||
|
|
||||||
if (CGuiAPI.JoinDisable) {
|
if (CGuiAPI.JoinDisable) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), "JoinDisable");
|
T2Csend.debug(Main.getPlugin(), "JoinDisable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (player.hasPermission("commandgui.get.guiitem.at.login")) {
|
if (e.getPlayer().hasPermission("commandgui.get.guiitem.at.login")) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
T2C_Debug.debug(Main.getPlugin(), "itemChange: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "itemChange: " + e.getPlayer().getName());
|
||||||
ItemChange.itemChange(player, true);
|
ItemChange.itemChange(e.getPlayer(), true);
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), 20L);
|
}.runTaskLater(Main.getPlugin(), 20L * 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onQuit(PlayerQuitEvent e) {
|
public void onJoin(PlayerQuitEvent e) {
|
||||||
useItemHashMap.remove(e.getPlayer().getName());
|
useItemHashMap.remove(e.getPlayer().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onDeathDrop(PlayerDeathEvent e) {
|
public void onDeathDrop(PlayerDeathEvent e) {
|
||||||
Player player = e.getEntity().getPlayer();
|
Player player = e.getEntity().getPlayer();
|
||||||
assert player != null;
|
|
||||||
UseItem.removeItem(player);
|
UseItem.removeItem(player);
|
||||||
if (!e.getDrops().isEmpty()) {
|
if (!e.getDrops().isEmpty()) {
|
||||||
Iterator var3 = (new ArrayList(e.getDrops())).iterator();
|
Iterator var3 = (new ArrayList(e.getDrops())).iterator();
|
||||||
while (var3.hasNext()) {
|
while (var3.hasNext()) {
|
||||||
ItemStack items = (ItemStack) var3.next();
|
ItemStack items = (ItemStack) var3.next();
|
||||||
if (items != null && items.hasItemMeta() && Objects.requireNonNull(items.getItemMeta()).hasDisplayName()
|
if (items != null && items.hasItemMeta() && items.getItemMeta().hasDisplayName()
|
||||||
&& items.getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& items.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
e.getDrops().remove(items);
|
e.getDrops().remove(items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,10 +84,10 @@ public class Events implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onRespawn(PlayerRespawnEvent e) {
|
public void onRespawn(PlayerRespawnEvent e) {
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if ((boolean) Config.VALUES.useItemEnable.getValue()) {
|
if (SelectConfig.getUseItem_Enable()) {
|
||||||
ItemChange.itemChange(player, false);
|
ItemChange.itemChange(player, false);
|
||||||
//if (!(boolean)Config.VALUES.useItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
//if (!SelectConfig.getUseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||||
// if ((boolean)Config.VALUES.useItem_GiveOnlyOnFirstJoin) {
|
// if (SelectConfig.getUseItem_GiveOnlyOnFirstJoin) {
|
||||||
// if (!player.hasPlayedBefore()) {
|
// if (!player.hasPlayedBefore()) {
|
||||||
// new BukkitRunnable() {
|
// new BukkitRunnable() {
|
||||||
// @Override
|
// @Override
|
||||||
@ -112,7 +111,7 @@ public class Events implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onGameModeChange(PlayerGameModeChangeEvent e) {
|
public void onGameModeChange(PlayerGameModeChangeEvent e) {
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if (!(boolean) Config.VALUES.useItemGameModeChangeEnable.getValue()) {
|
if (!SelectConfig.getUseItemGameModeChangeEnable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@ -120,13 +119,13 @@ public class Events implements Listener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
ItemChange.itemChange(player, false);
|
ItemChange.itemChange(player, false);
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), (int) Config.VALUES.useItemGameModeChangeDelayInTicks.getValue());
|
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemGameModeChangeDelayInTicks() * 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onWorldChange(PlayerChangedWorldEvent e) {
|
public void onWorldChange(PlayerChangedWorldEvent e) {
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if (!(boolean) Config.VALUES.useItemWorldChangeEnable.getValue()) {
|
if (!SelectConfig.getUseItemWorldChangeEnable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@ -134,30 +133,30 @@ public class Events implements Listener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
ItemChange.itemChange(player, false);
|
ItemChange.itemChange(player, false);
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), (int) Config.VALUES.useItemWorldChangeDelayInTicks.getValue());
|
}.runTaskLater(Main.getPlugin(), SelectConfig.getUseItemWorldChangeDelayInTicks() * 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onInteract(PlayerInteractEvent e) {
|
public void onInteract(PlayerInteractEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if (!p.isSneaking()) {
|
if (!p.isSneaking()) {
|
||||||
for (String material : (List<String>) Config.VALUES.useItemItemBlockBlacklist.getValue()) {
|
for (String material : SelectConfig.getUseItemItemBlockBlacklist()) {
|
||||||
if (e.getClickedBlock() != null) {
|
if (e.getClickedBlock() != null) {
|
||||||
if (e.getClickedBlock().getType() == Material.valueOf(material)) return;
|
if (e.getClickedBlock().getType() == Material.valueOf(material)) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((boolean) Config.VALUES.useItemEnable.getValue()) {
|
if (SelectConfig.getUseItem_Enable()) {
|
||||||
if ((boolean) Config.VALUES.useItemPlayerHeadEnable.getValue()) {
|
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
|
||||||
if (e.getItem() != null && p.getItemInHand().getType() == T2C_ItemVersion.getHead()) {
|
if (e.getItem() != null && p.getItemInHand().getType() == T2CitemVersion.getHead()) {
|
||||||
if (e.getItem().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
openGUI(e, p);
|
openGUI(e, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(Config.VALUES.useItemMaterial.getValue().toString().toUpperCase())) {
|
if (e.getItem() != null && p.getItemInHand().getType() == Material.valueOf(SelectConfig.getUseItem_Material())) {
|
||||||
if (e.getItem().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
openGUI(e, p);
|
openGUI(e, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,7 +167,7 @@ public class Events implements Listener {
|
|||||||
private static void openGUI(PlayerInteractEvent e, Player player) {
|
private static void openGUI(PlayerInteractEvent e, Player player) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
|
||||||
if (Config.VALUES.disableInfoBySneak.getValue() != null && (!(boolean) Config.VALUES.disableInfoBySneak.getValue()) && player.isSneaking()) {
|
if ((!SelectConfig.getDisableInfoBySneak()) && player.isSneaking()) {
|
||||||
Commands.info(player);
|
Commands.info(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -179,45 +178,45 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
if (UseItem.protection(player, true)) return;
|
if (UseItem.protection(player, true)) return;
|
||||||
|
|
||||||
if ((boolean) Config.VALUES.useItemGameModeProtection.getValue()) {
|
if (SelectConfig.getUseItemGameModeProtection()) {
|
||||||
if (Config.VALUES.useItemGameModeMode.getValue().toString().equalsIgnoreCase("blacklist") && ((List<String>) Config.VALUES.useItemGameModeList.getValue()).contains(player.getGameMode().toString())) {
|
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
T2C_Send.player(player, Languages.VALUES.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Config.VALUES.useItemGameModeMode.getValue().toString().equalsIgnoreCase("whitelist") && !((List<String>) Config.VALUES.useItemGameModeList.getValue()).contains(player.getGameMode().toString())) {
|
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
T2C_Send.player(player, Languages.VALUES.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((boolean) Config.VALUES.useItemWorldProtection.getValue()) {
|
if (SelectConfig.getUseItemWorldProtection()) {
|
||||||
if (Config.VALUES.useItemWorldMode.getValue().toString().equalsIgnoreCase("blacklist") && ((List<String>) Config.VALUES.useItemWorldList.getValue()).contains(player.getWorld().getName())) {
|
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
T2C_Send.player(player, Languages.VALUES.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Config.VALUES.useItemWorldMode.getValue().toString().equalsIgnoreCase("whitelist") && !((List<String>) Config.VALUES.useItemWorldList.getValue()).contains(player.getWorld().getName())) {
|
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
T2C_Send.player(player, Languages.VALUES.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(boolean) Config.VALUES.useItemPermissionNeeded.getValue() || player.hasPermission("commandgui.useitem")) {
|
if (!SelectConfig.getUseItem_Permission() || player.hasPermission("commandgui.useitem")) {
|
||||||
OpenGUI.openGUI(player, Config.VALUES.useItemOpenGUI.getValue().toString(), true);
|
OpenGUI.openGUI(player, SelectConfig.getUseItem_OpenGUI(), true);
|
||||||
} else {
|
} else {
|
||||||
T2C_Send.player(player, Languages.VALUES.NoPermissionForUseItem.getValue().toString().replace("[perm]", "commandgui.useitem")
|
T2Csend.player(player,SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
||||||
.replace("[gui]", Config.VALUES.useItemOpenGUI.getValue().toString()));
|
.replace("[gui]", SelectConfig.getUseItem_OpenGUI()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onItemMoveEvent(InventoryMoveItemEvent e) {
|
public void onItemMoveEvent(InventoryMoveItemEvent e) {
|
||||||
if (!(boolean) Config.VALUES.useItemBlockMoveAndDrop.getValue() || !(boolean) Config.VALUES.useItemEnable.getValue()) return;
|
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||||
if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
|
if (e.getItem() != null && e.getItem().hasItemMeta() && e.getItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getItem().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,19 +224,19 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onItemMove(InventoryDragEvent e) {
|
public void onItemMove(InventoryDragEvent e) {
|
||||||
if (!(boolean) Config.VALUES.useItemBlockMoveAndDrop.getValue() || !(boolean) Config.VALUES.useItemEnable.getValue()) return;
|
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||||
|
|
||||||
if (e.getWhoClicked() instanceof Player) {
|
if (e.getWhoClicked() instanceof Player) {
|
||||||
Player p = (Player) e.getWhoClicked();
|
Player p = (Player) e.getWhoClicked();
|
||||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||||
&& e.getCursor().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
ItemChange.itemChange(p, false);
|
ItemChange.itemChange(p, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.getOldCursor() != null && e.getOldCursor().hasItemMeta() && e.getOldCursor().getItemMeta().hasDisplayName()
|
if (e.getOldCursor() != null && e.getOldCursor().hasItemMeta() && e.getOldCursor().getItemMeta().hasDisplayName()
|
||||||
&& e.getOldCursor().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getOldCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
ItemChange.itemChange(p, false);
|
ItemChange.itemChange(p, false);
|
||||||
@ -247,29 +246,14 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onItemMove(InventoryClickEvent e) {
|
public void onItemMove(InventoryClickEvent e) {
|
||||||
if (!(boolean) Config.VALUES.useItemBlockMoveAndDrop.getValue() || !(boolean) Config.VALUES.useItemEnable.getValue()) return;
|
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||||
|
|
||||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
||||||
&& e.getCursor().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getCursor().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
|
if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
|
||||||
public void onItemMove2(InventoryClickEvent e) {
|
|
||||||
if (!(boolean) Config.VALUES.useItemBlockMoveAndDrop.getValue() || !(boolean) Config.VALUES.useItemEnable.getValue()) return;
|
|
||||||
|
|
||||||
if (e.getCursor() != null && e.getCursor().hasItemMeta() && e.getCursor().getItemMeta().hasDisplayName()
|
|
||||||
&& e.getCursor().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
if (e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta() && e.getCurrentItem().getItemMeta().hasDisplayName()
|
|
||||||
&& e.getCurrentItem().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
|
||||||
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -277,12 +261,12 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onItemMove(InventoryPickupItemEvent e) {
|
public void onItemMove(InventoryPickupItemEvent e) {
|
||||||
if (!(boolean) Config.VALUES.useItemBlockMoveAndDrop.getValue() || !(boolean) Config.VALUES.useItemEnable.getValue()) return;
|
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||||
|
|
||||||
if (e.getItem() != null && e.getItem().getItemStack() != null) {
|
if (e.getItem() != null && e.getItem().getItemStack() != null) {
|
||||||
ItemStack item = e.getItem().getItemStack();
|
ItemStack item = e.getItem().getItemStack();
|
||||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||||
&& item.getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,21 +274,21 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlace(BlockPlaceEvent e) {
|
public void onPlace(BlockPlaceEvent e) {
|
||||||
if (!(boolean) Config.VALUES.useItemBlockMoveAndDrop.getValue() || !(boolean) Config.VALUES.useItemEnable.getValue()) return;
|
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||||
if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
|
if (e.getItemInHand() != null && e.getItemInHand().hasItemMeta() && e.getItemInHand().getItemMeta().hasDisplayName()
|
||||||
&& e.getItemInHand().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getItemInHand().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onDrop(PlayerDropItemEvent e) {
|
public void onDrop(PlayerDropItemEvent e) {
|
||||||
if (!(boolean) Config.VALUES.useItemBlockMoveAndDrop.getValue() || !(boolean) Config.VALUES.useItemEnable.getValue()) return;
|
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||||
|
|
||||||
if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
|
if (e.getItemDrop() != null && e.getItemDrop().getItemStack() != null) {
|
||||||
ItemStack item = e.getItemDrop().getItemStack();
|
ItemStack item = e.getItemDrop().getItemStack();
|
||||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||||
&& item.getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -316,7 +300,7 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onClearServer(ServerCommandEvent event) {
|
public void onClearServer(ServerCommandEvent event) {
|
||||||
if ((boolean) Config.VALUES.useItemKeepAtCommandClear.getValue()) {
|
if (SelectConfig.getUseItem_KeepAtCommandClear()) {
|
||||||
if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) {
|
if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -340,7 +324,7 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onClearPlayer(PlayerCommandPreprocessEvent event) {
|
public void onClearPlayer(PlayerCommandPreprocessEvent event) {
|
||||||
if ((boolean) Config.VALUES.useItemKeepAtCommandClear.getValue()) {
|
if (SelectConfig.getUseItem_KeepAtCommandClear()) {
|
||||||
if (event.getMessage().toLowerCase().contains("clear")) {
|
if (event.getMessage().toLowerCase().contains("clear")) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.useItem;
|
package net.t2code.commandguiv2.Spigot.useItem;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -11,27 +11,27 @@ public class EventsFrom110 implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onHandSwap(PlayerSwapHandItemsEvent e) {
|
public void onHandSwap(PlayerSwapHandItemsEvent e) {
|
||||||
if (!(boolean) Config.VALUES.useItemBlockMoveAndDrop.getValue() || !(boolean)Config.VALUES.useItemEnable.getValue()) return;
|
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||||
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
}
|
}
|
||||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onItemMove(PlayerSwapHandItemsEvent e) {
|
public void onItemMove(PlayerSwapHandItemsEvent e) {
|
||||||
if (!(boolean)Config.VALUES.useItemBlockMoveAndDrop.getValue() || !(boolean)Config.VALUES.useItemEnable.getValue()) return;
|
if (!SelectConfig.getUseItem_BlockMoveAndDrop() || !SelectConfig.getUseItem_Enable()) return;
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
if (e.getOffHandItem() != null && e.getOffHandItem().hasItemMeta() && e.getOffHandItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getOffHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
if (e.getMainHandItem() != null && e.getMainHandItem().hasItemMeta() && e.getMainHandItem().getItemMeta().hasDisplayName()
|
||||||
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
&& e.getMainHandItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,29 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.useItem;
|
package net.t2code.commandguiv2.Spigot.useItem;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
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.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class ItemChange {
|
public class ItemChange {
|
||||||
public static void itemChange(Player player, Boolean setCursor) {
|
public static void itemChange(Player player, Boolean setCursor) {
|
||||||
Integer slot;
|
Integer slot;
|
||||||
if ((boolean)Config.VALUES.useItemInventorySlotEnforce.getValue()) {
|
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
|
||||||
slot = (int)Config.VALUES.useItemInventorySlot.getValue();
|
slot = SelectConfig.getUseItem_InventorySlot();
|
||||||
} else {
|
} else {
|
||||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(boolean)Config.VALUES.useItemEnable.getValue()) {
|
if (!SelectConfig.getUseItem_Enable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UseItem.removeItem(player);
|
UseItem.removeItem(player);
|
||||||
if (UseItem.protection(player, false)) return;
|
if (UseItem.protection(player, false)) return;
|
||||||
if ((boolean) Config.VALUES.useItemGiveOnlyOnFirstJoin.getValue()) {
|
if (SelectConfig.getUseItem_GiveOnlyOnFirstJoin()) {
|
||||||
if (!(boolean) Config.VALUES.useItemAllowToggle.getValue() || Events.useItemHashMap.get(player.getName())) {
|
if (!SelectConfig.getUseItem_AllowToggle() || Events.useItemHashMap.get(player.getName())) {
|
||||||
if (!player.hasPlayedBefore()) {
|
if (!player.hasPlayedBefore()) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -33,16 +34,16 @@ public class ItemChange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
||||||
if ((boolean)Config.VALUES.cursorToGUIItemOnlyOnFirstLogin.getValue() || (boolean)Config.VALUES.cursorToGUIItemOnLogin.getValue()) {
|
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin() || SelectConfig.getCursor_ToGUIItem_OnLogin()) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
T2C_Debug.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(boolean)Config.VALUES.useItemGiveOnEveryJoin.getValue()) {
|
if (!SelectConfig.getUseItem_GiveOnEveryJoin()) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@ -50,14 +51,14 @@ public class ItemChange {
|
|||||||
public void run() {
|
public void run() {
|
||||||
Boolean pln = Events.useItemHashMap.get(player.getName());
|
Boolean pln = Events.useItemHashMap.get(player.getName());
|
||||||
if (pln == null) return;
|
if (pln == null) return;
|
||||||
if (!(boolean) Config.VALUES.useItemAllowToggle.getValue() || pln) {
|
if (!SelectConfig.getUseItem_AllowToggle() || pln) {
|
||||||
if ((boolean) Config.VALUES.useItemInventorySlotEnforce.getValue() || player.getInventory().getItem(slot - 1) == null) {
|
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(slot - 1) == null) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), "Give: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "Give: " + player.getName());
|
||||||
UseItem.giveUseItem(player);
|
UseItem.giveUseItem(player);
|
||||||
if (setCursor) {
|
if (setCursor) {
|
||||||
setCursor(player, slot);
|
setCursor(player, slot);
|
||||||
}
|
}
|
||||||
} else if ((boolean) Config.VALUES.useItemInventorySlotFreeSlot.getValue()) {
|
} else if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||||
boolean empty = false;
|
boolean empty = false;
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
if (player.getInventory().getItem(i) == null) {
|
if (player.getInventory().getItem(i) == null) {
|
||||||
@ -75,38 +76,38 @@ public class ItemChange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void setCursor(Player player, int slot) {
|
private static void setCursor(Player player, int slot) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
|
||||||
|
|
||||||
if (!(boolean)Config.VALUES.cursorToGUIItemOnLogin.getValue()) {
|
if (!SelectConfig.getCursor_ToGUIItem_OnLogin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
|
||||||
if ((boolean)Config.VALUES.cursorToGUIItemOnlyOnFirstLogin.getValue()) {
|
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin()) {
|
||||||
if (!player.hasPlayedBefore()) {
|
if (!player.hasPlayedBefore()) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
|
||||||
if (!T2C_Main.isBungee()) {
|
if (!SelectLibConfig.getBungee()) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
|
||||||
if ((boolean)Config.VALUES.cursorUseItemServerChange.getValue()) {
|
if (SelectConfig.getUseItem_ServerChange()) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor 8 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 8 Player: " + player.getName());
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor bungeejoinplayers: " + Main.proxyJoinPlayers);
|
T2Csend.debug(Main.getPlugin(), "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor Player: " + player.getName());
|
||||||
if (Main.proxyJoinPlayers.contains(player.getName())) {
|
if (Main.bungeejoinplayers.contains(player.getName())) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setCursor 9 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 9 Player: " + player.getName());
|
||||||
Main.proxyJoinPlayers.remove(player.getName());
|
Main.bungeejoinplayers.remove(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,82 +1,84 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.useItem;
|
package net.t2code.commandguiv2.Spigot.useItem;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.properties.Property;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemBuilder;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemBuilder;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
import java.util.List;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class UseItem {
|
public class UseItem {
|
||||||
public static void giveUseItem(Player player) {
|
public static void giveUseItem(Player player) {
|
||||||
Integer slot;
|
Integer slot;
|
||||||
if (protection(player, false)) return;
|
if (protection(player, false)) return;
|
||||||
if ((boolean)Config.VALUES.useItemInventorySlotEnforce.getValue()) {
|
if (SelectConfig.getUseItem_InventorySlotEnforce()) {
|
||||||
slot = (int)Config.VALUES.useItemInventorySlot.getValue();
|
slot = SelectConfig.getUseItem_InventorySlot();
|
||||||
} else {
|
} else {
|
||||||
slot = Events.useItemSlotHashMap.get(player.getName());
|
slot = Events.useItemSlotHashMap.get(player.getName());
|
||||||
}
|
}
|
||||||
if ((boolean)Config.VALUES.useItemInventorySlotFreeSlot.getValue()) {
|
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||||
player.getInventory().addItem(itemStack(player));
|
player.getInventory().addItem(itemStack(player));
|
||||||
} else {
|
} else {
|
||||||
T2C_Debug.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
|
T2Csend.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
|
||||||
player.getInventory().setItem(slot - 1, itemStack(player));
|
player.getInventory().setItem(slot - 1, itemStack(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addUseItem(Player player) {
|
public static void addUseItem(Player player) {
|
||||||
if (protection(player, false)) return;
|
if (protection(player, false)) return;
|
||||||
if ((boolean)Config.VALUES.useItemInventorySlotFreeSlot.getValue()) {
|
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||||
player.getInventory().addItem(itemStack(player));
|
player.getInventory().addItem(itemStack(player));
|
||||||
} else player.getInventory().addItem(itemStack(player));
|
} else player.getInventory().addItem(itemStack(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ItemStack itemStack(Player player) {
|
private static ItemStack itemStack(Player player) {
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
if ((boolean)Config.VALUES.useItemPlayerHeadEnable.getValue()) {
|
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
|
||||||
if (T2C_McVersion.isMc1_8() || T2C_McVersion.isMc1_9() || T2C_McVersion.isMc1_10() || T2C_McVersion.isMc1_11() || T2C_McVersion.isMc1_12()) {
|
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
T2C_Send.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
|
T2Csend.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
|
||||||
T2C_Send.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 {
|
} else {
|
||||||
|
|
||||||
SkullMeta playerheadmeta = null;
|
SkullMeta playerheadmeta = null;
|
||||||
|
|
||||||
if ((boolean)Config.VALUES.useItemBase64Enable.getValue()) {
|
if (SelectConfig.getUseItem_Base64_Enable()) {
|
||||||
item = T2C_ItemBuilder.base64( Config.VALUES.useItemBase64value.getValue().toString());
|
item = T2CitemBuilder.base64(SelectConfig.getUseItem_Base64value());
|
||||||
playerheadmeta = (SkullMeta) item.getItemMeta();
|
playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||||
} else {
|
} else {
|
||||||
item = T2C_ItemVersion.getHeadIS();
|
item = T2CitemVersion.getHeadIS();
|
||||||
playerheadmeta = (SkullMeta) item.getItemMeta();
|
playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||||
String p;
|
String p;
|
||||||
if ((boolean)Config.VALUES.useItemPlayerWhoHasOpenedTheGUI.getValue()) {
|
if (SelectConfig.getUseItem_PlayerWhoHasOpenedTheGUI()) {
|
||||||
p = player.getName();
|
p = player.getName();
|
||||||
} else p = Config.VALUES.useItemPlayerName.getValue().toString();
|
} else p = SelectConfig.getUseItem_PlayerName();
|
||||||
playerheadmeta.setOwner(p);
|
playerheadmeta.setOwner(p);
|
||||||
}
|
}
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
playerheadmeta.setLore(T2C_Replace.replace(Util.getPrefix(), player, (List<String>) Config.VALUES.useItemLore.getValue()));
|
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||||
} else playerheadmeta.setLore(T2C_Replace.replace(Util.getPrefix(), (List<String>) Config.VALUES.useItemLore.getValue()));
|
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||||
playerheadmeta.setDisplayName(Config.VALUES.useItemName.getValue().toString());
|
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
|
||||||
item.setItemMeta(playerheadmeta);
|
item.setItemMeta(playerheadmeta);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item = new ItemStack(Material.valueOf(Config.VALUES.useItemMaterial.getValue().toString().toUpperCase()));
|
item = new ItemStack(Material.valueOf(SelectConfig.getUseItem_Material()));
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
itemMeta.setDisplayName(Config.VALUES.useItemName.getValue().toString());
|
itemMeta.setDisplayName(SelectConfig.getUseItem_Name());
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
itemMeta.setLore(T2C_Replace.replace(Util.getPrefix(), player, (List<String>) Config.VALUES.useItemLore.getValue()));
|
itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||||
} else itemMeta.setLore(T2C_Replace.replace(Util.getPrefix(), (List<String>) Config.VALUES.useItemLore.getValue()));
|
} else itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(itemMeta);
|
||||||
item.setAmount(1);
|
item.setAmount(1);
|
||||||
}
|
}
|
||||||
@ -84,31 +86,31 @@ public class UseItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean protection(Player player, Boolean interact) {
|
public static boolean protection(Player player, Boolean interact) {
|
||||||
if ((boolean)Config.VALUES.useItemGameModeProtection.getValue()) {
|
if (SelectConfig.getUseItemGameModeProtection()) {
|
||||||
if ((boolean)Config.VALUES.useItemGameModeMode.getValue().toString().equalsIgnoreCase("blacklist") && ((List<String>)Config.VALUES.useItemGameModeList.getValue()).contains(player.getGameMode().toString())) {
|
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
T2C_Send.player(player, Languages.VALUES.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
} else if (!(boolean)Config.VALUES.useItemGameModeRemoveItemWhenItIsDisabled.getValue()) removeItem(player);
|
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Config.VALUES.useItemGameModeMode.getValue().toString().equalsIgnoreCase("whitelist") && !((List<String>)Config.VALUES.useItemGameModeList.getValue()).contains(player.getGameMode().toString())) {
|
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
T2C_Send.player(player, Languages.VALUES.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
} else if (!(boolean)Config.VALUES.useItemGameModeRemoveItemWhenItIsDisabled.getValue()) removeItem(player);
|
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((boolean)Config.VALUES.useItemWorldProtection.getValue()) {
|
if (SelectConfig.getUseItemWorldProtection()) {
|
||||||
if (Config.VALUES.useItemWorldMode.getValue().toString().equalsIgnoreCase("blacklist") && ((List<String>)Config.VALUES.useItemWorldList.getValue()).contains(player.getWorld().getName())) {
|
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
T2C_Send.player(player, Languages.VALUES.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
} else if (!(boolean)Config.VALUES.useItemWorldRemoveItemWhenItIsDisabled.getValue()) removeItem(player);
|
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Config.VALUES.useItemWorldMode.getValue().toString().equalsIgnoreCase("whitelist") && !((List<String>)Config.VALUES.useItemWorldList.getValue()).contains(player.getWorld().getName())) {
|
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
T2C_Send.player(player, Languages.VALUES.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
} else if (!(boolean)Config.VALUES.useItemWorldRemoveItemWhenItIsDisabled.getValue()) removeItem(player);
|
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,12 +118,12 @@ public class UseItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void removeItem(Player player) {
|
public static void removeItem(Player player) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), "World disabled: " + player.getName() + " " + player.getWorld().toString());
|
T2Csend.debug(Main.getPlugin(), "World disabled: " + player.getName() + " " + player.getWorld().toString());
|
||||||
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||||
ItemStack itm = player.getInventory().getItem(iam);
|
ItemStack itm = player.getInventory().getItem(iam);
|
||||||
if (itm != null) {
|
if (itm != null) {
|
||||||
if (itm.getType() == Material.valueOf(Config.VALUES.useItemMaterial.getValue().toString().toUpperCase()) || itm.getType() == T2C_ItemVersion.getHead()) {
|
if (itm.getType() == Material.valueOf(SelectConfig.getUseItem_Material()) || itm.getType() == T2CitemVersion.getHead()) {
|
||||||
if (itm.getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString())) {
|
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
player.getInventory().remove(itm);
|
player.getInventory().remove(itm);
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
break;
|
break;
|
||||||
|
@ -1,50 +1,40 @@
|
|||||||
package net.t2code.commandguiv2;
|
package net.t2code.commandguiv2;
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
|
||||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
|
||||||
import net.t2code.t2codelib.util.T2C_Util;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
||||||
@Getter
|
public static String getInfoText() {
|
||||||
private static final String infoText = "";
|
return "";
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static final String requiredT2CodeLibVersion = "16.7";
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static final String prefix = "§8[§4C§9GUI§8]";
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static final Integer spigotID = 90671;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static final String git = "JaTiTV/T2C-CommandGUI";
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static final Integer bstatsID = 10840;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static final String spigot = "https://www.spigotmc.org/resources/" + getSpigotID();
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static final String discord = "http://dc.t2code.net";
|
|
||||||
|
|
||||||
public static String[] getConfigLogo() {
|
|
||||||
ArrayList<String> arrayList = new ArrayList<>(T2C_Util.getConfigT2CodeLogo());
|
|
||||||
arrayList.addAll(Arrays.asList("", "# Spigot: " + spigot));
|
|
||||||
return arrayList.toArray(new String[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void replace(T2C_ConfigItem item) {
|
public static String getRequiredT2CodeLibVersion() {
|
||||||
if (item.getValue() instanceof List) {
|
return "16.2";
|
||||||
item.setValue(T2C_Replace.replace(Config.VALUES.prefix.getValue().toString(), (List<String>) item.getValue()));
|
}
|
||||||
} else item.setValue(T2C_Replace.replace(Config.VALUES.prefix.getValue().toString(), item.getValue().toString()));
|
|
||||||
|
public static String getPrefix() {
|
||||||
|
return "§8[§4C§9GUI§8]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getSpigotID() {
|
||||||
|
return 90671;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getGit() {
|
||||||
|
return "JaTiTV/T2C-CommandGUI";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getBstatsID() {
|
||||||
|
return 10840;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSpigot() {
|
||||||
|
return "https://www.spigotmc.org/resources/" + getSpigotID();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDiscord() {
|
||||||
|
return net.t2code.t2codelib.Util.getDiscord();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getConfigVersion() {
|
||||||
|
return 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
package net.t2code.commandguiv2.api;
|
package net.t2code.commandguiv2.api;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.Config;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.gui.GuiFile;
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.Languages;
|
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.ItemChange;
|
import net.t2code.commandguiv2.Spigot.useItem.ItemChange;
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import net.t2code.commandguiv2.Spigot.cmdManagement.Help;
|
import net.t2code.commandguiv2.Spigot.cmdManagement.Help;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||||
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
import net.t2code.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class CGuiAPI {
|
public class CGuiAPI {
|
||||||
public static Boolean JoinDisable = false;
|
public static Boolean JoinDisable = false;
|
||||||
@ -29,32 +26,32 @@ public class CGuiAPI {
|
|||||||
ItemChange.itemChange(player, setCursor);
|
ItemChange.itemChange(player, setCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasUseItemInMainHand(@NotNull Player player) {
|
public static boolean hasUseItemInMainHand(Player player) {
|
||||||
ItemStack item = player.getInventory().getItemInMainHand();
|
ItemStack item = player.getInventory().getItemInMainHand();
|
||||||
return item.hasItemMeta() && Objects.requireNonNull(item.getItemMeta()).hasDisplayName()
|
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||||
&& item.getItemMeta().getDisplayName().equals( Config.VALUES.useItemName.getValue().toString());
|
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasUseItemInOffHand(@NotNull Player player) {
|
public static boolean hasUseItemInOffHand(Player player) {
|
||||||
ItemStack item = player.getInventory().getItemInOffHand();
|
ItemStack item = player.getInventory().getItemInOffHand();
|
||||||
return item.hasItemMeta() && Objects.requireNonNull(item.getItemMeta()).hasDisplayName()
|
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||||
&& item.getItemMeta().getDisplayName().equals(Config.VALUES.useItemName.getValue().toString());
|
&& item.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
||||||
T2C_Debug.debug(Main.getPlugin(), "CGuiAPI: " + disableItemGiveOnJoin);
|
T2Csend.debug(Main.getPlugin(), "CGuiAPI: " + disableItemGiveOnJoin);
|
||||||
JoinDisable = disableItemGiveOnJoin;
|
JoinDisable = disableItemGiveOnJoin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean selectPlayerItemEnable(@NotNull Player player) {
|
public static Boolean selectPlayerItemEnable(Player player) {
|
||||||
return Events.useItemHashMap.get(player.getName());
|
return Events.useItemHashMap.get(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer selectPlayerItemSlot(@NotNull Player player) {
|
public static Integer selectPlayerItemSlot(Player player) {
|
||||||
return Events.useItemSlotHashMap.get(player.getName());
|
return Events.useItemSlotHashMap.get(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPlayerItemEnable(Player player, @NotNull Boolean value) {
|
public static void setPlayerItemEnable(Player player, Boolean value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
SelectDatabase.setItemStatusTrue(player);
|
SelectDatabase.setItemStatusTrue(player);
|
||||||
} else SelectDatabase.setItemStatusFalse(player);
|
} else SelectDatabase.setItemStatusFalse(player);
|
||||||
@ -76,25 +73,25 @@ public class CGuiAPI {
|
|||||||
Help.sendHelp(sender, Util.getPrefix());
|
Help.sendHelp(sender, Util.getPrefix());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPluginInfo(@NotNull CommandSender sender) {
|
public static void sendPluginInfo(CommandSender sender) {
|
||||||
if (sender.hasPermission(Permissions.info)) {
|
if (sender.hasPermission(Permissions.info)) {
|
||||||
Commands.info(sender);
|
Commands.info(sender);
|
||||||
} else sender.sendMessage(Languages.VALUES.NoPermissionForCommand.getValue().toString()
|
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.info));
|
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.info));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createDefaultGUI(@NotNull CommandSender sender) {
|
public static void createDefaultGUI(CommandSender sender) {
|
||||||
if (sender.hasPermission(Permissions.admin)) {
|
if (sender.hasPermission(Permissions.admin)) {
|
||||||
GuiFile.createDefault(true);
|
CreateGUI.configCreate();
|
||||||
sender.sendMessage(Languages.VALUES.DefaultGUIcreate.getValue().toString().replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "\\GUIs\\default.yml"));
|
||||||
} else sender.sendMessage(Languages.VALUES.NoPermissionForCommand.getValue().toString()
|
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
|
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reload(@NotNull CommandSender sender) {
|
public static void reload(CommandSender sender) {
|
||||||
if (sender.hasPermission(Permissions.admin)) {
|
if (sender.hasPermission(Permissions.admin)) {
|
||||||
Commands.reload(sender);
|
Commands.reload(sender);
|
||||||
} else sender.sendMessage(Languages.VALUES.NoPermissionForCommand.getValue().toString()
|
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
||||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
|
.replace("[cmd]", "/commandgui admin").replace("[perm]", Permissions.admin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user