Compare commits
No commits in common. "c2782bbb97ea7b0a46fefbad8f8b727f16df1b23" and "ff2cb3ce9661137332a15608c3ef6012097904c4" have entirely different histories.
c2782bbb97
...
ff2cb3ce96
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>CommandGUI_V2</artifactId>
|
||||
<version>2.6.2_Snapshot-2</version>
|
||||
<version>2.6.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandGUI</name>
|
||||
@ -82,7 +82,7 @@
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>11.4</version>
|
||||
<version>10.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
|
@ -22,7 +22,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
@ -37,142 +36,109 @@ public class GUI_Listener implements Listener {
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
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() == 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.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);
|
||||
if (e.getInventory() != null && e.getCurrentItem() != null) {
|
||||
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 (!slot.ItemsRemovable) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
if (e.getSlot() == slot.Slot) {
|
||||
if (!slot.Perm
|
||||
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1))
|
||||
|| player.hasPermission("commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1) + ".use")
|
||||
|| player.hasPermission("commandgui.admin")) {
|
||||
if (slot.Enable) {
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(Replace.replace(prefix, slot.Name))) {
|
||||
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == Material.valueOf(slot.Item.toUpperCase().replace(".", "_"))) {
|
||||
if (slot.Cost_Enable) {
|
||||
if (slot.Command_Enable || slot.Message_Enable || slot.OpenGUI_Enable || slot.ServerChange) {
|
||||
if (Vault.buy(prefix, player, slot.Price)) {
|
||||
player.sendMessage(SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, slot.Name))
|
||||
.replace("[price]", slot.Price + " " + SelectConfig.Currency));
|
||||
if (slot.Command_Enable) {
|
||||
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
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);
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (slot.Command_BungeeCommand && SelectConfig.Bungee) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.CommandAsConsole);
|
||||
}
|
||||
} else {
|
||||
if (slot.CommandAsConsole) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
} else {
|
||||
for (String cmd : slot.Command) {
|
||||
player.chat("/" + cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
if (slot.OpenGUI_Enable) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
|
||||
private static void setConfig(Slot slot, Player player, InventoryClickEvent e) {
|
||||
File config = new File(slot.ConfigFilePath);
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
OpenGUI.openGUI(player, Main.guiHashMap.get(slot.OpenGUI), slot.OpenGUI);
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
if (slot.Message_Enable) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
for (String msg : slot.Message) {
|
||||
if (Main.PaPi) {
|
||||
player.sendMessage(Replace.replacePrice(prefix, player, msg, slot.Price + " " + SelectConfig.Currency));
|
||||
} else
|
||||
player.sendMessage(Replace.replacePrice(prefix, msg, slot.Price + " " + SelectConfig.Currency));
|
||||
}
|
||||
}
|
||||
if (slot.ServerChange) {
|
||||
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);
|
||||
}
|
||||
if (slot.SetConfigEnable) {
|
||||
File config = new File(slot.ConfigFilePath);
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
/*if (slot.ConfigChatInput){
|
||||
ConfigChat.EditChat.put(player, slot.ConfigOptionPath);
|
||||
player.sendMessage(DefaultValue.SettingsGUIchatSet.replace("[setting]", "Shop Name Chest small"));
|
||||
@ -180,65 +146,251 @@ public class GUI_Listener implements Listener {
|
||||
} else
|
||||
{
|
||||
*/
|
||||
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);
|
||||
}
|
||||
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);
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) {
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
} else
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
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 {
|
||||
if (slot.Command_Enable) {
|
||||
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 {
|
||||
if (slot.CommandAsConsole) {
|
||||
for (String cmd : slot.Command) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
} else {
|
||||
for (String cmd : slot.Command) {
|
||||
player.chat("/" + cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 2L);
|
||||
}
|
||||
if (slot.OpenGUI_Enable) {
|
||||
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);
|
||||
}
|
||||
if (slot.Message_Enable) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.closeInventory();
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
|
||||
|
||||
for (String msg : slot.Message) {
|
||||
if (Main.PaPi) {
|
||||
player.sendMessage(Replace.replace(prefix, player, msg.replace("[prefix]", prefix)));
|
||||
} else
|
||||
player.sendMessage(Replace.replace(prefix, msg.replace("[prefix]", prefix)));
|
||||
}
|
||||
}
|
||||
if (slot.ServerChange) {
|
||||
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);
|
||||
}
|
||||
if (slot.SetConfigEnable) {
|
||||
File config = new File(slot.ConfigFilePath);
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
/*if (slot.ConfigChatInput){
|
||||
ConfigChat.EditChat.put(player, slot.ConfigOptionPath);
|
||||
player.sendMessage(DefaultValue.SettingsGUIchatSet.replace("[setting]", "Shop Name Chest small"));
|
||||
player.sendMessage(DefaultValue.SettingsGUIchatCancel);
|
||||
} else
|
||||
{
|
||||
*/
|
||||
if (e.isLeftClick()) {
|
||||
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.isRightClick()) {
|
||||
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);
|
||||
}
|
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
} else
|
||||
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, slot.Name))
|
||||
.replace("[perm]", "commandgui.gui." + gui.Command_Command + ".slot." + (slot.Slot + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ public class ItemChange {
|
||||
slot = Select_Database.selectSlot(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (!SelectConfig.UseItem_Enable) {
|
||||
return;
|
||||
}
|
||||
@ -100,6 +101,7 @@ public class ItemChange {
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L * 1);
|
||||
|
||||
}
|
||||
|
||||
private static void setCursor(Player player, int slot) {
|
||||
@ -151,5 +153,6 @@ public class ItemChange {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,10 @@ public class PluginEvent implements Listener {
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Select_Database.nameCheck(player);
|
||||
UpdateAPI.join(Main.plugin, prefix, "commandgui.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord());
|
||||
UpdateAPI.join(Main.plugin,prefix, "commandgui.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onClearServer(ServerCommandEvent event) {
|
||||
if (SelectConfig.UseItem_KeepAtCommandClear) {
|
||||
@ -35,11 +36,11 @@ public class PluginEvent implements Listener {
|
||||
public void run() {
|
||||
try {
|
||||
Player player = Bukkit.getPlayer(event.getCommand().replace("/", "").replace("clear ", ""));
|
||||
if (player == null) {
|
||||
if (player == null){
|
||||
return;
|
||||
}
|
||||
clearGive(player);
|
||||
} catch (Exception ex) {
|
||||
} catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
@ -49,6 +50,7 @@ public class PluginEvent implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onClearPlayer(PlayerCommandPreprocessEvent event) {
|
||||
if (SelectConfig.UseItem_KeepAtCommandClear) {
|
||||
|
@ -80,6 +80,25 @@ public class Events implements Listener {
|
||||
Player player = e.getPlayer();
|
||||
if (SelectConfig.UseItem_Enable) {
|
||||
ItemChange.itemChange(player, false);
|
||||
//if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||
// if (SelectConfig.UseItem_GiveOnlyOnFirstJoin) {
|
||||
// if (!player.hasPlayedBefore()) {
|
||||
// new BukkitRunnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Give_UseItem.onGive(player);
|
||||
// }
|
||||
// }.runTaskLater(Main.plugin, 20L * 1);
|
||||
// }
|
||||
// } else {
|
||||
// new BukkitRunnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// Give_UseItem.onGive(player);
|
||||
// }
|
||||
// }.runTaskLater(Main.plugin, 20L * 1);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,6 +130,7 @@ public class Events implements Listener {
|
||||
}.runTaskLater(Main.plugin, SelectConfig.UseItemWorldChangeDelayInTicks * 1L);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInteract(PlayerInteractEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
@ -186,6 +206,7 @@ public class Events implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onItemMove(InventoryDragEvent e) {
|
||||
if (!SelectConfig.UseItem_BlockMoveAndDrop || !SelectConfig.UseItem_Enable) return;
|
||||
|
@ -69,8 +69,7 @@ public final class Main extends JavaPlugin {
|
||||
if (PluginCheck.plotSquaredGUI()) {
|
||||
PlotSquaredGUI = true;
|
||||
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
|
||||
}
|
||||
if (PluginCheck.luckyBox()) {
|
||||
}if (PluginCheck.luckyBox()) {
|
||||
LuckyBox = true;
|
||||
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ public class Obj_Select {
|
||||
yamlConfiguration_gui.getBoolean("Slots." + key + ".SetConfig.PluginReload.Enable"),
|
||||
yamlConfiguration_gui.getString("Slots." + key + ".SetConfig.PluginReload.Command"));
|
||||
slots.add(slot);
|
||||
|
||||
}
|
||||
Object objekt = new Object(GUI_Enable, GUI_Lines, GUI_Name, GUI_FillItem_Enable, GUI_FillItem_Item,
|
||||
config_gui.getName().replace(".yml", ""), Command_Alias_Enable, Command_Permission, slots);
|
||||
@ -106,6 +107,7 @@ public class Obj_Select {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user