insert
This commit is contained in:
@@ -2,6 +2,7 @@ package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
@@ -27,10 +28,10 @@ public class Give_UseItem {
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce){
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
if (Select_Database.selectSlot(player) == null) {
|
||||
if (Events.useItemSlotHashMap.get(player)== null) {
|
||||
slot = SelectConfig.UseItem_InventorySlot;
|
||||
} else {
|
||||
slot = Select_Database.selectSlot(player);
|
||||
slot = Events.useItemSlotHashMap.get(player);
|
||||
}
|
||||
}
|
||||
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
|
||||
|
@@ -2,7 +2,7 @@ package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.GUI_Listener;
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events_from1_10;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUITab;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUIItem;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
||||
@@ -19,6 +19,7 @@ import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -70,6 +71,10 @@ public class Load {
|
||||
}
|
||||
}
|
||||
|
||||
if (PluginCheck.papi()){
|
||||
new Placeholder().register();
|
||||
}
|
||||
|
||||
try {
|
||||
LanguagesCreate.langCreate();
|
||||
} catch (Exception e) {
|
||||
@@ -81,7 +86,7 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CmdExecuter_GUI.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
CmdExecuter_GUITab.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -99,6 +104,7 @@ public class Load {
|
||||
send.console(prefix + " §8-------------------------------");
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.main();
|
||||
send.console(prefix + " §2Storage medium §6MySQL §2is used.");
|
||||
try {
|
||||
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
@@ -116,7 +122,7 @@ public class Load {
|
||||
}
|
||||
|
||||
} else {
|
||||
if (SelectConfig.Debug) send.console(prefix + " §6Storage medium §2YML §6is used.");
|
||||
send.console(prefix + " §2Storage medium §6YML §2is used.");
|
||||
}
|
||||
if (Main.PaPi) {
|
||||
send.console(prefix + " §2PlaceholderAPI successfully connected!");
|
||||
@@ -130,17 +136,14 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Main.plugin.getCommand("commandguiadmin").setExecutor(new CmdExecuter_Admin());
|
||||
// send.debug(plugin, "Commandregister: commandguiadmin");
|
||||
|
||||
if (SelectConfig.HelpAlias) {
|
||||
Main.plugin.getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
||||
send.debug(plugin, "Commandregister: commandguihelp");
|
||||
send.debug(plugin, "CommandRegister: commandguihelp");
|
||||
}
|
||||
Main.plugin.getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
|
||||
send.debug(plugin, "Commandregister: commandgui");
|
||||
Main.plugin.getCommand("commandgui").setExecutor(new CmdExecuter_GUITab());
|
||||
send.debug(plugin, "CommandRegister: commandgui");
|
||||
Main.plugin.getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
||||
send.debug(plugin, "Commandregister: commandgui-item");
|
||||
send.debug(plugin, "CommandRegister: commandgui-item");
|
||||
|
||||
try {
|
||||
AliasRegister.onRegister();
|
||||
@@ -148,7 +151,6 @@ public class Load {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new GUI_Listener(), plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
|
||||
|
||||
@@ -158,7 +160,6 @@ public class Load {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Events_from1_10(), plugin);
|
||||
}
|
||||
|
||||
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
Metrics.Bstats();
|
||||
Main.addonLoad();
|
||||
|
@@ -0,0 +1,56 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Placeholder extends PlaceholderExpansion {
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return "commandgui";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
return Main.plugin.getDescription().getAuthors().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return Main.plugin.getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean persist() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onPlaceholderRequest(Player p, String params) {
|
||||
if (params.contains("useitem_boolean")) {
|
||||
return Events.useItemHashMap.get(p).toString();
|
||||
}
|
||||
|
||||
if (params.contains("useitem")) {
|
||||
if (Events.useItemHashMap.get(p)) {
|
||||
return SelectConfig.placeholderTrue;
|
||||
} else return SelectConfig.placeholderFalse;
|
||||
}
|
||||
|
||||
if (params.contains("slot")){
|
||||
return Events.useItemSlotHashMap.get(p).toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -13,8 +13,8 @@ public class RegisterPermissions {
|
||||
Bukkit.getPluginManager().addPermission(new Permission("commandgui.command." + gui.Command_Command));
|
||||
}
|
||||
for (Slot slot : gui.GUI_Slots) {
|
||||
if (Bukkit.getPluginManager().getPermission("commandgui." + gui.Command_Command + ".slot." + (slot.Slot + 1)) == null) {
|
||||
Bukkit.getPluginManager().addPermission(new Permission("commandgui." + gui.Command_Command + ".slot." + (slot.Slot + 1)));
|
||||
if (Bukkit.getPluginManager().getPermission("commandgui." + gui.Command_Command + ".slot." + (slot.slot + 1)) == null) {
|
||||
Bukkit.getPluginManager().addPermission(new Permission("commandgui." + gui.Command_Command + ".slot." + (slot.slot + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.sql.*;
|
||||
import java.time.ZoneId;
|
||||
@@ -152,6 +151,6 @@ public class MySQL {
|
||||
}
|
||||
|
||||
public static void close() {
|
||||
ds.close();
|
||||
if (ds != null) ds.close();
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -21,6 +22,7 @@ public class Select_Database {
|
||||
}
|
||||
|
||||
public static void setItemStatusTrue(Player player) {
|
||||
Events.useItemHashMap.replace(player, true);
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '1';");
|
||||
@@ -30,6 +32,7 @@ public class Select_Database {
|
||||
}
|
||||
|
||||
public static void setItemStatusFalse(Player player) {
|
||||
Events.useItemHashMap.replace(player, false);
|
||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||
|
||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`, `Status`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
|
Reference in New Issue
Block a user