2.6.10_Snapshot-1
This commit is contained in:
parent
ff2cb3ce96
commit
8a0cb4c45a
@ -6,7 +6,11 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>CommandGUI_V2</artifactId>
|
<artifactId>CommandGUI_V2</artifactId>
|
||||||
|
<<<<<<< Updated upstream
|
||||||
<version>2.6.1</version>
|
<version>2.6.1</version>
|
||||||
|
=======
|
||||||
|
<version>2.6.10_Snapshot-1</version>
|
||||||
|
>>>>>>> Stashed changes
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>CommandGUI</name>
|
<name>CommandGUI</name>
|
||||||
@ -65,6 +69,10 @@
|
|||||||
<id>T2Code</id>
|
<id>T2Code</id>
|
||||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>placeholderapi</id>
|
||||||
|
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
@ -89,91 +97,16 @@
|
|||||||
<artifactId>LuckyBox-API</artifactId>
|
<artifactId>LuckyBox-API</artifactId>
|
||||||
<version>4.2.2</version>
|
<version>4.2.2</version>
|
||||||
</dependency>
|
</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>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.18r1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_17.r1</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.17r1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_16.r3</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.16r3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code.minecraft.1_16.r2</groupId>
|
<groupId>net.t2code.minecraft.1_16.r2</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.16r2</version>
|
<version>1.16r2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_16.r1</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.16r1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_15.r1</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.15r1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_14.r1</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.14r1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_13.r2</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.13r2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_13.r1</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.13r1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_12.r1</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.12r1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_11.r1</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.11r1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code.minecraft.1_10.r1</groupId>
|
<groupId>net.t2code.minecraft.1_10.r1</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.10r1</version>
|
<version>1.10r1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_9.r2</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.9r2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_9.r1</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.9r1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_8.r3</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.8r3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.t2code.minecraft.1_8.r2</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.8r2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code.minecraft.1_8.r1</groupId>
|
<groupId>net.t2code.minecraft.1_8.r1</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
@ -182,7 +115,23 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zaxxer</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
<artifactId>HikariCP</artifactId>
|
<artifactId>HikariCP</artifactId>
|
||||||
<version>3.4.5</version>
|
<version>4.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.clip</groupId>
|
||||||
|
<artifactId>placeholderapi</artifactId>
|
||||||
|
<version>2.11.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
|
<version>1.7.10</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>1.7.22</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -22,7 +22,7 @@ public class ConfigChat implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
for (Object gui : Main.guiHashMap.values()) {
|
for (Object gui : Main.guiHashMap.values()) {
|
||||||
for (Slot slot : gui.GUI_Slots) {
|
for (Slot slot : gui.GUI_Slots) {
|
||||||
if (slot.ConfigOptionPath.equals(EditChat.get(player))) {
|
if (slot.configOptionPath.equals(EditChat.get(player))) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.Listener;
|
package de.jatitv.commandguiv2.Spigot.Listener;
|
||||||
|
|
||||||
|
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||||
import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
|
import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
|
||||||
|
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import de.jatitv.commandguiv2.Spigot.system.Bungee_Sender_Reciver;
|
import de.jatitv.commandguiv2.Spigot.system.Bungee_Sender_Reciver;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||||
@ -36,6 +38,7 @@ public class GUI_Listener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent e) {
|
public void onInventoryClick(InventoryClickEvent e) {
|
||||||
Player player = (Player) e.getWhoClicked();
|
Player player = (Player) e.getWhoClicked();
|
||||||
|
<<<<<<< Updated upstream
|
||||||
if (e.getInventory() != null && e.getCurrentItem() != null) {
|
if (e.getInventory() != null && e.getCurrentItem() != null) {
|
||||||
for (Object gui : Main.guiHashMap.values()) {
|
for (Object gui : Main.guiHashMap.values()) {
|
||||||
if (player.getOpenInventory().getTitle().equals(Replace.replace(prefix, GUICode + gui.GUI_Name))
|
if (player.getOpenInventory().getTitle().equals(Replace.replace(prefix, GUICode + gui.GUI_Name))
|
||||||
@ -139,6 +142,146 @@ public class GUI_Listener implements Listener {
|
|||||||
if (slot.SetConfigEnable) {
|
if (slot.SetConfigEnable) {
|
||||||
File config = new File(slot.ConfigFilePath);
|
File config = new File(slot.ConfigFilePath);
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
=======
|
||||||
|
JavaPlugin plugin = Main.plugin;
|
||||||
|
if (e.getInventory() == null) return;
|
||||||
|
if (e.getCurrentItem() == null) return;
|
||||||
|
for (Object gui : Main.guiHashMap.values()) {
|
||||||
|
if (player.getOpenInventory().getTitle().equals(Replace.replace(prefix, GUICode + gui.GUI_Name))
|
||||||
|
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(Replace.replace(prefix, player, GUICode + gui.GUI_Name)))) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
for (Slot slot : gui.GUI_Slots) {
|
||||||
|
if (e.getSlot() != slot.slot) continue;
|
||||||
|
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == ItemVersion.getGreenWool().getType() || e.getCurrentItem().getType() == ItemVersion.getRedWool().getType() || e.getCurrentItem().getType() == Material.valueOf(slot.item.toUpperCase().replace(".", "_"))) {
|
||||||
|
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) continue;
|
||||||
|
if (!e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, slot.name))) continue;
|
||||||
|
if (slot.cost_Enable) {
|
||||||
|
if (slot.command_Enable || slot.message_Enable || slot.openGUI_Enable || slot.serverChange) {
|
||||||
|
if (!Vault.buy(prefix, player, slot.price)) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
player.closeInventory();
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 1L);
|
||||||
|
player.sendMessage(SelectMessages.No_money);
|
||||||
|
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable)
|
||||||
|
player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1);
|
||||||
|
} else {
|
||||||
|
player.sendMessage(SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, slot.name))
|
||||||
|
.replace("[price]", slot.price + " " + SelectConfig.Currency));
|
||||||
|
execute(slot, player, e, gui);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else execute(slot, player, e, gui);
|
||||||
|
} else player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, slot.name))
|
||||||
|
.replace("[perm]", "commandgui.gui." + gui.Command_Command + ".slot." + (slot.slot + 1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void execute(Slot slot, Player player, InventoryClickEvent e, Object gui) {
|
||||||
|
if (slot.togglePermission) togglePerm(slot, player);
|
||||||
|
if (slot.toggleUseItem) toggleUseItem(player);
|
||||||
|
if (slot.command_Enable) command(slot, player);
|
||||||
|
if (slot.openGUI_Enable) openGUI(slot, player);
|
||||||
|
if (slot.message_Enable) message(slot, player);
|
||||||
|
if (slot.serverChange) serverChange(slot, player);
|
||||||
|
if (slot.setConfigEnable) setConfig(slot, player, e);
|
||||||
|
if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) sound(slot, player, gui);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void command(Slot slot, Player player) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
player.closeInventory();
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 1L);
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (slot.command_BungeeCommand) {
|
||||||
|
if (SelectConfig.Bungee) {
|
||||||
|
for (String cmd : slot.command) {
|
||||||
|
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.");
|
||||||
|
send.player(player, prefix + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (String cmd : slot.command) {
|
||||||
|
if (slot.commandAsConsole) {
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
|
||||||
|
} else player.chat("/" + cmd.replace("[player]", player.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 2L);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void openGUI(Slot slot, Player player) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
player.closeInventory();
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 1L);
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
OpenGUI.openGUI(player, Main.guiHashMap.get(slot.openGUI), slot.openGUI);
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 2L);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void message(Slot slot, Player player) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
player.closeInventory();
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 1L);
|
||||||
|
for (String msg : slot.message) {
|
||||||
|
if (Main.PaPi) {
|
||||||
|
if (slot.cost_Enable) {
|
||||||
|
player.sendMessage(Replace.replacePrice(prefix, player, msg, slot.price + " " + SelectConfig.Currency));
|
||||||
|
} else player.sendMessage(Replace.replace(prefix, player, msg.replace("[prefix]", prefix)));
|
||||||
|
} else {
|
||||||
|
if (slot.cost_Enable) {
|
||||||
|
player.sendMessage(Replace.replacePrice(prefix, msg, slot.price + " " + SelectConfig.Currency));
|
||||||
|
} else player.sendMessage(Replace.replace(prefix, msg.replace("[prefix]", prefix)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void serverChange(Slot slot, Player player) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
player.closeInventory();
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 1L);
|
||||||
|
send.player(player, SelectMessages.onServerChange.replace("[server]", slot.serverChangeServer));
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
ServerChange.send(player, slot.serverChangeServer);
|
||||||
|
}
|
||||||
|
}.runTaskLater(Main.plugin, 20L);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setConfig(Slot slot, Player player, InventoryClickEvent e) {
|
||||||
|
File config = new File(slot.configFilePath);
|
||||||
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
>>>>>>> Stashed changes
|
||||||
/*if (slot.ConfigChatInput){
|
/*if (slot.ConfigChatInput){
|
||||||
ConfigChat.EditChat.put(player, slot.ConfigOptionPath);
|
ConfigChat.EditChat.put(player, slot.ConfigOptionPath);
|
||||||
player.sendMessage(DefaultValue.SettingsGUIchatSet.replace("[setting]", "Shop Name Chest small"));
|
player.sendMessage(DefaultValue.SettingsGUIchatSet.replace("[setting]", "Shop Name Chest small"));
|
||||||
@ -146,6 +289,7 @@ public class GUI_Listener implements Listener {
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< Updated upstream
|
||||||
if (e.getClick() == ClickType.LEFT) {
|
if (e.getClick() == ClickType.LEFT) {
|
||||||
if (slot.ConfigOptionPremat.equals("String")) {
|
if (slot.ConfigOptionPremat.equals("String")) {
|
||||||
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueLeft);
|
yamlConfiguration.set(slot.ConfigOptionPath.replace("/", "."), slot.ConfigStringValueLeft);
|
||||||
@ -388,10 +532,81 @@ public class GUI_Listener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
if (e.getClick() == ClickType.LEFT) {
|
||||||
|
if (slot.configOptionPremat.equals("String")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueLeft);
|
||||||
|
} else if (slot.configOptionPremat.equals("Boolean")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueLeft);
|
||||||
|
} else if (slot.configOptionPremat.equals("Integer")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueLeft);
|
||||||
|
} else if (slot.configOptionPremat.equals("Double")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueLeft);
|
||||||
|
} else if (slot.configOptionPremat.equals("List")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueLeft);
|
||||||
|
} else {
|
||||||
|
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (e.getClick() == ClickType.RIGHT) {
|
||||||
|
if (slot.configOptionPremat.equals("String")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueRight);
|
||||||
|
} else if (slot.configOptionPremat.equals("Boolean")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueRight);
|
||||||
|
} else if (slot.configOptionPremat.equals("Integer")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueRight);
|
||||||
|
} else if (slot.configOptionPremat.equals("Double")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueRight);
|
||||||
|
} else if (slot.configOptionPremat.equals("List")) {
|
||||||
|
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueRight);
|
||||||
|
} else {
|
||||||
|
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(config);
|
||||||
|
} catch (IOException tac) {
|
||||||
|
tac.printStackTrace();
|
||||||
|
}
|
||||||
|
if (slot.pluginReloadEnable) {
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), slot.pluginReloadCommand);
|
||||||
|
}
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
player.closeInventory();
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 1L);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void sound(Slot slot, Player player, Object gui) {
|
||||||
|
if (slot.customSound_Enable) {
|
||||||
|
if (!slot.customSound_NoSound) {
|
||||||
|
try {
|
||||||
|
player.playSound(player.getLocation(), Sound.valueOf(slot.customSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
|
||||||
|
|
||||||
|
} catch (Exception e1) {
|
||||||
|
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
|
||||||
|
.replace("[sound]", "§6GUI: §e" + Replace.replace(prefix, gui.GUI_Name) + "§r §6Slot: §e" + slot.slot + " §6CustomSound: §9" + slot.customSound_Sound));
|
||||||
|
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
|
||||||
|
>>>>>>> Stashed changes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void togglePerm(Slot slot, Player player) {
|
||||||
|
if (player.hasPermission(slot.togglePermissionPerm)) {
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.togglePermFalse.replace("[player]", player.getName()).replace("[perm]", slot.togglePermissionPerm));
|
||||||
|
} else
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.togglePermTrue.replace("[player]", player.getName()).replace("[perm]", slot.togglePermissionPerm));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void toggleUseItem(Player player) {
|
||||||
|
if (Events.useItemHashMap.get(player)) {
|
||||||
|
Commands.itemOff(player);
|
||||||
|
} else Commands.itemOn(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.Listener;
|
package de.jatitv.commandguiv2.Spigot.Listener;
|
||||||
|
|
||||||
|
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.system.Give_UseItem;
|
import de.jatitv.commandguiv2.Spigot.system.Give_UseItem;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
@ -17,10 +18,10 @@ public class ItemChange {
|
|||||||
if (SelectConfig.UseItem_InventorySlotEnforce) {
|
if (SelectConfig.UseItem_InventorySlotEnforce) {
|
||||||
slot = SelectConfig.UseItem_InventorySlot;
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
} else {
|
} else {
|
||||||
if (Select_Database.selectSlot(player) == null) {
|
if (Events.useItemSlotHashMap.get(player) == null) {
|
||||||
slot = SelectConfig.UseItem_InventorySlot;
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
} else {
|
} else {
|
||||||
slot = Select_Database.selectSlot(player);
|
slot = Events.useItemSlotHashMap.get(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ public class ItemChange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
|
if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
|
||||||
if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
if (!SelectConfig.UseItem_AllowToggle || Events.useItemHashMap.get(player)) {
|
||||||
if (!player.hasPlayedBefore()) {
|
if (!player.hasPlayedBefore()) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -79,7 +80,7 @@ public class ItemChange {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
removeItem(player);
|
removeItem(player);
|
||||||
if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
if (!SelectConfig.UseItem_AllowToggle || Events.useItemHashMap.get(player)) {
|
||||||
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
|
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
|
||||||
send.debug(Main.plugin,"Give: " +player.getName());
|
send.debug(Main.plugin,"Give: " +player.getName());
|
||||||
Give_UseItem.onGive(player);
|
Give_UseItem.onGive(player);
|
||||||
|
@ -2,15 +2,18 @@ package de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener;
|
|||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Listener.ItemChange;
|
import de.jatitv.commandguiv2.Spigot.Listener.ItemChange;
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
|
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
|
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
|
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
|
||||||
|
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||||
import de.jatitv.commandguiv2.api.CGuiAPI;
|
import de.jatitv.commandguiv2.api.CGuiAPI;
|
||||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||||
|
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -27,12 +30,21 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class Events implements Listener {
|
public class Events implements Listener {
|
||||||
|
|
||||||
|
public static HashMap<Player, Boolean> useItemHashMap = new HashMap<>();
|
||||||
|
public static HashMap<Player, Integer> useItemSlotHashMap = new HashMap<>();
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
|
if (Select_Database.selectItemStatus(e.getPlayer())){
|
||||||
|
useItemHashMap.put(e.getPlayer(), true);
|
||||||
|
} else useItemHashMap.put(e.getPlayer(), false);
|
||||||
|
|
||||||
|
useItemSlotHashMap.put(e.getPlayer(),Select_Database.selectSlot(e.getPlayer()));
|
||||||
|
|
||||||
if (CGuiAPI.JoinDisable) {
|
if (CGuiAPI.JoinDisable) {
|
||||||
send.debug(Main.plugin,"JoinDisable");
|
send.debug(Main.plugin,"JoinDisable");
|
||||||
return;
|
return;
|
||||||
@ -48,6 +60,11 @@ public class Events implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onJoin(PlayerQuitEvent e) {
|
||||||
|
useItemHashMap.remove(e.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
@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();
|
||||||
@ -279,7 +296,7 @@ public class Events implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean legacy() {
|
private static boolean legacy() {
|
||||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15) {
|
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15|| NMSVersion.v1_16_R1) {
|
||||||
return true;
|
return true;
|
||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.Objekte;
|
package de.jatitv.commandguiv2.Spigot.Objekte;
|
||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUI;
|
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_GUITab;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ public class Obj_Select {
|
|||||||
yamlConfiguration_gui.getString("Slots." + key + ".Item.PlayerHead.PlayerName"),
|
yamlConfiguration_gui.getString("Slots." + key + ".Item.PlayerHead.PlayerName"),
|
||||||
yamlConfiguration_gui.getString("Slots." + key + ".Item.Material"),
|
yamlConfiguration_gui.getString("Slots." + key + ".Item.Material"),
|
||||||
yamlConfiguration_gui.getString("Slots." + key + ".Item.Name"),
|
yamlConfiguration_gui.getString("Slots." + key + ".Item.Name"),
|
||||||
yamlConfiguration_gui.getList("Slots." + key + ".Item.Lore"),
|
yamlConfiguration_gui.getStringList("Slots." + key + ".Item.Lore"),
|
||||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".CustomSound.Enable"),
|
yamlConfiguration_gui.getBoolean("Slots." + key + ".CustomSound.Enable"),
|
||||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".CustomSound.NoSound"),
|
yamlConfiguration_gui.getBoolean("Slots." + key + ".CustomSound.NoSound"),
|
||||||
yamlConfiguration_gui.getString("Slots." + key + ".CustomSound.Sound"),
|
yamlConfiguration_gui.getString("Slots." + key + ".CustomSound.Sound"),
|
||||||
@ -69,6 +68,9 @@ public class Obj_Select {
|
|||||||
yamlConfiguration_gui.getString("Slots." + key + ".ServerChange.Server"),
|
yamlConfiguration_gui.getString("Slots." + key + ".ServerChange.Server"),
|
||||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".OpenGUI.Enable"),
|
yamlConfiguration_gui.getBoolean("Slots." + key + ".OpenGUI.Enable"),
|
||||||
yamlConfiguration_gui.getString("Slots." + key + ".OpenGUI.GUI"),
|
yamlConfiguration_gui.getString("Slots." + key + ".OpenGUI.GUI"),
|
||||||
|
yamlConfiguration_gui.getBoolean("Slots." + key + ".Toggle.Permission.Enable"),
|
||||||
|
yamlConfiguration_gui.getString("Slots." + key + ".Toggle.Permission.Permission"),
|
||||||
|
yamlConfiguration_gui.getBoolean("Slots." + key + ".Toggle.UseItem.Enable"),
|
||||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Message.Enable"),
|
yamlConfiguration_gui.getBoolean("Slots." + key + ".Message.Enable"),
|
||||||
yamlConfiguration_gui.getStringList("Slots." + key + ".Message.Message"),
|
yamlConfiguration_gui.getStringList("Slots." + key + ".Message.Message"),
|
||||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".Permission.Required"),
|
yamlConfiguration_gui.getBoolean("Slots." + key + ".Permission.Required"),
|
||||||
@ -99,7 +101,7 @@ public class Obj_Select {
|
|||||||
config_gui.getName().replace(".yml", ""), Command_Alias_Enable, Command_Permission, slots);
|
config_gui.getName().replace(".yml", ""), Command_Alias_Enable, Command_Permission, slots);
|
||||||
|
|
||||||
Main.guiHashMap.put(config_gui.getName().replace(".yml", ""), objekt);
|
Main.guiHashMap.put(config_gui.getName().replace(".yml", ""), objekt);
|
||||||
CmdExecuter_GUI.arg1.put(config_gui.getName().replace(".yml", ""), "commandgui.gui." + config_gui.getName().replace(".yml", ""));
|
CmdExecuter_GUITab.arg1.put(config_gui.getName().replace(".yml", ""), "commandgui.gui." + config_gui.getName().replace(".yml", ""));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yamlConfiguration_gui.save(config_gui);
|
yamlConfiguration_gui.save(config_gui);
|
||||||
|
@ -4,155 +4,163 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Slot {
|
public class Slot {
|
||||||
|
|
||||||
public Integer Slot;
|
public Integer slot;
|
||||||
public Boolean Enable;
|
public Boolean enable;
|
||||||
// public Boolean ItemsRemovable;
|
// public Boolean ItemsRemovable;
|
||||||
public Boolean Empty;
|
public Boolean empty;
|
||||||
public Integer ItemAmount;
|
public Integer itemAmount;
|
||||||
public Boolean PlayerHead_Enable;
|
public Boolean playerHead_Enable;
|
||||||
public Boolean Base64_Enable;
|
public Boolean base64_Enable;
|
||||||
public String Base64Value;
|
public String base64Value;
|
||||||
public Boolean PlayerWhoHasOpenedTheGUI;
|
public Boolean playerWhoHasOpenedTheGUI;
|
||||||
public String PlayerName;
|
public String playerName;
|
||||||
public String Item;
|
public String item;
|
||||||
public String Name;
|
public String name;
|
||||||
public List Lore;
|
public List lore;
|
||||||
public Boolean CustomSound_Enable;
|
public Boolean customSound_Enable;
|
||||||
public Boolean CustomSound_NoSound;
|
public Boolean customSound_NoSound;
|
||||||
public String CustomSound_Sound;
|
public String customSound_Sound;
|
||||||
public Boolean Cost_Enable;
|
public Boolean cost_Enable;
|
||||||
public Double Price;
|
public Double price;
|
||||||
public Boolean Command_Enable;
|
public Boolean command_Enable;
|
||||||
public Boolean Command_BungeeCommand;
|
public Boolean command_BungeeCommand;
|
||||||
public Boolean CommandAsConsole;
|
public Boolean commandAsConsole;
|
||||||
public Boolean ServerChange;
|
public Boolean serverChange;
|
||||||
public String ServerChangeServer;
|
public String serverChangeServer;
|
||||||
public List<String> Command;
|
public List<String> command;
|
||||||
public Boolean OpenGUI_Enable;
|
public Boolean openGUI_Enable;
|
||||||
public String OpenGUI;
|
public String openGUI;
|
||||||
public Boolean Message_Enable;
|
public Boolean togglePermission;
|
||||||
public List<String> Message;
|
public String togglePermissionPerm;
|
||||||
public Boolean Perm;
|
public Boolean toggleUseItem;
|
||||||
public Boolean SetConfigEnable;
|
public Boolean message_Enable;
|
||||||
public String ConfigFilePath;
|
public List<String> message;
|
||||||
public String ConfigOptionPath;
|
public Boolean perm;
|
||||||
public String ConfigOptionPremat;
|
public Boolean setConfigEnable;
|
||||||
|
public String configFilePath;
|
||||||
|
public String configOptionPath;
|
||||||
|
public String configOptionPremat;
|
||||||
// public Boolean ConfigChatInput;
|
// public Boolean ConfigChatInput;
|
||||||
|
|
||||||
public String ConfigStringValueLeft;
|
public String configStringValueLeft;
|
||||||
public Boolean ConfigBooleanValueLeft;
|
public Boolean configBooleanValueLeft;
|
||||||
public Integer ConfigIntegerValueLeft;
|
public Integer configIntegerValueLeft;
|
||||||
public Double ConfigDoubleValueLeft;
|
public Double configDoubleValueLeft;
|
||||||
public List<String> ConfigListValueLeft;
|
public List<String> configListValueLeft;
|
||||||
|
|
||||||
public String ConfigStringValueRight;
|
public String configStringValueRight;
|
||||||
public Boolean ConfigBooleanValueRight;
|
public Boolean configBooleanValueRight;
|
||||||
public Integer ConfigIntegerValueRight;
|
public Integer configIntegerValueRight;
|
||||||
public Double ConfigDoubleValueRight;
|
public Double configDoubleValueRight;
|
||||||
public List<String> ConfigListValueRight;
|
public List<String> configListValueRight;
|
||||||
|
|
||||||
|
|
||||||
public Boolean PluginReloadEnable;
|
public Boolean pluginReloadEnable;
|
||||||
public String PluginReloadCommand;
|
public String pluginReloadCommand;
|
||||||
|
|
||||||
public Slot(Integer Slot,
|
public Slot(Integer slot,
|
||||||
Boolean Enable,
|
Boolean enable,
|
||||||
// Boolean ItemsRemovable,
|
// Boolean ItemsRemovable,
|
||||||
Boolean Empty,
|
Boolean empty,
|
||||||
Integer ItemAmount,
|
Integer itemAmount,
|
||||||
Boolean PlayerHead_Enable,
|
Boolean playerHead_Enable,
|
||||||
Boolean Base64Value_Enable,
|
Boolean base64Value_Enable,
|
||||||
String Base64Value,
|
String base64Value,
|
||||||
Boolean PlayerWhoHasOpenedTheGUI,
|
Boolean playerWhoHasOpenedTheGUI,
|
||||||
String PlayerName,
|
String playerName,
|
||||||
String Item,
|
String item,
|
||||||
String Name,
|
String name,
|
||||||
List Lore,
|
List<String> lore,
|
||||||
Boolean CustomSound_Enable,
|
Boolean customSound_Enable,
|
||||||
Boolean CustomSound_NoSound,
|
Boolean customSound_NoSound,
|
||||||
String CustomSound_Sound,
|
String customSound_Sound,
|
||||||
Boolean Cost_Enable,
|
Boolean cost_Enable,
|
||||||
Double Price,
|
Double price,
|
||||||
Boolean Command_Enable,
|
Boolean command_Enable,
|
||||||
Boolean Command_BungeeCommand,
|
Boolean command_BungeeCommand,
|
||||||
Boolean CommandAsConsole,
|
Boolean commandAsConsole,
|
||||||
List<String> Command,
|
List<String> command,
|
||||||
Boolean ServerChange,
|
Boolean serverChange,
|
||||||
String ServerChangeServer,
|
String serverChangeServer,
|
||||||
Boolean OpenGUI_Enable,
|
Boolean openGUI_Enable,
|
||||||
String OpenGUI,
|
String openGUI,
|
||||||
Boolean Message_Enable,
|
Boolean togglePermission,
|
||||||
List<String> Message,
|
String togglePermissionPerm,
|
||||||
Boolean Perm,
|
Boolean toggleUseItem,
|
||||||
Boolean SetConfigEnable,
|
Boolean message_Enable,
|
||||||
String ConfigFilePath,
|
List<String> message,
|
||||||
String ConfigOptionPath,
|
Boolean perm,
|
||||||
String ConfigOptionPremat,
|
Boolean setConfigEnable,
|
||||||
// Boolean ConfigChatInput,
|
String configFilePath,
|
||||||
|
String configOptionPath,
|
||||||
|
String configOptionPremat,
|
||||||
|
|
||||||
String ConfigStringValueLeft,
|
String configStringValueLeft,
|
||||||
Boolean ConfigBooleanValueLeft,
|
Boolean configBooleanValueLeft,
|
||||||
Integer ConfigIntegerValueLeft,
|
Integer configIntegerValueLeft,
|
||||||
Double ConfigDoubleValueLeft,
|
Double configDoubleValueLeft,
|
||||||
List<String> ConfigListValueLeft,
|
List<String> configListValueLeft,
|
||||||
|
|
||||||
String ConfigStringValueRight,
|
String configStringValueRight,
|
||||||
Boolean ConfigBooleanValueRight,
|
Boolean configBooleanValueRight,
|
||||||
Integer ConfigIntegerValueRight,
|
Integer configIntegerValueRight,
|
||||||
Double ConfigDoubleValueRight,
|
Double configDoubleValueRight,
|
||||||
List<String> ConfigListValueRight,
|
List<String> configListValueRight,
|
||||||
|
|
||||||
Boolean PluginReloadEnable,
|
Boolean pluginReloadEnable,
|
||||||
String PluginReloadCommand) {
|
String pluginReloadCommand) {
|
||||||
this.Slot = Slot;
|
this.slot = slot;
|
||||||
this.Enable = Enable;
|
this.enable = enable;
|
||||||
// this.ItemsRemovable = ItemsRemovable;
|
// this.ItemsRemovable = ItemsRemovable;
|
||||||
this.Empty = Empty;
|
this.empty = empty;
|
||||||
this.ItemAmount = ItemAmount;
|
this.itemAmount = itemAmount;
|
||||||
this.PlayerHead_Enable = PlayerHead_Enable;
|
this.playerHead_Enable = playerHead_Enable;
|
||||||
this.Base64_Enable = Base64Value_Enable;
|
this.base64_Enable = base64Value_Enable;
|
||||||
this.Base64Value = Base64Value;
|
this.base64Value = base64Value;
|
||||||
this.PlayerWhoHasOpenedTheGUI = PlayerWhoHasOpenedTheGUI;
|
this.playerWhoHasOpenedTheGUI = playerWhoHasOpenedTheGUI;
|
||||||
this.PlayerName = PlayerName;
|
this.playerName = playerName;
|
||||||
this.Item = Item;
|
this.item = item;
|
||||||
this.Name = Name;
|
this.name = name;
|
||||||
this.Lore = Lore;
|
this.lore = lore;
|
||||||
this.CustomSound_Enable = CustomSound_Enable;
|
this.customSound_Enable = customSound_Enable;
|
||||||
this.CustomSound_NoSound = CustomSound_NoSound;
|
this.customSound_NoSound = customSound_NoSound;
|
||||||
this.CustomSound_Sound = CustomSound_Sound;
|
this.customSound_Sound = customSound_Sound;
|
||||||
this.Cost_Enable = Cost_Enable;
|
this.cost_Enable = cost_Enable;
|
||||||
this.Price = Price;
|
this.price = price;
|
||||||
this.Command_Enable = Command_Enable;
|
this.command_Enable = command_Enable;
|
||||||
this.Command_BungeeCommand = Command_BungeeCommand;
|
this.command_BungeeCommand = command_BungeeCommand;
|
||||||
this.CommandAsConsole = CommandAsConsole;
|
this.commandAsConsole = commandAsConsole;
|
||||||
this.Command = Command;
|
this.command = command;
|
||||||
this.ServerChange = ServerChange;
|
this.serverChange = serverChange;
|
||||||
this.ServerChangeServer = ServerChangeServer;
|
this.serverChangeServer = serverChangeServer;
|
||||||
this.OpenGUI_Enable = OpenGUI_Enable;
|
this.openGUI_Enable = openGUI_Enable;
|
||||||
this.OpenGUI = OpenGUI;
|
this.openGUI = openGUI;
|
||||||
this.Message_Enable = Message_Enable;
|
this.togglePermission = togglePermission;
|
||||||
this.Message = Message;
|
this.togglePermissionPerm = togglePermissionPerm;
|
||||||
this.Perm = Perm;
|
this.toggleUseItem = toggleUseItem;
|
||||||
this.SetConfigEnable = SetConfigEnable;
|
this.message_Enable = message_Enable;
|
||||||
this.ConfigFilePath = ConfigFilePath;
|
this.message = message;
|
||||||
this.ConfigOptionPath = ConfigOptionPath;
|
this.perm = perm;
|
||||||
this.ConfigOptionPremat = ConfigOptionPremat;
|
this.setConfigEnable = setConfigEnable;
|
||||||
|
this.configFilePath = configFilePath;
|
||||||
|
this.configOptionPath = configOptionPath;
|
||||||
|
this.configOptionPremat = configOptionPremat;
|
||||||
// this.ConfigChatInput = ConfigChatInput;
|
// this.ConfigChatInput = ConfigChatInput;
|
||||||
|
|
||||||
this.ConfigStringValueLeft = ConfigStringValueLeft;
|
this.configStringValueLeft = configStringValueLeft;
|
||||||
this.ConfigBooleanValueLeft = ConfigBooleanValueLeft;
|
this.configBooleanValueLeft = configBooleanValueLeft;
|
||||||
this.ConfigIntegerValueLeft = ConfigIntegerValueLeft;
|
this.configIntegerValueLeft = configIntegerValueLeft;
|
||||||
this.ConfigDoubleValueLeft = ConfigDoubleValueLeft;
|
this.configDoubleValueLeft = configDoubleValueLeft;
|
||||||
this.ConfigListValueLeft = ConfigListValueLeft;
|
this.configListValueLeft = configListValueLeft;
|
||||||
|
|
||||||
this.ConfigStringValueRight = ConfigStringValueRight;
|
this.configStringValueRight = configStringValueRight;
|
||||||
this.ConfigBooleanValueRight = ConfigBooleanValueRight;
|
this.configBooleanValueRight = configBooleanValueRight;
|
||||||
this.ConfigIntegerValueRight = ConfigIntegerValueRight;
|
this.configIntegerValueRight = configIntegerValueRight;
|
||||||
this.ConfigDoubleValueRight = ConfigDoubleValueRight;
|
this.configDoubleValueRight = configDoubleValueRight;
|
||||||
this.ConfigListValueRight = ConfigListValueRight;
|
this.configListValueRight = configListValueRight;
|
||||||
|
|
||||||
|
|
||||||
this.PluginReloadEnable = PluginReloadEnable;
|
this.pluginReloadEnable = pluginReloadEnable;
|
||||||
this.PluginReloadCommand = PluginReloadCommand;
|
this.pluginReloadCommand = pluginReloadCommand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,151 +0,0 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
|
||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.system.Debug;
|
|
||||||
import de.jatitv.commandguiv2.Spigot.config.DefaultGUICreate;
|
|
||||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
|
||||||
import de.jatitv.commandguiv2.Util;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.TabCompleter;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CmdExecuter_Admin implements CommandExecutor, TabCompleter {
|
|
||||||
private static String prefix = Util.getPrefix();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
Help.sendHelp(sender, prefix);
|
|
||||||
} else {
|
|
||||||
switch (args[0].toLowerCase()) {
|
|
||||||
case "info":
|
|
||||||
if (sender.hasPermission("commandgui.command.info")) {
|
|
||||||
Commands.info(sender);
|
|
||||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
|
||||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.command.info"));
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "reload":
|
|
||||||
case "rl":
|
|
||||||
if (sender.hasPermission("commandgui.admin")) {
|
|
||||||
Commands.reload(sender);
|
|
||||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
|
||||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
|
||||||
break;
|
|
||||||
case "createdefaultgui":
|
|
||||||
if (sender.hasPermission("commandgui.admin")) {
|
|
||||||
DefaultGUICreate.configCreate();
|
|
||||||
sender.sendMessage(SelectMessages.DefaultGUIcreate.replace("[directory]", Main.getPath() + "/GUIs/default.yml"));
|
|
||||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand
|
|
||||||
.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
|
||||||
break;
|
|
||||||
case "debug":
|
|
||||||
if (sender.hasPermission("commandgui.admin")) {
|
|
||||||
Debug.onDebugFile(sender);
|
|
||||||
/*if (args.length == 2) {
|
|
||||||
if (args[1].equals("config")) {
|
|
||||||
Debug.debugmsg();
|
|
||||||
}
|
|
||||||
if (args[1].equals("2")) {
|
|
||||||
send.debug("2");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
} else Debug.debugmsg();
|
|
||||||
|
|
||||||
*/
|
|
||||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui admin").replace("[perm]", "commandgui.admin"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "give":
|
|
||||||
if (args.length == 2) {
|
|
||||||
if (sender.hasPermission("commandgui.giveitem.other")) {
|
|
||||||
Player target = Bukkit.getPlayer(args[1]);
|
|
||||||
Commands.give(sender, target);
|
|
||||||
} else sender.sendMessage(SelectMessages.NoPermissionForCommand.replace("[cmd]", "/commandgui give")
|
|
||||||
.replace("[perm]", "commandgui.command.give"));
|
|
||||||
} else Help.sendHelp(sender, prefix);
|
|
||||||
break;
|
|
||||||
case "help":
|
|
||||||
default:
|
|
||||||
Help.sendHelp(sender, prefix);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//TabCompleter
|
|
||||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
|
||||||
put("reload", "commandgui.admin");
|
|
||||||
put("rl", "commandgui.admin");
|
|
||||||
put("createdefaultgui", "commandgui.admin");
|
|
||||||
put("give", "commandgui.giveitem.other");
|
|
||||||
put("info", "commandgui.command.info");
|
|
||||||
}};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
|
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
if (sender instanceof Player) {
|
|
||||||
Player p = (Player) sender;
|
|
||||||
if (args.length == 1) {
|
|
||||||
for (String command : arg1.keySet()) {
|
|
||||||
Boolean passend = true;
|
|
||||||
for (int i = 0; i < args[0].length(); i++) {
|
|
||||||
if (args[0].length() >= command.length()) {
|
|
||||||
passend = false;
|
|
||||||
} else {
|
|
||||||
if (args[0].charAt(i) != command.charAt(i)) {
|
|
||||||
passend = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hasPermission(p, arg1.get(command)) && passend) {
|
|
||||||
list.add(command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 2 && args[0].equalsIgnoreCase("give")) {
|
|
||||||
if (sender.hasPermission("commandgui.giveitem.other")) {
|
|
||||||
Iterator var6 = Bukkit.getOnlinePlayers().iterator();
|
|
||||||
|
|
||||||
while (var6.hasNext()) {
|
|
||||||
Player player1 = (Player) var6.next();
|
|
||||||
list.add(player1.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static boolean hasPermission(Player player, String permission) {
|
|
||||||
if (player.isOp()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
String[] Permissions = permission.split(";");
|
|
||||||
for (String perm : Permissions) {
|
|
||||||
if (player.hasPermission(perm)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -17,7 +17,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CmdExecuter_GUI implements CommandExecutor, TabCompleter {
|
public class CmdExecuter_GUITab implements CommandExecutor, TabCompleter {
|
||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,5 +1,6 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
package de.jatitv.commandguiv2.Spigot.cmdManagement;
|
||||||
|
|
||||||
|
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.Objekte.Obj_Select;
|
import de.jatitv.commandguiv2.Spigot.Objekte.Obj_Select;
|
||||||
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
||||||
@ -59,8 +60,8 @@ public class Commands {
|
|||||||
send.console(Util.getPrefix() + " §6Plugin reload...");
|
send.console(Util.getPrefix() + " §6Plugin reload...");
|
||||||
send.console(Util.getPrefix() + "§8-------------------------------");
|
send.console(Util.getPrefix() + "§8-------------------------------");
|
||||||
|
|
||||||
CmdExecuter_GUI.arg1.clear();
|
CmdExecuter_GUITab.arg1.clear();
|
||||||
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");
|
||||||
ConfigCreate.configCreate();
|
ConfigCreate.configCreate();
|
||||||
SelectConfig.onSelect();
|
SelectConfig.onSelect();
|
||||||
Main.plugin.reloadConfig();
|
Main.plugin.reloadConfig();
|
||||||
@ -70,11 +71,13 @@ public class Commands {
|
|||||||
Obj_Select.onSelect();
|
Obj_Select.onSelect();
|
||||||
SelectMessages.onSelect(Util.getPrefix());
|
SelectMessages.onSelect(Util.getPrefix());
|
||||||
SelectConfig.sound(Util.getPrefix());
|
SelectConfig.sound(Util.getPrefix());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AliasRegister.onRegister();
|
AliasRegister.onRegister();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectConfig.Bungee) {
|
if (SelectConfig.Bungee) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "commandgui:bungee");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "commandgui:bungee");
|
||||||
|
|
||||||
@ -120,10 +123,10 @@ public class Commands {
|
|||||||
if (SelectConfig.UseItem_InventorySlotEnforce) {
|
if (SelectConfig.UseItem_InventorySlotEnforce) {
|
||||||
slot = SelectConfig.UseItem_InventorySlot;
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
} else {
|
} else {
|
||||||
if (Select_Database.selectSlot(player) == null) {
|
if (Events.useItemSlotHashMap.get(player) == null) {
|
||||||
slot = SelectConfig.UseItem_InventorySlot;
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
} else {
|
} else {
|
||||||
slot = Select_Database.selectSlot(player);
|
slot = Events.useItemSlotHashMap.get(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
send.debug(Main.plugin, String.valueOf(slot));
|
send.debug(Main.plugin, String.valueOf(slot));
|
||||||
@ -203,7 +206,7 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Select_Database.setSlot(player, setSlot);
|
Select_Database.setSlot(player, setSlot);
|
||||||
if (Select_Database.selectItemStatus(player)) {
|
if (Events.useItemHashMap.get(player)) {
|
||||||
Give_UseItem.onGive(player);
|
Give_UseItem.onGive(player);
|
||||||
}
|
}
|
||||||
send.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
|
send.player(player, SelectMessages.ItemSlot.replace("[slot]", setSlot.toString()));
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.cmdManagement.register;
|
package de.jatitv.commandguiv2.Spigot.cmdManagement.register;
|
||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
|
|
||||||
import de.jatitv.commandguiv2.Util;
|
import de.jatitv.commandguiv2.Util;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandMap;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.eclipse.sisu.space.ClassFinder;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
|
||||||
public class AliasRegister {
|
public class AliasRegister {
|
||||||
@ -25,97 +24,17 @@ public class AliasRegister {
|
|||||||
for (String alias : Main.allAliases) {
|
for (String alias : Main.allAliases) {
|
||||||
if (Main.guiHashMap.get(alias) != null) {
|
if (Main.guiHashMap.get(alias) != null) {
|
||||||
if (Main.guiHashMap.get(alias).Command_Alias_Enable) {
|
if (Main.guiHashMap.get(alias).Command_Alias_Enable) {
|
||||||
String version;
|
try {
|
||||||
if (NMSVersion.v1_8_R1) {
|
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||||
send.debug(plugin, "Alias register 1.8_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_8_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R1.CraftServer) plugin.getServer();
|
bukkitCommandMap.setAccessible(true);
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
||||||
}
|
|
||||||
if (NMSVersion.v1_8_R2) {
|
commandMap.register(alias, new RegisterCommand(alias));
|
||||||
send.debug(plugin, "Alias register 1.8_R2");
|
} catch(Exception e) {
|
||||||
org.bukkit.craftbukkit.v1_8_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R2.CraftServer) plugin.getServer();
|
e.printStackTrace();
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_8_R3) {
|
|
||||||
send.debug(plugin, "Alias register 1.8_R3");
|
|
||||||
org.bukkit.craftbukkit.v1_8_R3.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R3.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_9_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.9_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_9_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_9_R1.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_9_R2) {
|
|
||||||
send.debug(plugin, "Alias register 1.9_R2");
|
|
||||||
org.bukkit.craftbukkit.v1_9_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_9_R2.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_10_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.10_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_10_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_10_R1.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_11_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.11_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_11_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_11_R1.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_12_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.12_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_12_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_12_R1.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_13_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.13_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_13_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_13_R1.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_13_R2) {
|
|
||||||
send.debug(plugin, "Alias register 1.13_R2");
|
|
||||||
org.bukkit.craftbukkit.v1_13_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_13_R2.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_14_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.14_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_14_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_14_R1.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_15_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.15_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_15_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_15_R1.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_16_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.16_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_16_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R1.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_16_R2) {
|
|
||||||
send.debug(plugin, "Alias register 1.16_R2");
|
|
||||||
org.bukkit.craftbukkit.v1_16_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R2.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_16_R3) {
|
|
||||||
send.debug(plugin, "Alias register 1.16_R3");
|
|
||||||
org.bukkit.craftbukkit.v1_16_R3.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R3.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_17_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.17_R1");
|
|
||||||
org.bukkit.craftbukkit.v1_17_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_17_R1.CraftServer) plugin.getServer();
|
|
||||||
craftServer.getCommandMap().register(alias, new RegisterCommand(alias));
|
|
||||||
}
|
|
||||||
if (NMSVersion.v1_18_R1) {
|
|
||||||
send.debug(plugin, "Alias register 1.18_R1");
|
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
//Register.register(alias, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,150 +12,144 @@ import java.util.List;
|
|||||||
|
|
||||||
|
|
||||||
public class DefaultGUICreate {
|
public class DefaultGUICreate {
|
||||||
|
|
||||||
private static Boolean GUI_Enable = true;
|
|
||||||
private static Integer GUI_Lines = 1;
|
|
||||||
private static String GUI_Name = "&5default &9GUI";
|
|
||||||
private static Boolean GUI_FillItem_Enable = true;
|
|
||||||
private static Integer GUI_FillItem_Item_1_8 = 15;
|
|
||||||
private static String GUI_FillItem_Item = "BLACK_STAINED_GLASS_PANE";
|
|
||||||
|
|
||||||
private static Boolean Command_Alias = true;
|
|
||||||
private static Boolean Command_Permission = true;
|
|
||||||
|
|
||||||
private static Integer slot = 5;
|
|
||||||
private static Boolean enable = true;
|
|
||||||
private static Boolean ItemEmty = false;
|
|
||||||
private static Integer ItemAmout = 1;
|
|
||||||
private static Boolean Playerhead_enable = true;
|
|
||||||
private static Boolean base64_Enable = true;
|
|
||||||
private static String base64value = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19";
|
|
||||||
private static Boolean PlayerWhoHasOpenedTheGUI = false;
|
|
||||||
private static String PlayerName = "";
|
|
||||||
private static String Item = "";
|
|
||||||
private static String Itemname = "&3Support Discord";
|
|
||||||
private static List ItemLore = 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");
|
|
||||||
private static Boolean CustomSound = false;
|
|
||||||
private static Boolean CustomSound_NoSound = false;
|
|
||||||
private static String CustomSound_Sound = "";
|
|
||||||
private static Boolean Cost = false;
|
|
||||||
private static Double Cost_Price = 0.0;
|
|
||||||
private static Boolean Command = false;
|
|
||||||
private static Boolean BungeeCommand = false;
|
|
||||||
private static Boolean CommandAsConsole = false;
|
|
||||||
private static List Commands = Arrays.asList();
|
|
||||||
private static Boolean Server_Change = false;
|
|
||||||
private static String Server_Change_Server = "";
|
|
||||||
private static Boolean OpenGUI = false;
|
|
||||||
private static String OpenGUI_GUI = "";
|
|
||||||
private static Boolean Message = true;
|
|
||||||
private static List Messages = Arrays.asList("&6You can find more information on Discord: &ehttp://dc.t2code.net");
|
|
||||||
private static Boolean Permission = false;
|
|
||||||
|
|
||||||
private static Boolean SetConfig_Enable = false;
|
|
||||||
private static String SetConfig_FilePath = "";
|
|
||||||
private static String SetConfig_OptionPath = "";
|
|
||||||
private static String SetConfig_OptionPremat = "String";
|
|
||||||
|
|
||||||
private static String SetConfig_ValueLeftString = "";
|
|
||||||
private static Boolean SetConfig_ValueLeftBoolean = false;
|
|
||||||
private static Integer SetConfig_ValueLeftInteger = 0;
|
|
||||||
private static Double SetConfig_ValueLeftDouble = 0.0;
|
|
||||||
private static List SetConfig_ValueLeftList = Arrays.asList();
|
|
||||||
|
|
||||||
private static String SetConfig_ValueRightString = "";
|
|
||||||
private static Boolean SetConfig_ValueRightBoolean = false;
|
|
||||||
private static Integer SetConfig_ValueRightInteger = 0;
|
|
||||||
private static Double SetConfig_ValueRightDouble = 0.0;
|
|
||||||
private static List SetConfig_ValueRightList = Arrays.asList();
|
|
||||||
|
|
||||||
private static Boolean SetConfig_PluginReloadEnable = false;
|
|
||||||
private static String SetConfig_PluginReloadCommand = "";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void configCreate() {
|
public static void configCreate() {
|
||||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||||
send.console(Main.prefix + " §4Default GUI file (GUIs/default.yml) is loaded...");
|
send.console(Main.prefix + " §4Default GUI file (GUIs/default.yml) is loaded...");
|
||||||
File config = new File(Main.getPath(), "GUIs/default.yml");
|
File config = new File(Main.getPath(), "GUIs/default.yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
set("GUI.Enable", GUI_Enable, yamlConfiguration);
|
set("GUI.Enable", true, yamlConfiguration);
|
||||||
set("GUI.Lines", GUI_Lines, yamlConfiguration);
|
set("GUI.Lines", 1, yamlConfiguration);
|
||||||
set("GUI.Name", GUI_Name, yamlConfiguration);
|
set("GUI.Name", "&5default &9GUI", yamlConfiguration);
|
||||||
set("GUI.FillItem.Enable", GUI_FillItem_Enable, yamlConfiguration);
|
set("GUI.FillItem.Enable", true, yamlConfiguration);
|
||||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||||
set("GUI.FillItem.GlassPaneCollor", GUI_FillItem_Item_1_8, yamlConfiguration);
|
set("GUI.FillItem.GlassPaneCollor", 15, yamlConfiguration);
|
||||||
} else set("GUI.FillItem.Item", GUI_FillItem_Item, yamlConfiguration);
|
} else set("GUI.FillItem.Item", "BLACK_STAINED_GLASS_PANE", yamlConfiguration);
|
||||||
|
|
||||||
set("Command.Alias", Command_Alias, yamlConfiguration);
|
set("Command.Alias", true, yamlConfiguration);
|
||||||
set("Command.Permission.Required", Command_Permission, yamlConfiguration);
|
set("Command.Permission.Required", true, yamlConfiguration);
|
||||||
set("Slots.Example.Slot", slot, yamlConfiguration);
|
set("Slots.SupportDiscord.Slot", 4, yamlConfiguration);
|
||||||
set("Slots.Example.Enable", enable, yamlConfiguration);
|
set("Slots.SupportDiscord.Enable", true, yamlConfiguration);
|
||||||
set("Slots.Example.Item.Empty", ItemEmty, yamlConfiguration);
|
set("Slots.SupportDiscord.Item.Empty", false, yamlConfiguration);
|
||||||
set("Slots.Example.Item.Amount", ItemAmout, yamlConfiguration);
|
set("Slots.SupportDiscord.Item.Amount", 1, yamlConfiguration);
|
||||||
if (!(MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12)) {
|
if (!(MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12)) {
|
||||||
set("Slots.Example.Item.PlayerHead.Enable", Playerhead_enable, yamlConfiguration);
|
set("Slots.SupportDiscord.Item.PlayerHead.Enable", true, yamlConfiguration);
|
||||||
set("Slots.Example.Item.PlayerHead.Base64.Enable", base64_Enable, yamlConfiguration);
|
set("Slots.SupportDiscord.Item.PlayerHead.Base64.Enable", true, yamlConfiguration);
|
||||||
set("Slots.Example.Item.PlayerHead.Base64.Base64Value", base64value, yamlConfiguration);
|
set("Slots.SupportDiscord.Item.PlayerHead.Base64.Base64Value", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19", yamlConfiguration);
|
||||||
set("Slots.Example.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", PlayerWhoHasOpenedTheGUI, yamlConfiguration);
|
set("Slots.SupportDiscord.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", false, yamlConfiguration);
|
||||||
set("Slots.Example.Item.PlayerHead.PlayerName", PlayerName, yamlConfiguration);
|
set("Slots.SupportDiscord.Item.PlayerHead.PlayerName", "", yamlConfiguration);
|
||||||
}
|
}
|
||||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||||
set("Slots.Example.Item.Material", "TNT", yamlConfiguration);
|
set("Slots.SupportDiscord.Item.Material", "TNT", yamlConfiguration);
|
||||||
} else set("Slots.Example.Item.Material", Item, yamlConfiguration);
|
} else set("Slots.SupportDiscord.Item.Material", "", yamlConfiguration);
|
||||||
set("Slots.Example.Item.Name", Itemname, yamlConfiguration);
|
set("Slots.SupportDiscord.Item.Name", "&3Support Discord", yamlConfiguration);
|
||||||
set("Slots.Example.Item.Lore", ItemLore, yamlConfiguration);
|
set("Slots.SupportDiscord.Item.Lore", Arrays.asList("&8-----------------", "&bIf you need help setting up the plugin,", "&bfeel free to contact me on the Suport Discord.",
|
||||||
set("Slots.Example.CustomSound.Enable", CustomSound, yamlConfiguration);
|
"&8-----------------", "&eIf you find any errors or bugs,", "&eplease contact me so I can fix them.", "&8-----------------", "&5Discord: §7http://dc.t2code.net"),
|
||||||
set("Slots.Example.CustomSound.NoSound", CustomSound_NoSound, yamlConfiguration);
|
yamlConfiguration);
|
||||||
set("Slots.Example.CustomSound.Sound", CustomSound_Sound, yamlConfiguration);
|
set("Slots.SupportDiscord.CustomSound.Enable", false, yamlConfiguration);
|
||||||
set("Slots.Example.Cost.Enable", Cost, yamlConfiguration);
|
set("Slots.SupportDiscord.CustomSound.NoSound", false, yamlConfiguration);
|
||||||
set("Slots.Example.Cost.Price", Cost_Price, yamlConfiguration);
|
set("Slots.SupportDiscord.CustomSound.Sound", "", yamlConfiguration);
|
||||||
set("Slots.Example.Command.Enable", Command, yamlConfiguration);
|
set("Slots.SupportDiscord.Cost.Enable", false, yamlConfiguration);
|
||||||
set("Slots.Example.Command.BungeeCommand", BungeeCommand, yamlConfiguration);
|
set("Slots.SupportDiscord.Cost.Price", 0.0, yamlConfiguration);
|
||||||
set("Slots.Example.Command.CommandAsConsole", CommandAsConsole, yamlConfiguration);
|
set("Slots.SupportDiscord.Command.Enable", false, yamlConfiguration);
|
||||||
set("Slots.Example.Command.Command", Commands, yamlConfiguration);
|
set("Slots.SupportDiscord.Command.BungeeCommand", false, yamlConfiguration);
|
||||||
set("Slots.Example.ServerChange.Enable", Server_Change, yamlConfiguration);
|
set("Slots.SupportDiscord.Command.CommandAsConsole", false, yamlConfiguration);
|
||||||
set("Slots.Example.ServerChange.Server", Server_Change_Server, yamlConfiguration);
|
set("Slots.SupportDiscord.Command.Command", Arrays.asList(), yamlConfiguration);
|
||||||
set("Slots.Example.OpenGUI.Enable", OpenGUI, yamlConfiguration);
|
set("Slots.SupportDiscord.ServerChange.Enable", false, yamlConfiguration);
|
||||||
set("Slots.Example.OpenGUI.GUI", OpenGUI_GUI, yamlConfiguration);
|
set("Slots.SupportDiscord.ServerChange.Server", "", yamlConfiguration);
|
||||||
set("Slots.Example.Message.Enable", Message, yamlConfiguration);
|
set("Slots.SupportDiscord.OpenGUI.Enable", false, yamlConfiguration);
|
||||||
set("Slots.Example.Message.Message", Messages, yamlConfiguration);
|
set("Slots.SupportDiscord.OpenGUI.GUI", "", yamlConfiguration);
|
||||||
set("Slots.Example.Permission.Required", Permission, yamlConfiguration);
|
|
||||||
|
|
||||||
set("Slots.Example.SetConfig.Enable", SetConfig_Enable, yamlConfiguration);
|
set("Slots.SupportDiscord.Toggle.Permission.Enable", false, yamlConfiguration);
|
||||||
set("Slots.Example.SetConfig.File.Path", SetConfig_FilePath, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Option.Path", SetConfig_OptionPath, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Option.Premat", SetConfig_OptionPremat, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.LeftClick.String", SetConfig_ValueLeftString, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.LeftClick.Boolean", SetConfig_ValueLeftBoolean, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.LeftClick.Integer", SetConfig_ValueLeftInteger, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.LeftClick.Double", SetConfig_ValueLeftDouble, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.LeftClick.List", SetConfig_ValueLeftList, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.RightClick.String", SetConfig_ValueRightString, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.RightClick.Boolean", SetConfig_ValueRightBoolean, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.RightClick.Integer", SetConfig_ValueRightInteger, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.RightClick.Double", SetConfig_ValueRightDouble, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.Value.RightClick.List", SetConfig_ValueRightList, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.PluginReload.Enable", SetConfig_PluginReloadEnable, yamlConfiguration);
|
|
||||||
set("Slots.Example.SetConfig.PluginReload.Command", SetConfig_PluginReloadCommand, yamlConfiguration);
|
|
||||||
|
|
||||||
|
set("Slots.SupportDiscord.Toggle.Permission.Permission", "", yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.SupportDiscord.Toggle.UseItem.Enable", false, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.SupportDiscord.Message.Enable", true, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.Message.Message", Arrays.asList("&6You can find more information on Discord: &ehttp://dc.t2code.net"), yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.Permission.Required", false, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.File.Path", "", yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Option.Path", "", yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Option.Premat", "String", yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.LeftClick.String", "", yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.LeftClick.Boolean", false, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.LeftClick.Integer", 0, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.LeftClick.Double", 0.0, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.LeftClick.List", Arrays.asList(), yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.RightClick.String", "", yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.RightClick.Boolean", false, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.RightClick.Integer", 0, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.RightClick.Double", 0.0, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.Value.RightClick.List", Arrays.asList(), yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.PluginReload.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.SupportDiscord.SetConfig.PluginReload.Command", "", yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.UseItem.Slot", 6, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Enable", true, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Item.Empty", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Item.Amount", 1, yamlConfiguration);
|
||||||
|
if (!(MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12)) {
|
||||||
|
set("Slots.UseItem.Item.PlayerHead.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Item.PlayerHead.Base64.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Item.PlayerHead.Base64.Base64Value", "", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Item.PlayerHead.PlayerName", "", yamlConfiguration);
|
||||||
|
}
|
||||||
|
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||||
|
set("Slots.UseItem.Item.Material", "", yamlConfiguration);
|
||||||
|
} else set("Slots.UseItem.Item.Material", "", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Item.Name", "&6Toggle UseItem", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Item.Lore", Arrays.asList("&bYou currently have the UseItem set to: %commandgui_useitem%"),
|
||||||
|
yamlConfiguration);
|
||||||
|
set("Slots.UseItem.CustomSound.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.CustomSound.NoSound", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.CustomSound.Sound", "", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Cost.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Cost.Price", 0.0, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Command.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Command.BungeeCommand", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Command.CommandAsConsole", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Command.Command", Arrays.asList(), yamlConfiguration);
|
||||||
|
set("Slots.UseItem.ServerChange.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.ServerChange.Server", "", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.OpenGUI.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.OpenGUI.GUI", "", yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.UseItem.Toggle.Permission.Enable", false, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.UseItem.Toggle.Permission.Permission", "", yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.UseItem.Toggle.UseItem.Enable", true, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.UseItem.Message.Enable", true, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Message.Message", Arrays.asList("&bYour UseItem was set to: %commandgui_useitem%&b."), yamlConfiguration);
|
||||||
|
set("Slots.UseItem.Permission.Required", false, yamlConfiguration);
|
||||||
|
|
||||||
|
set("Slots.UseItem.SetConfig.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.File.Path", "", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Option.Path", "", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Option.Premat", "String", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.LeftClick.String", "", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.LeftClick.Boolean", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.LeftClick.Integer", 0, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.LeftClick.Double", 0.0, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.LeftClick.List", Arrays.asList(), yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.RightClick.String", "", yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.RightClick.Boolean", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.RightClick.Integer", 0, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.RightClick.Double", 0.0, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.Value.RightClick.List", Arrays.asList(), yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.PluginReload.Enable", false, yamlConfiguration);
|
||||||
|
set("Slots.UseItem.SetConfig.PluginReload.Command", "", yamlConfiguration);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config);
|
yamlConfiguration.save(config);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
send.console(Main.prefix + " §2Default GUI file (GUIs/default.yml) was loaded." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
send.console(Main.prefix + " §2Default GUI file (GUIs/default.yml) was loaded." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package de.jatitv.commandguiv2.Spigot.config.config;
|
|||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Util;
|
import de.jatitv.commandguiv2.Util;
|
||||||
|
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
||||||
@ -26,11 +27,11 @@ public class ConfigCreate {
|
|||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
if (yamlConfiguration.getInt("ConfigVersion") < ConfigVersion && new File(Main.getPath(), "config.yml").exists()) {
|
if (yamlConfiguration.getInt("ConfigVersion") < ConfigVersion && new File(Main.getPath(), "config.yml").exists()) {
|
||||||
send.console(Util.getPrefix() +" §4----------------------");
|
send.console(Util.getPrefix() + " §4----------------------");
|
||||||
send.console(Util.getPrefix() +" ");
|
send.console(Util.getPrefix() + " ");
|
||||||
send.console(Util.getPrefix() +" §6New features have been added to CommandGUI. The Config is adapted!");
|
send.console(Util.getPrefix() + " §6New features have been added to CommandGUI. The Config is adapted!");
|
||||||
send.console(Util.getPrefix() +" ");
|
send.console(Util.getPrefix() + " ");
|
||||||
send.console(Util.getPrefix() +" §4----------------------");
|
send.console(Util.getPrefix() + " §4----------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
yamlConfiguration.set("ConfigVersion", ConfigVersion);
|
yamlConfiguration.set("ConfigVersion", ConfigVersion);
|
||||||
@ -110,6 +111,21 @@ public class ConfigCreate {
|
|||||||
Config.set("Advanced.UseItem.World.Protection.Mode", "blacklist", yamlConfiguration);
|
Config.set("Advanced.UseItem.World.Protection.Mode", "blacklist", yamlConfiguration);
|
||||||
Config.set("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), yamlConfiguration);
|
Config.set("Advanced.UseItem.World.Protection.List", Arrays.asList("World1", "World2"), yamlConfiguration);
|
||||||
|
|
||||||
|
|
||||||
|
Config.set("Toggle.Items.OnOrYes.Item.Base64.Enable", false, yamlConfiguration);
|
||||||
|
Config.set("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", yamlConfiguration);
|
||||||
|
Config.set("Toggle.Items.OnOrYes.Item.Material", ItemVersion.getGreenWool().getType().toString(), yamlConfiguration);
|
||||||
|
|
||||||
|
Config.set("Toggle.Items.OffOrNo.Item.Base64.Enable", false, yamlConfiguration);
|
||||||
|
Config.set("Toggle.Items.OffOrNo.Item.Base64.Base64Value", "", yamlConfiguration);
|
||||||
|
Config.set("Toggle.Items.OffOrNo.Item.Material", ItemVersion.getRedWool().getType().toString(), yamlConfiguration);
|
||||||
|
|
||||||
|
Config.set("Toggle.Permission.Commands.True", "luckperms user [player] permission set [perm] true", yamlConfiguration);
|
||||||
|
Config.set("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false", yamlConfiguration);
|
||||||
|
|
||||||
|
Config.set("Placeholder.True", "&2true", yamlConfiguration);
|
||||||
|
Config.set("Placeholder.False", "&4false", yamlConfiguration);
|
||||||
|
|
||||||
Config.set("Sound.Enable", true, yamlConfiguration);
|
Config.set("Sound.Enable", true, yamlConfiguration);
|
||||||
|
|
||||||
Config.set("Sound.OpenInventory.Enable", true, yamlConfiguration);
|
Config.set("Sound.OpenInventory.Enable", true, yamlConfiguration);
|
||||||
|
@ -7,6 +7,7 @@ import de.jatitv.commandguiv2.Util;
|
|||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ public class SelectConfig {
|
|||||||
public static Boolean HelpAlias;
|
public static Boolean HelpAlias;
|
||||||
public static String language;
|
public static String language;
|
||||||
public static String Currency;
|
public static String Currency;
|
||||||
|
public static List<String> mainCommands;
|
||||||
|
|
||||||
public static String Storage;
|
public static String Storage;
|
||||||
|
|
||||||
@ -69,6 +71,20 @@ public class SelectConfig {
|
|||||||
public static String UseItem_Name;
|
public static String UseItem_Name;
|
||||||
public static List<String> UseItem_Lore;
|
public static List<String> UseItem_Lore;
|
||||||
|
|
||||||
|
public static Boolean toggleItemOnOrYesBase64;
|
||||||
|
public static String toggleItemOnOrYesBase64Value;
|
||||||
|
public static String toggleItemOnOrYesMaterial;
|
||||||
|
|
||||||
|
public static Boolean toggleItemOffOrNoBase64;
|
||||||
|
public static String toggleItemOffOrNoBase64Value;
|
||||||
|
public static String toggleItemOffOrNoMaterial;
|
||||||
|
|
||||||
|
public static String togglePermTrue;
|
||||||
|
public static String togglePermFalse;
|
||||||
|
|
||||||
|
public static String placeholderTrue;
|
||||||
|
public static String placeholderFalse;
|
||||||
|
|
||||||
public static Boolean Sound_Enable = true;
|
public static Boolean Sound_Enable = true;
|
||||||
|
|
||||||
public static Boolean Sound_OpenInventory_Enable = true;
|
public static Boolean Sound_OpenInventory_Enable = true;
|
||||||
@ -140,7 +156,7 @@ public class SelectConfig {
|
|||||||
UseItem_Base64value = yamlConfiguration.getString("UseItem.Item.PlayerHead.Base64.Base64Value");
|
UseItem_Base64value = yamlConfiguration.getString("UseItem.Item.PlayerHead.Base64.Base64Value");
|
||||||
UseItem_PlayerWhoHasOpenedTheGUI = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
UseItem_PlayerWhoHasOpenedTheGUI = yamlConfiguration.getBoolean("UseItem.Item.PlayerHead.PlayerWhoHasOpenedTheGUI");
|
||||||
UseItem_PlayerName = yamlConfiguration.getString("UseItem.Item.PlayerHead.PlayerName");
|
UseItem_PlayerName = yamlConfiguration.getString("UseItem.Item.PlayerHead.PlayerName");
|
||||||
UseItem_Name = Replace.replace(Util.getPrefix(),yamlConfiguration.getString("UseItem.Item.Name"));
|
UseItem_Name = Replace.replace(Util.getPrefix(), yamlConfiguration.getString("UseItem.Item.Name"));
|
||||||
UseItem_Lore = yamlConfiguration.getStringList("UseItem.Item.Lore");
|
UseItem_Lore = yamlConfiguration.getStringList("UseItem.Item.Lore");
|
||||||
UseItem_GiveOnEveryJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnEveryJoin");
|
UseItem_GiveOnEveryJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnEveryJoin");
|
||||||
UseItem_GiveOnlyOnFirstJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnlyOnFirstJoin");
|
UseItem_GiveOnlyOnFirstJoin = yamlConfiguration.getBoolean("UseItem.Join.GiveOnlyOnFirstJoin");
|
||||||
@ -154,7 +170,7 @@ public class SelectConfig {
|
|||||||
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<>();
|
List<String> gml = new ArrayList<>();
|
||||||
for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")){
|
for (String gm : yamlConfiguration.getStringList("Advanced.UseItem.GameMode.Protection.List")) {
|
||||||
gml.add(gm.toUpperCase());
|
gml.add(gm.toUpperCase());
|
||||||
}
|
}
|
||||||
UseItemGameModeList = gml;
|
UseItemGameModeList = gml;
|
||||||
@ -164,7 +180,22 @@ public class SelectConfig {
|
|||||||
UseItemWorldProtection = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.Enable");
|
UseItemWorldProtection = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.Enable");
|
||||||
UseItemWorldRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
|
UseItemWorldRemoveItemWhenItIsDisabled = yamlConfiguration.getBoolean("Advanced.UseItem.World.Protection.RemoveItemWhenItIsDisabled");
|
||||||
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
|
UseItemWorldMode = yamlConfiguration.getString("Advanced.UseItem.World.Protection.Mode");
|
||||||
UseItemWorldList =yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
|
UseItemWorldList = yamlConfiguration.getStringList("Advanced.UseItem.World.Protection.List");
|
||||||
|
|
||||||
|
|
||||||
|
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_Enable = yamlConfiguration.getBoolean("Sound.Enable");
|
||||||
Sound_OpenInventory_Enable = yamlConfiguration.getBoolean("Sound.OpenInventory.Enable");
|
Sound_OpenInventory_Enable = yamlConfiguration.getBoolean("Sound.OpenInventory.Enable");
|
||||||
|
@ -0,0 +1,120 @@
|
|||||||
|
package de.jatitv.commandguiv2.Spigot.gui;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.properties.Property;
|
||||||
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
|
import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
|
||||||
|
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
|
import de.jatitv.commandguiv2.Util;
|
||||||
|
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
||||||
|
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class GuiBuilder {
|
||||||
|
|
||||||
|
private static String prefix = Util.getPrefix();
|
||||||
|
|
||||||
|
protected static void item(Slot slot, Player player, Inventory inventory) {
|
||||||
|
ItemStack item = new ItemStack(Material.valueOf(slot.item.toUpperCase().replace(".", "_")));
|
||||||
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
|
setMeta(itemMeta, player, slot);
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
Integer am;
|
||||||
|
if (slot.itemAmount == 0) {
|
||||||
|
am = 1;
|
||||||
|
} else am = slot.itemAmount;
|
||||||
|
item.setAmount(am);
|
||||||
|
inventory.setItem(slot.slot, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void item(String material, Slot slot, Player player, Inventory inventory) {
|
||||||
|
ItemStack item = new ItemStack(Material.valueOf(material));
|
||||||
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
|
setMeta(itemMeta, player, slot);
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
Integer am;
|
||||||
|
if (slot.itemAmount == 0) {
|
||||||
|
am = 1;
|
||||||
|
} else am = slot.itemAmount;
|
||||||
|
item.setAmount(am);
|
||||||
|
inventory.setItem(slot.slot, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void base64(String base64Value, Slot slot, Player player, Inventory inventory) {
|
||||||
|
ItemStack item = ItemVersion.getHeadIS();
|
||||||
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
|
setMeta(itemMeta, player, slot);
|
||||||
|
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||||
|
profile.getProperties().put("textures", new Property("textures", 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void base64(Slot slot, Player player, Inventory inventory) {
|
||||||
|
ItemStack item = ItemVersion.getHeadIS();
|
||||||
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
|
setMeta(itemMeta, player, slot);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void playerHead(Slot slot, Player player, Inventory inventory) {
|
||||||
|
ItemStack item = ItemVersion.getHeadIS();
|
||||||
|
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
||||||
|
setMeta(itemMeta, player, slot);
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
Integer am;
|
||||||
|
if (slot.itemAmount == 0) {
|
||||||
|
am = 1;
|
||||||
|
} else am = slot.itemAmount;
|
||||||
|
item.setAmount(am);
|
||||||
|
inventory.setItem(slot.slot, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setMeta(ItemMeta itemMeta, Player player, Slot slot) {
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,7 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.gui;
|
package de.jatitv.commandguiv2.Spigot.gui;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import com.mojang.authlib.properties.Property;
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Listener.GUI_Listener;
|
import de.jatitv.commandguiv2.Spigot.Listener.GUI_Listener;
|
||||||
|
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
|
import de.jatitv.commandguiv2.Spigot.Objekte.Slot;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
@ -10,7 +9,6 @@ import de.jatitv.commandguiv2.Spigot.Objekte.Object;
|
|||||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import de.jatitv.commandguiv2.Util;
|
import de.jatitv.commandguiv2.Util;
|
||||||
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
||||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||||
@ -22,12 +20,8 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
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.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class OpenGUI {
|
public class OpenGUI {
|
||||||
private static Plugin plugin = Main.plugin;
|
private static Plugin plugin = Main.plugin;
|
||||||
private static String prefix = Util.getPrefix();
|
private static String prefix = Util.getPrefix();
|
||||||
@ -90,102 +84,47 @@ public class OpenGUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Slot slot : gui.GUI_Slots) {
|
for (Slot slot : gui.GUI_Slots) {
|
||||||
if (!slot.Perm
|
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))
|
||||||
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1)+".see")
|
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.slot + 1) + ".see")
|
||||||
|| player.hasPermission("commandgui.admin")) {
|
|| player.hasPermission("commandgui.admin")) {
|
||||||
if (slot.Enable) {
|
if (slot.enable) {
|
||||||
if (slot.Empty) {
|
if (slot.empty) {
|
||||||
ItemStack air = new ItemStack(Material.AIR);
|
ItemStack air = new ItemStack(Material.AIR);
|
||||||
inventory.setItem(slot.Slot, air);
|
inventory.setItem(slot.slot, air);
|
||||||
} else {
|
} else {
|
||||||
if (slot.PlayerHead_Enable) {
|
if (slot.togglePermission) {
|
||||||
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
if (player.hasPermission(slot.togglePermissionPerm)) {
|
||||||
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));
|
toggleOn(slot, player, inventory);
|
||||||
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 {
|
} else {
|
||||||
ItemStack item = ItemVersion.getHeadIS();
|
toggleOff(slot, player, inventory);
|
||||||
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
|
}
|
||||||
if (slot.Base64_Enable) {
|
} else if (slot.toggleUseItem) {
|
||||||
|
if (Events.useItemHashMap.get(player)) {
|
||||||
if (Main.PaPi) {
|
toggleOn(slot, player, inventory);
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
} else {
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
toggleOff(slot, player, inventory);
|
||||||
} 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);
|
|
||||||
} else {
|
|
||||||
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 {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ItemStack item = new ItemStack(Material.valueOf(slot.Item.toUpperCase().replace(".", "_")));
|
if (slot.playerHead_Enable) {
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
||||||
if (Main.PaPi) {
|
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));
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, player, slot.Name.replace("[player]", player.getName())));
|
send.error(plugin, "Playerheads are only available from version 1.13!");
|
||||||
itemMeta.setLore(Replace.replacePrice(prefix, player, slot.Lore, slot.Price + " " + SelectConfig.Currency));
|
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.base64_Enable) {
|
||||||
|
GuiBuilder.base64(slot, player, inventory);
|
||||||
|
} else {
|
||||||
|
if (slot.playerWhoHasOpenedTheGUI) {
|
||||||
|
GuiBuilder.base64(slot, player, inventory);
|
||||||
|
} else {
|
||||||
|
GuiBuilder.playerHead(slot, player, inventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
itemMeta.setDisplayName(Replace.replace(prefix, slot.Name.replace("[player]", player.getName())));
|
GuiBuilder.item(slot, player, inventory);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,4 +134,16 @@ public class OpenGUI {
|
|||||||
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.GUI_Name) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
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)));
|
} else player.sendMessage(SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.GUI_Name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void toggleOn(Slot slot, Player player, Inventory inventory) {
|
||||||
|
if (SelectConfig.toggleItemOnOrYesBase64) {
|
||||||
|
GuiBuilder.base64(SelectConfig.toggleItemOnOrYesBase64Value, slot, player, inventory);
|
||||||
|
} else GuiBuilder.item(SelectConfig.toggleItemOnOrYesMaterial, slot, player, inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void toggleOff(Slot slot, Player player, Inventory inventory) {
|
||||||
|
if (SelectConfig.toggleItemOffOrNoBase64) {
|
||||||
|
GuiBuilder.base64(SelectConfig.toggleItemOffOrNoBase64Value, slot, player, inventory);
|
||||||
|
} else GuiBuilder.item(SelectConfig.toggleItemOffOrNoMaterial, slot, player, inventory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package de.jatitv.commandguiv2.Spigot.system;
|
|||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
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.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
|
||||||
@ -27,10 +28,10 @@ public class Give_UseItem {
|
|||||||
if (SelectConfig.UseItem_InventorySlotEnforce){
|
if (SelectConfig.UseItem_InventorySlotEnforce){
|
||||||
slot = SelectConfig.UseItem_InventorySlot;
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
} else {
|
} else {
|
||||||
if (Select_Database.selectSlot(player) == null) {
|
if (Events.useItemSlotHashMap.get(player)== null) {
|
||||||
slot = SelectConfig.UseItem_InventorySlot;
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
} else {
|
} else {
|
||||||
slot = Select_Database.selectSlot(player);
|
slot = Events.useItemSlotHashMap.get(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
|
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.GUI_Listener;
|
||||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events_from1_10;
|
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_GUIItem;
|
||||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
|
import de.jatitv.commandguiv2.Spigot.cmdManagement.CmdExecuter_Help;
|
||||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.register.AliasRegister;
|
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.T2CodeTemplate;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
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 net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -70,6 +71,10 @@ public class Load {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PluginCheck.papi()){
|
||||||
|
new Placeholder().register();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LanguagesCreate.langCreate();
|
LanguagesCreate.langCreate();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -81,7 +86,7 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -99,6 +104,7 @@ public class Load {
|
|||||||
send.console(prefix + " §8-------------------------------");
|
send.console(prefix + " §8-------------------------------");
|
||||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||||
MySQL.main();
|
MySQL.main();
|
||||||
|
send.console(prefix + " §2Storage medium §6MySQL §2is used.");
|
||||||
try {
|
try {
|
||||||
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||||
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||||
@ -116,7 +122,7 @@ public class Load {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (SelectConfig.Debug) send.console(prefix + " §6Storage medium §2YML §6is used.");
|
send.console(prefix + " §2Storage medium §6YML §2is used.");
|
||||||
}
|
}
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
send.console(prefix + " §2PlaceholderAPI successfully connected!");
|
send.console(prefix + " §2PlaceholderAPI successfully connected!");
|
||||||
@ -130,17 +136,14 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main.plugin.getCommand("commandguiadmin").setExecutor(new CmdExecuter_Admin());
|
|
||||||
// send.debug(plugin, "Commandregister: commandguiadmin");
|
|
||||||
|
|
||||||
if (SelectConfig.HelpAlias) {
|
if (SelectConfig.HelpAlias) {
|
||||||
Main.plugin.getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
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());
|
Main.plugin.getCommand("commandgui").setExecutor(new CmdExecuter_GUITab());
|
||||||
send.debug(plugin, "Commandregister: commandgui");
|
send.debug(plugin, "CommandRegister: commandgui");
|
||||||
Main.plugin.getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
Main.plugin.getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
||||||
send.debug(plugin, "Commandregister: commandgui-item");
|
send.debug(plugin, "CommandRegister: commandgui-item");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AliasRegister.onRegister();
|
AliasRegister.onRegister();
|
||||||
@ -148,7 +151,6 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new GUI_Listener(), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new GUI_Listener(), plugin);
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new PluginEvent(), plugin);
|
||||||
|
|
||||||
@ -158,7 +160,6 @@ public class Load {
|
|||||||
Bukkit.getServer().getPluginManager().registerEvents(new Events_from1_10(), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new Events_from1_10(), plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||||
Metrics.Bstats();
|
Metrics.Bstats();
|
||||||
Main.addonLoad();
|
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));
|
Bukkit.getPluginManager().addPermission(new Permission("commandgui.command." + gui.Command_Command));
|
||||||
}
|
}
|
||||||
for (Slot slot : gui.GUI_Slots) {
|
for (Slot slot : gui.GUI_Slots) {
|
||||||
if (Bukkit.getPluginManager().getPermission("commandgui." + gui.Command_Command + ".slot." + (slot.Slot + 1)) == null) {
|
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)));
|
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 com.zaxxer.hikari.HikariDataSource;
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
@ -152,6 +151,6 @@ public class MySQL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void close() {
|
public static void close() {
|
||||||
ds.close();
|
if (ds != null) ds.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.system.database;
|
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 de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ public class Select_Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setItemStatusTrue(Player player) {
|
public static void setItemStatusTrue(Player player) {
|
||||||
|
Events.useItemHashMap.replace(player, true);
|
||||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||||
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
MySQL.query("INSERT INTO `gui-item` (`UUID`, `Name`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||||
+ "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '1';");
|
+ "') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Status` = '1';");
|
||||||
@ -30,6 +32,7 @@ public class Select_Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setItemStatusFalse(Player player) {
|
public static void setItemStatusFalse(Player player) {
|
||||||
|
Events.useItemHashMap.replace(player, false);
|
||||||
if (SelectConfig.Storage.equals("MYSQL")) {
|
if (SelectConfig.Storage.equals("MYSQL")) {
|
||||||
|
|
||||||
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()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package de.jatitv.commandguiv2.api;
|
package de.jatitv.commandguiv2.api;
|
||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Listener.ItemChange;
|
import de.jatitv.commandguiv2.Spigot.Listener.ItemChange;
|
||||||
|
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
|
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands;
|
||||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.Help;
|
import de.jatitv.commandguiv2.Spigot.cmdManagement.Help;
|
||||||
@ -42,11 +43,11 @@ public class CGuiAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean selectPlayerItemEnable(Player player) {
|
public static Boolean selectPlayerItemEnable(Player player) {
|
||||||
return Select_Database.selectItemStatus(player);
|
return Events.useItemHashMap.get(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer selectPlayerItemSlot(Player player) {
|
public static Integer selectPlayerItemSlot(Player player) {
|
||||||
return Select_Database.selectSlot(player);
|
return Events.useItemSlotHashMap.get(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPlayerItemEnable(Player player, Boolean value) {
|
public static void setPlayerItemEnable(Player player, Boolean value) {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
Main-Class:
|
|
||||||
Class-Path: PlugmanGUI-3.0.jar spigot-1.8r3.jar spigot-1.9r1.jar spigot-
|
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.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
|
1.9r2.jar spigot-1.16r3.jar spigot-1.14r1.jar slf4j-api-1.7.25.jar Luck
|
||||||
|
Loading…
Reference in New Issue
Block a user