Compare commits
10 Commits
2.5.21
...
2.6.10_Sna
Author | SHA1 | Date | |
---|---|---|---|
|
ff2cb3ce96 | ||
92d4c86aa0 | |||
e98c047ff0 | |||
4cbe8ed802 | |||
|
e8b5d49822 | ||
ce07fd2f37 | |||
c7fe0603fe | |||
4849ca06e7 | |||
fe7ae61242 | |||
b3934e22cc |
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>CommandGUI_V2</artifactId>
|
||||
<version>2.5.21</version>
|
||||
<version>2.6.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandGUI</name>
|
||||
@@ -53,6 +53,10 @@
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Builders-Paradise</id>
|
||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||
@@ -61,10 +65,7 @@
|
||||
<id>T2Code</id>
|
||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@@ -86,7 +87,12 @@
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>LuckyBox-API</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>4.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_18.r2</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.18r2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_18.r1</groupId>
|
||||
@@ -173,5 +179,10 @@
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
@@ -16,13 +17,20 @@ public class BListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPluginmessage(PluginMessageEvent event) {
|
||||
if (event.getTag().equalsIgnoreCase("cgui:bungee")) {
|
||||
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
ProxiedPlayer player = BungeeCord.getInstance().getPlayer(channel);
|
||||
if (player != null) {
|
||||
BungeeCord.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
if (channel.equals("cgui-Console")) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command Console: "+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||
} else {
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||
if (player != null) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command " + player +": "+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@@ -48,10 +48,10 @@ public class GUI_Listener implements Listener {
|
||||
*/
|
||||
|
||||
if (e.getSlot() == slot.Slot) {
|
||||
|
||||
if (!slot.Perm || player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|
||||
if (!slot.Perm
|
||||
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|
||||
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1) + ".use")
|
||||
|| player.hasPermission("commandgui.admin")) {
|
||||
|
||||
if (slot.Enable) {
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, slot.Name))) {
|
||||
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == Material.valueOf(slot.Item.toUpperCase().replace(".", "_"))) {
|
||||
@@ -74,7 +74,7 @@ public class GUI_Listener implements Listener {
|
||||
public void run() {
|
||||
if (slot.Command_BungeeCommand && SelectConfig.Bungee) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bungee_Sender_Reciver.sendToBungee(player, player.getName(), cmd.replace("[player]", player.getName()));
|
||||
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.CommandAsConsole);
|
||||
}
|
||||
} else {
|
||||
if (slot.CommandAsConsole) {
|
||||
@@ -238,7 +238,7 @@ public class GUI_Listener implements Listener {
|
||||
if (slot.Command_BungeeCommand) {
|
||||
if (SelectConfig.Bungee) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bungee_Sender_Reciver.sendToBungee(player, player.getName(), cmd.replace("[player]", player.getName()));
|
||||
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.CommandAsConsole);
|
||||
}
|
||||
} else {
|
||||
send.console(prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
|
@@ -30,20 +30,24 @@ public class ItemChange {
|
||||
if (SelectConfig.UseItemGameModeProtection) {
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
|
||||
if (SelectConfig.UseItemGameModeRemoveItemWhenItIsDisabled) removeItem(player);
|
||||
send.debug(Main.plugin,"GameMode disabled: " +player.getName() +" " +player.getGameMode().toString());
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.UseItemGameModeMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemGameModeList.contains(player.getGameMode().toString())) {
|
||||
if (SelectConfig.UseItemGameModeRemoveItemWhenItIsDisabled) removeItem(player);
|
||||
send.debug(Main.plugin,"GameMode disabled: " +player.getName() +" " +player.getGameMode().toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (SelectConfig.UseItemWorldProtection) {
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("blacklist") && SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
|
||||
if (SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled)removeItem(player);
|
||||
send.debug(Main.plugin,"World disabled: " +player.getName() +" " +player.getWorld().toString());
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.UseItemWorldMode.equalsIgnoreCase("whitelist") && !SelectConfig.UseItemWorldList.contains(player.getWorld().getName())) {
|
||||
if (SelectConfig.UseItemWorldRemoveItemWhenItIsDisabled)removeItem(player);
|
||||
send.debug(Main.plugin,"World disabled: " +player.getName() +" " +player.getWorld().toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -64,9 +68,11 @@ public class ItemChange {
|
||||
}
|
||||
}
|
||||
}
|
||||
send.debug(Main.plugin,"GiveOnlyOnFirstJoin: " +player.getName());
|
||||
return;
|
||||
}
|
||||
if (!SelectConfig.UseItem_GiveOnEveryJoin) {
|
||||
send.debug(Main.plugin,"!GiveOnEveryJoin: " +player.getName());
|
||||
return;
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@@ -75,6 +81,7 @@ public class ItemChange {
|
||||
removeItem(player);
|
||||
if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
|
||||
send.debug(Main.plugin,"Give: " +player.getName());
|
||||
Give_UseItem.onGive(player);
|
||||
if (setCursor) {
|
||||
setCursor(player, slot);
|
||||
|
@@ -1,8 +1,10 @@
|
||||
package de.jatitv.commandguiv2.Spigot;
|
||||
//s<ds
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.Load;
|
||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
|
||||
import de.jatitv.commandguiv2.Util;
|
||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
@@ -113,5 +115,6 @@ public final class Main extends JavaPlugin {
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
if (enable) T2CodeTemplate.onDisable(prefix, autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
MySQL.close();
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ public class Commands {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
send.player(player, Util.getPrefix() + "§4======= §8[§4Command§9GUI§8] §4=======");
|
||||
send.player(player, Util.getPrefix() + " §2String.valueOf(Main.autor): §6" + String.valueOf(String.valueOf(Main.autor)).replace("[", "").replace("]", ""));
|
||||
send.player(player, Util.getPrefix() + " §2Autor: §6" + String.valueOf(Main.autor).replace("[", "").replace("]", ""));
|
||||
|
||||
if (UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion.equalsIgnoreCase(Main.version)) {
|
||||
send.player(player, Util.getPrefix() + " §2Version: §6" + Main.version);
|
||||
|
@@ -7,6 +7,7 @@ import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.eclipse.sisu.space.ClassFinder;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -110,6 +111,11 @@ public class AliasRegister {
|
||||
org.bukkit.craftbukkit.v1_18_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_18_R1.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
if (NMSVersion.v1_18_R2) {
|
||||
send.debug(plugin, "Alias register 1.18_R2");
|
||||
org.bukkit.craftbukkit.v1_18_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_18_R2.CraftServer) plugin.getServer();
|
||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import net.t2code.luckybox.api.LuckyBoxAPI;
|
||||
import net.t2code.luckyBox.api.LuckyBoxAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -90,47 +90,25 @@ public class OpenGUI {
|
||||
}
|
||||
}
|
||||
for (Slot slot : gui.GUI_Slots) {
|
||||
if (slot.Enable) {
|
||||
if (slot.Empty) {
|
||||
ItemStack air = new ItemStack(Material.AIR);
|
||||
inventory.setItem(slot.Slot, air);
|
||||
} else {
|
||||
if (slot.PlayerHead_Enable) {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
send.player(player, prefix + "§c Playerheads are only available from version §61.13§c! §7- §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
||||
send.error(plugin, "Playerheads are only available from version 1.13!");
|
||||
send.console(prefix + " §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
||||
} else {
|
||||
ItemStack item = ItemVersion.getHeadIS();
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
if (slot.Base64_Enable) {
|
||||
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||
profile.getProperties().put("textures", new Property("textures", slot.Base64Value));
|
||||
Field profileField = null;
|
||||
try {
|
||||
profileField = itemMeta.getClass().getDeclaredField("profile");
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(itemMeta, profile);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
if (!slot.Perm
|
||||
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|
||||
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1)+".see")
|
||||
|| player.hasPermission("commandgui.admin")) {
|
||||
if (slot.Enable) {
|
||||
if (slot.Empty) {
|
||||
ItemStack air = new ItemStack(Material.AIR);
|
||||
inventory.setItem(slot.Slot, air);
|
||||
} else {
|
||||
if (slot.PlayerHead_Enable) {
|
||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||
send.player(player, prefix + "§c Playerheads are only available from version §61.13§c! §7- §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
||||
send.error(plugin, "Playerheads are only available from version 1.13!");
|
||||
send.console(prefix + " §bGUI: §6" + Replace.replace(prefix, gui.GUI_Name).toString() + " §bSlot: §6" + (slot.Slot + 1) + " §7- " + Replace.replace(prefix, slot.Name));
|
||||
} else {
|
||||
if (slot.PlayerWhoHasOpenedTheGUI) {
|
||||
ItemStack item = ItemVersion.getHeadIS();
|
||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||
if (slot.Base64_Enable) {
|
||||
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
@@ -138,7 +116,16 @@ public class OpenGUI {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
itemMeta.setOwner(player.getName());
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||
profile.getProperties().put("textures", new Property("textures", slot.Base64Value));
|
||||
Field profileField = null;
|
||||
try {
|
||||
profileField = itemMeta.getClass().getDeclaredField("profile");
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(itemMeta, profile);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
@@ -147,46 +134,63 @@ public class OpenGUI {
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
} else {
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
if (slot.PlayerWhoHasOpenedTheGUI) {
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
itemMeta.setOwner(player.getName());
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
itemMeta.setOwner(slot.PlayerName);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
}
|
||||
itemMeta.setOwner(slot.PlayerName);
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ItemStack item = new ItemStack(Material.valueOf(slot.Item.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
ItemStack item = new ItemStack(Material.valueOf(slot.Item.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
if (Main.PaPi) {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
} else {
|
||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
||||
itemMeta.setLore(Replace.replacePrice(prefix, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
}
|
||||
item.setItemMeta(itemMeta);
|
||||
Integer am;
|
||||
if (slot.ItemAmount == 0) {
|
||||
am = 1;
|
||||
} else am = slot.ItemAmount;
|
||||
item.setAmount(am);
|
||||
inventory.setItem(slot.Slot, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.openInventory(inventory);
|
||||
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.GUI_Name) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.GUI_Name)));
|
||||
|
@@ -2,6 +2,8 @@ package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
@@ -9,16 +11,32 @@ import java.io.*;
|
||||
|
||||
public class Bungee_Sender_Reciver implements PluginMessageListener {
|
||||
|
||||
public static void sendToBungee(Player player,String channel, String information) {
|
||||
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
try {
|
||||
output.writeUTF(channel);
|
||||
if (console) {
|
||||
output.writeUTF("cgui-Console");
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
output.writeUTF(sender.getName());
|
||||
} else {
|
||||
output.writeUTF("cgui-Console");
|
||||
}
|
||||
}
|
||||
output.writeUTF(information);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||
}else {
|
||||
for(Player player : Bukkit.getOnlinePlayers()){
|
||||
player.sendPluginMessage(Main.plugin, "cgui:bungee", stream.toByteArray());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package de.jatitv.commandguiv2.Spigot.system.database;
|
||||
|
||||
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;
|
||||
@@ -8,57 +10,84 @@ import java.sql.*;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class MySQL {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
public static String ip = "localhost";
|
||||
public static Integer port = 3306;
|
||||
public static String database;
|
||||
public static String user = "root";
|
||||
public static String password = "";
|
||||
public static String url;
|
||||
protected static String url;
|
||||
public static Boolean SSL;
|
||||
private static final HikariConfig config = new HikariConfig();
|
||||
private static HikariDataSource ds;
|
||||
|
||||
public static void main() {
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
long long_ = System.currentTimeMillis();
|
||||
Calendar now = Calendar.getInstance();
|
||||
ZoneId timeZone = now.getTimeZone().toZoneId();
|
||||
send.debug(plugin, "Server TimeZone is : " + timeZone);
|
||||
url = "jdbc:mysql://" + ip + ":" + port + "/" + database + "?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=" + timeZone;
|
||||
// Europe/Berlin
|
||||
if (SSL) {
|
||||
url = url + "&useSSL=true";
|
||||
} else url = url + "&useSSL=false";
|
||||
send.debug(plugin, url);
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.close();
|
||||
send.console(Main.prefix + " §2MySQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
} catch (SQLException ex) {
|
||||
send.console(Main.prefix + " §4MySQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
send.error(plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
send.debug(Main.plugin, "Server TimeZone is : " + timeZone);
|
||||
try {
|
||||
config.setJdbcUrl("jdbc:mysql://" + ip + ":" + port + "/" + database + "?useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&autoReconnect=true&serverTimezone=" + timeZone + "&useSSL=" + SSL);
|
||||
config.setUsername(user);
|
||||
config.setPassword(password);
|
||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
ds = new HikariDataSource(config);
|
||||
send.console(Main.prefix + " §2MySQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
} catch (Exception ex) {
|
||||
send.console(Main.prefix + " §4MySQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
send.error(Main.plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
//Bukkit.getConsoleSender().sendMessage((System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
|
||||
public static void query(String query) {
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
|
||||
if (ds == null){
|
||||
return;
|
||||
}
|
||||
send.debug(Main.plugin, query);
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute(query);
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
} catch (SQLException e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void query(ArrayList<String> queryList) {
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
for (String query : queryList) {
|
||||
send.debug(Main.plugin, query);
|
||||
stmt.addBatch(query);
|
||||
}
|
||||
stmt.executeBatch();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<String> selectAll(String query) {
|
||||
ArrayList<String> Result = new ArrayList<>();
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
public static HashMap<String, ArrayList<String>> selectAll(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
HashMap<String, ArrayList<String>> Result = new HashMap<>();
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
Result.add(rs.getString(1));
|
||||
ArrayList<String> columnList = new ArrayList<>();
|
||||
for (int i = 1; i <= columns; i++) {
|
||||
columnList.add(rs.getString(i));
|
||||
}
|
||||
Result.put(rs.getString(1), columnList);
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
@@ -69,11 +98,11 @@ public class MySQL {
|
||||
}
|
||||
|
||||
public static String select(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
String Ausgabe = "";
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
Ausgabe = String.valueOf(rs.getString(1));
|
||||
}
|
||||
@@ -86,11 +115,11 @@ public class MySQL {
|
||||
}
|
||||
|
||||
public static int count(String query) {
|
||||
Integer count = 0;
|
||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||
send.debug(Main.plugin, query);
|
||||
int count = 0;
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
count++;
|
||||
}
|
||||
@@ -101,4 +130,28 @@ public class MySQL {
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static ArrayList<String> selectRow(String query) {
|
||||
send.debug(Main.plugin, query);
|
||||
ArrayList<String> Result = new ArrayList<>();
|
||||
try (Connection con = ds.getConnection()) {
|
||||
Statement stmt = con.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(query);
|
||||
int columns = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
for (int i = 1; i <= columns; i++) {
|
||||
Result.add(rs.getString(i));
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
} catch (SQLException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
public static void close() {
|
||||
ds.close();
|
||||
}
|
||||
}
|
||||
|
@@ -5,11 +5,13 @@ import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
|
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.Help;
|
||||
import de.jatitv.commandguiv2.Spigot.config.DefaultGUICreate;
|
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CGuiAPI {
|
||||
public static Boolean JoinDisable = false;
|
||||
@@ -17,12 +19,25 @@ public class CGuiAPI {
|
||||
public static void onItemChange(Player player) {
|
||||
ItemChange.itemChange(player, false);
|
||||
}
|
||||
|
||||
public static boolean hasUseItemInMainHand(Player player) {
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name);
|
||||
}
|
||||
|
||||
public static boolean hasUseItemInOffHand(Player player) {
|
||||
ItemStack item = player.getInventory().getItemInOffHand();
|
||||
return item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().equals(SelectConfig.UseItem_Name);
|
||||
}
|
||||
|
||||
public static void onItemChange(Player player, Boolean setCursor) {
|
||||
ItemChange.itemChange(player, setCursor);
|
||||
}
|
||||
|
||||
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
||||
send.debug(Main.plugin,"CGuiAPI: " +disableItemGiveOnJoin);
|
||||
send.debug(Main.plugin, "CGuiAPI: " + disableItemGiveOnJoin);
|
||||
JoinDisable = disableItemGiveOnJoin;
|
||||
}
|
||||
|
||||
|
10
CommandGUI V2/src/main/resources/META-INF/MANIFEST.MF
Normal file
10
CommandGUI V2/src/main/resources/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,10 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class:
|
||||
Class-Path: PlugmanGUI-3.0.jar spigot-1.8r3.jar spigot-1.9r1.jar spigot-
|
||||
1.15r1.jar T2CodeLib-10.3.jar spigot-1.18r1.jar bungee-1615.jar spigot-
|
||||
1.9r2.jar spigot-1.16r3.jar spigot-1.14r1.jar slf4j-api-1.7.25.jar Luck
|
||||
yBox-API-4.2.2.jar spigot-1.10r1.jar spigot-1.16r1.jar spigot-1.13r2.ja
|
||||
r HikariCP-3.4.5.jar spigot-1.11r1.jar spigot-1.13r1.jar spigot-1.8r2.j
|
||||
ar spigot-1.17r1.jar spigot-1.12r1.jar spigot-1.16r2.jar spigot-1.8r1.j
|
||||
ar
|
||||
|
Reference in New Issue
Block a user