config changes (not compelable)
This commit is contained in:
parent
2f3c555195
commit
cc9648315f
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>CommandGUI_V2</artifactId>
|
<artifactId>CommandGUI_V2</artifactId>
|
||||||
<version>2.8.14</version>
|
<version>2.9.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>CommandGUI</name>
|
<name>CommandGUI</name>
|
||||||
@ -75,7 +75,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>13.4</version>
|
<version>14.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
import net.t2code.commandguiv2.Spigot.config.gui.CreateGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
package net.t2code.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
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.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
@ -7,7 +7,7 @@ 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.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
|
import net.t2code.commandguiv2.Spigot.config.languages.LanguagesCreate;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
import net.t2code.commandguiv2.Spigot.system.Permissions;
|
||||||
@ -17,6 +17,7 @@ import net.t2code.commandguiv2.Spigot.enums.SoundEnum;
|
|||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
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;
|
||||||
@ -64,7 +65,7 @@ public class Commands {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectConfig.getBungee()) {
|
if (SelectLibConfig.getBungee()) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.getPlugin(), "commandgui:bungee");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.getPlugin(), "commandgui:bungee");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -99,7 +100,7 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
T2Csend.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.setItemStatus(player, true);
|
||||||
UseItem.giveUseItem(player);
|
UseItem.giveUseItem(player);
|
||||||
} else {
|
} else {
|
||||||
boolean empty = false;
|
boolean empty = false;
|
||||||
@ -110,7 +111,7 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty) {
|
if (empty) {
|
||||||
SelectDatabase.setItemStatusTrue(player);
|
SelectDatabase.setItemStatus(player, true);
|
||||||
UseItem.addUseItem(player);
|
UseItem.addUseItem(player);
|
||||||
T2Csend.player(player, SelectMessages.ItemON);
|
T2Csend.player(player, SelectMessages.ItemON);
|
||||||
} else {
|
} else {
|
||||||
@ -121,7 +122,7 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void itemOff(Player player) {
|
public static void itemOff(Player player) {
|
||||||
SelectDatabase.setItemStatusFalse(player);
|
SelectDatabase.setItemStatus(player, false);
|
||||||
UseItem.removeItem(player);
|
UseItem.removeItem(player);
|
||||||
T2Csend.player(player, SelectMessages.ItemOFF);
|
T2Csend.player(player, SelectMessages.ItemOFF);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package net.t2code.commandguiv2.Spigot.cmdManagement;
|
|||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
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.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
@ -0,0 +1,115 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.config;
|
||||||
|
|
||||||
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
public enum Config {
|
||||||
|
|
||||||
|
debug("Plugins.Debug", false),
|
||||||
|
updateCheckOnJoin("Plugin.updateCheck.onJoin", true),
|
||||||
|
updateCheckSeePreReleaseUpdates("Plugin.updateCheck.seePreReleaseUpdates", true),
|
||||||
|
updateCheckTimeInterval("Plugin.updateCheck.timeInterval", 60),
|
||||||
|
helpAlias("Plugin.HelpAlias", true),
|
||||||
|
adminSubCommand("Plugin.AdminSubCommand", "admin"),
|
||||||
|
language("Plugin.language", "english"),
|
||||||
|
currency("Plugin.Currency", "$"),
|
||||||
|
defaultGUI("Plugin.DefaultGUI", "default"),
|
||||||
|
|
||||||
|
|
||||||
|
storage("Storage.Type", "YML"),
|
||||||
|
mysqlIp("Storage.MySQL.IP", "localhost"),
|
||||||
|
mysqlPort("Storage.MySQL.Port", 3306),
|
||||||
|
mysqlDatabase("Storage.MySQL.Database", "database"),
|
||||||
|
mysqlUser("Storage.MySQL.User", "root"),
|
||||||
|
mysqlPassword("Storage.MySQL.Password", "password"),
|
||||||
|
mysqlSSL("Storage.MySQL.SSL", false),
|
||||||
|
|
||||||
|
|
||||||
|
useItem_Enable("UseItem.Enable", true),
|
||||||
|
UseItem_AllowToggle("UseItem.AllowToggle", true),
|
||||||
|
UseItem_AllowSetSlot("UseItem.AllowSetSlot", true),
|
||||||
|
UseItem_BlockMoveAndDrop("UseItem.BlockMoveAndDrop", true),
|
||||||
|
UseItem_OpenGUI("UseItem.OpenGUI", "default"),
|
||||||
|
UseItem_Permission("UseItem.Permission.NeededToUse", true),
|
||||||
|
UseItem_KeepAtCommandClear("UseItem.KeepAtCommandClear", true),
|
||||||
|
UseItem_InventorySlot_FreeSlot("UseItem.InventorySlot.FreeSlot", 1),
|
||||||
|
UseItem_InventorySlot("UseItem.InventorySlot.Slot", false),
|
||||||
|
UseItem_InventorySlotEnforce("UseItem.InventorySlot.SlotEnforce", false),
|
||||||
|
UseItem_Material("UseItem.Item.Material", "paper"),
|
||||||
|
|
||||||
|
|
||||||
|
UseItem_PlayerHead_Enable("UseItem.Item.PlayerHead.Enable", false),
|
||||||
|
UseItem_Base64_Enable("UseItem.Item.PlayerHead.Base64.Enable", false),
|
||||||
|
UseItem_Base64value("UseItem.Item.PlayerHead.Base64.Base64Value", ""),
|
||||||
|
UseItem_PlayerWhoHasOpenedTheGUI("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", false),
|
||||||
|
UseItem_PlayerName("UseItem.Item.PlayerHead.PlayerName", ""),
|
||||||
|
UseItem_Name("UseItem.Item.Name", "&bDefault &6GUI"),
|
||||||
|
UseItem_Lore("UseItem.Item.Lore", Collections.singletonList("&eThis is an example GUI")),
|
||||||
|
UseItem_GiveOnEveryJoin("UseItem.Join.GiveOnEveryJoin", true),
|
||||||
|
UseItem_GiveOnlyOnFirstJoin("UseItem.Join.GiveOnlyOnFirstJoin", false),
|
||||||
|
Cursor_ToGUIItem_OnLogin("UseItem.Join.Cursor.ToGUIItem.OnLogin.Enable", true),
|
||||||
|
Cursor_ToGUIItem_OnlyOnFirstLogin("UseItem.Join.Cursor.ToGUIItem.Spigot.OnlyOnFirstLogin", true),
|
||||||
|
UseItem_ServerChange("UseItem.Join.Cursor.ToGUIItem.Bungee.OnServerChange", false),
|
||||||
|
|
||||||
|
|
||||||
|
toggleItemOnOrYesBase64("Toggle.Items.OnOrYes.Item.Base64.Enable", false),
|
||||||
|
toggleItemOnOrYesBase64Value("Toggle.Items.OnOrYes.Item.Base64.Base64Value", ""),
|
||||||
|
toggleItemOnOrYesMaterial("Toggle.Items.OnOrYes.Item.Material", Main.legacy ? "WOOL,5" : T2CitemVersion.getGreenWool().getType().toString()),
|
||||||
|
toggleItemOffOrNoBase64("Toggle.Items.OffOrNo.Item.Base64.Enable", false),
|
||||||
|
toggleItemOffOrNoBase64Value("Toggle.Items.OffOrNo.Item.Base64.Base64Value", T2CitemVersion.getGreenWool().getType().toString()),
|
||||||
|
toggleItemOffOrNoMaterial("Toggle.Items.OffOrNo.Item.Material", Main.legacy ? "WOOL,14" : T2CitemVersion.getRedWool().getType().toString()),
|
||||||
|
|
||||||
|
|
||||||
|
togglePermTrue("Toggle.Permission.Commands.True", "luckperms user [player] permission set [perm] true"),
|
||||||
|
togglePermFalse("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false"),
|
||||||
|
placeholderTrue("Placeholder.True", "&2true"),
|
||||||
|
placeholderFalse("Placeholder.False", "&4false"),
|
||||||
|
|
||||||
|
|
||||||
|
Sound_Enable("Sound.Enable", true),
|
||||||
|
Sound_OpenInventory_Enable("Sound.OpenInventory.Sound", true),
|
||||||
|
Sound_OpenInventory_input("Sound.OpenInventory.Sound", null), //todo sound create class
|
||||||
|
Sound_Click_Enable("Sound.Click.Enable", null),
|
||||||
|
Sound_Click_input("Sound.Click.Sound", null),
|
||||||
|
Sound_NoMoney_Enable("Sound.NoMoney.Enable", null),
|
||||||
|
Sound_NoMoney_input("Sound.NoMoney.Sound", null),
|
||||||
|
|
||||||
|
|
||||||
|
Sound_NoInventorySpace_Enable("Sound.NoInventorySpace.Enable", null),
|
||||||
|
Sound_NoInventorySpace_input("Sound.NoInventorySpace.Sound", null),
|
||||||
|
Sound_Give_Enable("Sound.Give.Enable", null),
|
||||||
|
Sound_Give_input("Sound.Give.Sound", null),
|
||||||
|
Sound_PlayerNotFound_Enable("Sound.PlayerNotFound.Enable", null),
|
||||||
|
Sound_PlayerNotFound_input("Sound.PlayerNotFound.Sound", null),
|
||||||
|
|
||||||
|
|
||||||
|
UseItemGameModeChangeEnable("Advanced.UseItem.GameMode.Change.Enable", null),
|
||||||
|
UseItemGameModeChangeDelayInTicks("Advanced.UseItem.GameMode.Change.DelayInTicks", null),
|
||||||
|
UseItemGameModeProtection("Advanced.UseItem.GameMode.Protection.Enable", null),
|
||||||
|
UseItemGameModeRemoveItemWhenItIsDisabled("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled", null),
|
||||||
|
UseItemGameModeMode("Advanced.UseItem.GameMode.Protection.Mode", null),
|
||||||
|
UseItemGameModeList("Advanced.UseItem.GameMode.Protection.List", null),
|
||||||
|
|
||||||
|
UseItemWorldChangeEnable("Advanced.UseItem.World.Change.Enable", null),
|
||||||
|
UseItemWorldChangeDelayInTicks("Advanced.UseItem.World.Change.DelayInTicks", null),
|
||||||
|
UseItemWorldProtection("Advanced.UseItem.World.Protection.Enable", null),
|
||||||
|
UseItemWorldRemoveItemWhenItIsDisabled("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled", null),
|
||||||
|
UseItemWorldMode("Advanced.UseItem.World.Protection.Mode", null),
|
||||||
|
UseItemWorldList("Advanced.UseItem.World.Protection.List", null),
|
||||||
|
|
||||||
|
|
||||||
|
disableInfoBySneak("Advanced.UseItem.DisableInfoBySneak", null),
|
||||||
|
UseItemItemBlockBlacklist("Advanced.UseItem.ItemBlockBlacklist", null);
|
||||||
|
|
||||||
|
|
||||||
|
public final String path;
|
||||||
|
public Object value;
|
||||||
|
|
||||||
|
Config(String path, Object defaultValue) {
|
||||||
|
this.path = path;
|
||||||
|
this.value = defaultValue;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package net.t2code.commandguiv2.Spigot.config.config;
|
||||||
|
|
||||||
|
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.yaml.T2Cconfig;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ConfigSelect {
|
||||||
|
|
||||||
|
public static void selectConfig() {
|
||||||
|
File config = new File(Main.getPath(), "config.yml");
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
for (Config value : Config.values()) {
|
||||||
|
T2Cconfig.set(value.path, value.value, yamlConfiguration);
|
||||||
|
value.value = T2Cconfig.selectObject(String.valueOf(Config.messagesPrefix.value), value.path, yamlConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (
|
||||||
|
IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
T2Csend.console(Util.getPrefix() + " §2Config was loaded successfully.");
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.config;
|
package net.t2code.commandguiv2.Spigot.config.config.old;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
@ -1,4 +1,4 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.config;
|
package net.t2code.commandguiv2.Spigot.config.config.old;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
|
import net.t2code.commandguiv2.Spigot.config.configConverter.ConfigConverterUnderV5;
|
||||||
@ -51,7 +51,6 @@ public class SelectConfig {
|
|||||||
mysqlSSL = yamlConfiguration.getBoolean("Storage.MySQL.SSL");
|
mysqlSSL = yamlConfiguration.getBoolean("Storage.MySQL.SSL");
|
||||||
|
|
||||||
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
||||||
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
|
|
||||||
|
|
||||||
|
|
||||||
UseItem_Enable = yamlConfiguration.getBoolean("UseItem.Enable");
|
UseItem_Enable = yamlConfiguration.getBoolean("UseItem.Enable");
|
||||||
@ -113,11 +112,8 @@ public class SelectConfig {
|
|||||||
UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable");
|
UseItemGameModeProtection = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.Enable");
|
||||||
UseItemGameModeRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
|
UseItemGameModeRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.GameMode.Protection.RemoveItemWhenItIsDisabled");
|
||||||
UseItemGameModeMode = yamlConfiguration.getString("Advanced.UseItem.GameMode.Protection.Mode");
|
UseItemGameModeMode = yamlConfiguration.getString("Advanced.UseItem.GameMode.Protection.Mode");
|
||||||
List<String> gml = new ArrayList<>();
|
|
||||||
for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")) {
|
UseItemGameModeList = yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List");
|
||||||
gml.add(gm.toUpperCase());
|
|
||||||
}
|
|
||||||
UseItemGameModeList = gml;
|
|
||||||
|
|
||||||
UseItemWorldChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.World.Change.Enable");
|
UseItemWorldChangeEnable = yamlConfiguration.getBoolean("Advanced.UseItem.World.Change.Enable");
|
||||||
UseItemWorldChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.World.Change.DelayInTicks");
|
UseItemWorldChangeDelayInTicks = yamlConfiguration.getInt("Advanced.UseItem.World.Change.DelayInTicks");
|
||||||
@ -287,7 +283,6 @@ public class SelectConfig {
|
|||||||
|
|
||||||
|
|
||||||
private static Boolean Bungee;
|
private static Boolean Bungee;
|
||||||
private static String thisServer;
|
|
||||||
|
|
||||||
private static String DefaultGUI;
|
private static String DefaultGUI;
|
||||||
|
|
||||||
@ -437,10 +432,6 @@ public class SelectConfig {
|
|||||||
return Bungee;
|
return Bungee;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getThisServer() {
|
|
||||||
return thisServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDefaultGUI() {
|
public static String getDefaultGUI() {
|
||||||
return DefaultGUI;
|
return DefaultGUI;
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.config.languages;
|
package net.t2code.commandguiv2.Spigot.config.languages;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
@ -3,7 +3,7 @@ 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.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class SelectDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setItemStatusTrue(Player player) {
|
public static void setItemStatusFalse(Player player) {
|
||||||
Events.useItemHashMap.replace(player.getName(), true);
|
Events.useItemHashMap.replace(player.getName(), true);
|
||||||
switch (Storage) {
|
switch (Storage) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
@ -74,7 +74,7 @@ public class SelectDatabase {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case YML:
|
case YML:
|
||||||
YML.setGuiitemOn(player);
|
YML.setGuiItem(player, true);
|
||||||
break;
|
break;
|
||||||
case SQLITE:
|
case SQLITE:
|
||||||
default:
|
default:
|
||||||
@ -84,13 +84,17 @@ public class SelectDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setItemStatusFalse(Player player) {
|
public static void setItemStatus(Player player, boolean status) {
|
||||||
|
int i;
|
||||||
|
if (status) {
|
||||||
|
i = 1;
|
||||||
|
} else i = 0;
|
||||||
Events.useItemHashMap.replace(player.getName(), false);
|
Events.useItemHashMap.replace(player.getName(), false);
|
||||||
switch (Storage) {
|
switch (Storage) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
try {
|
try {
|
||||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||||
+ "', '0') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '0';");
|
+ "', '" + i + "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '" + i + "';");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
Main.sendTryCatch(SelectDatabase.class, e.getStackTrace()[0]);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -102,7 +106,7 @@ public class SelectDatabase {
|
|||||||
case SQLITE:
|
case SQLITE:
|
||||||
default:
|
default:
|
||||||
SQLITE.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
SQLITE.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||||
+ "', '0') ON CONFLICT(UUID) DO UPDATE SET `Name` = '" + player.getName() + "', `Status` = '0';");
|
+ "', '" + i + "') ON CONFLICT(UUID) DO UPDATE SET `Name` = '" + player.getName() + "', `Status` = '" + i + "';");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,20 +17,9 @@ public class YML {
|
|||||||
public static File storage = new File(Main.getPath(), "Storage/gui-item.yml");
|
public static File storage = new File(Main.getPath(), "Storage/gui-item.yml");
|
||||||
public static YamlConfiguration yamlConfigurationStorage = YamlConfiguration.loadConfiguration(storage);
|
public static YamlConfiguration yamlConfigurationStorage = YamlConfiguration.loadConfiguration(storage);
|
||||||
|
|
||||||
public static void setGuiitemOn(Player player) {
|
public static void setGuiItem(Player player, boolean status) {
|
||||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Playername", player.getName());
|
yamlConfigurationStorage.set(player.getUniqueId() + ".Playername", player.getName());
|
||||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Status", true);
|
yamlConfigurationStorage.set(player.getUniqueId() + ".Status", status);
|
||||||
|
|
||||||
try {
|
|
||||||
yamlConfigurationStorage.save(storage);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setGuiitemOff(Player player) {
|
|
||||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Playername", player.getName());
|
|
||||||
yamlConfigurationStorage.set(player.getUniqueId() + ".Status", false);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yamlConfigurationStorage.save(storage);
|
yamlConfigurationStorage.save(storage);
|
||||||
|
@ -8,7 +8,7 @@ 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.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.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;
|
||||||
|
@ -5,7 +5,7 @@ import com.mojang.authlib.properties.Property;
|
|||||||
import net.t2code.commandguiv2.Spigot.Main;
|
import net.t2code.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.slots.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;
|
||||||
|
@ -6,7 +6,7 @@ import net.t2code.commandguiv2.Spigot.Main;
|
|||||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.slots.Slot;
|
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;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.sound;
|
package net.t2code.commandguiv2.Spigot.sound;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
import net.t2code.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
import net.t2code.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
|
@ -17,8 +17,8 @@ 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.objects.Obj_Select;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.ConfigCreate;
|
import net.t2code.commandguiv2.Spigot.config.config.old.ConfigCreate;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.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;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.system;
|
package net.t2code.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
import net.t2code.commandguiv2.Spigot.useItem.Events;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -2,7 +2,7 @@ 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.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
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;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.commandguiv2.Spigot.useItem;
|
package net.t2code.commandguiv2.Spigot.useItem;
|
||||||
|
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.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;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
@ -3,7 +3,7 @@ package net.t2code.commandguiv2.Spigot.useItem;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
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.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import net.t2code.commandguiv2.Util;
|
import net.t2code.commandguiv2.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
|
@ -7,7 +7,7 @@ public class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getRequiredT2CodeLibVersion() {
|
public static String getRequiredT2CodeLibVersion() {
|
||||||
return "13.4";
|
return "14.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPrefix() {
|
public static String getPrefix() {
|
||||||
|
@ -6,7 +6,7 @@ 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.gui.CreateGUI;
|
||||||
import net.t2code.commandguiv2.Spigot.config.config.SelectConfig;
|
import net.t2code.commandguiv2.Spigot.config.config.old.SelectConfig;
|
||||||
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
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;
|
||||||
@ -53,8 +53,8 @@ public class CGuiAPI {
|
|||||||
|
|
||||||
public static void setPlayerItemEnable(Player player, Boolean value) {
|
public static void setPlayerItemEnable(Player player, Boolean value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
SelectDatabase.setItemStatusTrue(player);
|
SelectDatabase.setItemStatus(player, true);
|
||||||
} else SelectDatabase.setItemStatusFalse(player);
|
} else SelectDatabase.setItemStatus(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPlayerItemSlot(Player player, Integer value) {
|
public static void setPlayerItemSlot(Player player, Integer value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user