From 2d80baac22ada6cd1cf93ce77a5c28030aface6b Mon Sep 17 00:00:00 2001 From: j502647092 Date: Mon, 20 Jul 2015 21:25:02 +0800 Subject: [PATCH] Format Code... Signed-off-by: j502647092 --- src/config.yml | 14 +- src/me/jacobculley/customgui/Main.java | 1212 +++++++++++++----------- src/plugin.yml | 2 +- 3 files changed, 655 insertions(+), 573 deletions(-) diff --git a/src/config.yml b/src/config.yml index 8b322b6..b076b52 100644 --- a/src/config.yml +++ b/src/config.yml @@ -33,7 +33,9 @@ GUI: ##DO NOT TOUCH! - '&aThis OP item will be' - '&ashown to any players' - '&ain OP mode' - Enchant: DURABILITY;1,DAMAGE_ALL;1 ##The enchantment to be put on the OP item (Format: ;) + Enchant: ##The enchantment to be put on the OP item (Format: ;) + - DURABILITY;1 + - DAMAGE_ALL;2 ConsoleCommands: ##The console commands to be executed when clicked (Use %PLAYER% for players name) - deop %PLAYER% - pex user %PLAYER% remove example.permission.1 @@ -59,7 +61,8 @@ GUI: ##DO NOT TOUCH! - '&abe shown if the player has' - '&athe config defined permission' - '&eYou need $%COMMANDSCOST% to use this item' - Enchant: DURABILITY;1 ##The enchantment to be put on the permission item (Format: ;) + Enchant: ##The enchantment to be put on the permission item (Format: ;) + - DURABILITY;1 ConsoleCommands: ##The console commands to be executed when clicked (Use %PLAYER% for players name) - fly %PLAYER% - op %PLAYER% [LEFT-CLICK] @@ -84,7 +87,8 @@ GUI: ##DO NOT TOUCH! - '&athe config defined balance' - '&6Current Balance: %BALANCE%' - '&eYou need $%COMMANDSCOST% to use this item' - Enchant: DURABILITY;1 ##The enchantment to be put on the balance item (Format: ;) + Enchant: ##The enchantment to be put on the balance item (Format: ;) + - DURABILITY;1 ConsoleCommands: ##The console commands to be executed when clicked (Use %PLAYER% for players name) - pex user %PLAYER% add example.permission.1 PlayerCommands: ##The player commands to be executed when clicked @@ -107,7 +111,7 @@ GUI: ##DO NOT TOUCH! - '&abe shown if the player has' - '&athe config defined EXP' - '&6Current Level: %PLAYERLEVEL%' - Enchant: null ##The enchantment to be put on the EXP item (Format: ;) + Enchant: [] ##The enchantment to be put on the EXP item (Format: ;) ConsoleCommands: ##The console commands to be executed when clicked (Use %PLAYER% for players name) - eco give %PLAYER% 2000 PlayerCommands: ##The player commands to be executed when clicked @@ -129,7 +133,7 @@ GUI: ##DO NOT TOUCH! - '&abe shown if the player does' - '&anot meet any of the other item' - '&adisplay requirements.' - Enchant: null ##The enchantment to be put on the EXP item (Format: ;) + Enchant: [] ##The enchantment to be put on the EXP item (Format: ;) ConsoleCommands: ##The console commands to be executed when clicked (Use %PLAYER% for players name) - xp give %PLAYER% 160 PlayerCommands: ##The player commands to be executed when clicked diff --git a/src/me/jacobculley/customgui/Main.java b/src/me/jacobculley/customgui/Main.java index 134a06d..0af11b8 100644 --- a/src/me/jacobculley/customgui/Main.java +++ b/src/me/jacobculley/customgui/Main.java @@ -42,14 +42,14 @@ import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; public class Main extends JavaPlugin implements Listener { - public static Economy economy = null; - public static Permission permission = null; + public static Economy econ; + public static Permission perms; File Messages; YamlConfiguration messagesFile; static { - Main.economy = null; - Main.permission = null; + Main.econ = null; + Main.perms = null; } public Main() { @@ -59,7 +59,6 @@ public class Main extends JavaPlugin implements Listener { @Override public void onEnable() { - reloadConfig(); this.getServer().getPluginManager().registerEvents(this, this); this.getLogger().info("CustomGUI has been enabled!"); this.saveDefaultConfig(); @@ -68,7 +67,7 @@ public class Main extends JavaPlugin implements Listener { if (!this.Messages.exists()) { try { this.Messages.createNewFile(); - ArrayList list = new ArrayList(); + final ArrayList list = new ArrayList(); list.add("&aCustomGUI Commands"); list.add("&7-----------------------------------"); list.add("&e/customgui reload &7- Reloads the config file"); @@ -111,23 +110,17 @@ public class Main extends JavaPlugin implements Listener { } if (this.setupEconomy()) { this.getLogger().severe( - String.format("[%s] - CustomGUI has hooked into Vault - Economy", this - .getDescription().getName())); - } else { - this.getLogger().warning("Vault - Economy 载入失败!"); + String.format("[%s] - CustomGUI has hooked into Vault", this.getDescription() + .getName())); + return; } if (this.setupAPI()) { this.getLogger().severe( String.format("[%s] - CustomGUI has hooked into PlaceholderAPI", this .getDescription().getName())); + return; } - if (this.setupPermissions()) { - this.getLogger().severe( - String.format("[%s] - CustomGUI has hooked into Vault - Permission", this - .getDescription().getName())); - } else { - this.getLogger().warning("Vault - Permission 载入失败!"); - } + this.setupPermissions(); } @Override @@ -139,37 +132,38 @@ public class Main extends JavaPlugin implements Listener { return this.getServer().getPluginManager().getPlugin("PlaceholderAPI") != null; } - public boolean setupPermissions() { - RegisteredServiceProvider permissionProvider = getServer().getServicesManager() - .getRegistration(net.milkbowl.vault.permission.Permission.class); - if (permissionProvider != null) { - permission = permissionProvider.getProvider(); - } - return (permission != null); + private boolean setupPermissions() { + Main.perms = (Permission) this.getServer().getServicesManager() + .getRegistration((Class) Permission.class).getProvider(); + return Main.perms != null; } - public boolean setupEconomy() { - RegisteredServiceProvider economyProvider = getServer().getServicesManager() - .getRegistration(net.milkbowl.vault.economy.Economy.class); - if (economyProvider != null) { - economy = economyProvider.getProvider(); + private boolean setupEconomy() { + if (this.getServer().getPluginManager().getPlugin("Vault") == null) { + return false; } - return (economy != null); + final RegisteredServiceProvider registration = this.getServer().getServicesManager() + .getRegistration((Class) Economy.class); + if (registration == null) { + return false; + } + Main.econ = (Economy) registration.getProvider(); + return Main.econ != null; } - public String sendMessage(Player player, String setPlaceholders) { + public String sendMessage(final Player player, String setPlaceholders) { return setPlaceholders = PlaceholderAPI.setPlaceholders(player, setPlaceholders); } @EventHandler( priority = EventPriority.HIGHEST) - public void commandProcess(PlayerCommandPreprocessEvent playerCommandPreprocessEvent) { - Player player = playerCommandPreprocessEvent.getPlayer(); - Iterator iterator = this.getConfig().getConfigurationSection("GUI").getKeys(false) - .iterator(); - while (iterator.hasNext()) { - for (String s : this.getConfig() - .getStringList("GUI." + iterator.next() + ".GUICommand")) { + public void commandProcess(final PlayerCommandPreprocessEvent playerCommandPreprocessEvent) { + final Player player = playerCommandPreprocessEvent.getPlayer(); + final Iterator commands = this.getConfig().getConfigurationSection("GUI") + .getKeys(false).iterator(); + while (commands.hasNext()) { + for (final String s : this.getConfig().getStringList( + "GUI." + commands.next() + ".GUICommand")) { if (playerCommandPreprocessEvent.getMessage().equalsIgnoreCase("/" + s)) { player.performCommand("customgui open " + s); playerCommandPreprocessEvent.setCancelled(true); @@ -180,58 +174,61 @@ public class Main extends JavaPlugin implements Listener { @SuppressWarnings("deprecation") @EventHandler - public void onInventoryClick(InventoryClickEvent inventoryClickEvent) { - Player player = (Player) inventoryClickEvent.getWhoClicked(); - for (String s : this.getConfig().getConfigurationSection("GUI").getKeys(false)) { - String string = this.getConfig().getString("GUI." + s + ".ChestName", ""); - for (String s2 : this.getConfig().getConfigurationSection("GUI." + s + ".GUIItems") - .getKeys(false)) { + public void onInventoryClick(final InventoryClickEvent inventoryClickEvent) { + final Player player = (Player) inventoryClickEvent.getWhoClicked(); + for (final String guiName : this.getConfig().getConfigurationSection("GUI").getKeys(false)) { + final String guiChestName = this.getConfig().getString("GUI." + guiName + ".ChestName", ""); + for (final String guiItemName : this.getConfig() + .getConfigurationSection("GUI." + guiName + ".GUIItems").getKeys(false)) { if (inventoryClickEvent .getInventory() .getTitle() .contentEquals( ChatColor.translateAlternateColorCodes( '&', - string.replace("%PLAYER%", player.getName()) + guiChestName.replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder().append( - Main.economy.getBalance(player)) + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", new StringBuilder().append( player.getLevel()).toString())))) { if (inventoryClickEvent.getRawSlot() == this.getConfig().getInt( - "GUI." + s + ".GUIItems." + s2 + ".ItemSlot")) { - for (String s3 : this.getConfig() - .getConfigurationSection("GUI." + s + ".GUIItems." + s2) + "GUI." + guiName + ".GUIItems." + guiItemName + ".ItemSlot")) { + for (final String guiItem : this.getConfig() + .getConfigurationSection("GUI." + guiName + ".GUIItems." + guiItemName) .getKeys(false)) { - String string2 = this.getConfig().getString( - "GUI." + s + ".GUIItems." + s2 + ".Permission", ""); - List stringList = this.getConfig().getStringList( - "GUI." + s + ".GUIItems." + s2 + "." + s3 + ".ConsoleCommands"); - List stringList2 = this.getConfig().getStringList( - "GUI." + s + ".GUIItems." + s2 + "." + s3 + ".PlayerCommands"); - List stringList3 = this.getConfig().getStringList( - "GUI." + s + ".GUIItems." + s2 + "." + s3 + ".PlayerMessages"); - List stringList4 = this.getConfig().getStringList( - "GUI." + s + ".GUIItems." + s2 + "." + s3 - + ".BroadcastMessages"); - String upperCase = this + final String strPermission = this.getConfig().getString( + "GUI." + guiName + ".GUIItems." + guiItemName + ".Permission", ""); + final List strlConsoleCommands = this.getConfig() + .getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + "." + guiItem + + ".ConsoleCommands"); + final List strlPlayerCommands = this.getConfig().getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + "." + guiItem + ".PlayerCommands"); + final List strlPlayerMessages = this.getConfig().getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + "." + guiItem + ".PlayerMessages"); + final List strlBroadcastMessages = this.getConfig() + .getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + "." + guiItem + + ".BroadcastMessages"); + final String strClickSound = this .getConfig() .getString( - "GUI." + s + ".GUIItems." + s2 + "." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + "." + guiItem + ".ClickSound", "").toUpperCase(); - String upperCase2 = this + final String strNoPermsClickSound = this .getConfig() .getString( - "GUI." + s + ".GUIItems." + s2 + ".NoPermsClickSound", + "GUI." + guiName + ".GUIItems." + guiItemName + ".NoPermsClickSound", "").toUpperCase(); - boolean boolean1 = this.getConfig().getBoolean( - "GUI." + s + ".GUIItems." + s2 + "." + s3 + ".CloseOnClick"); - double n = this.getConfig().getInt( - "GUI." + s + ".GUIItems." + s2 + "." + s3 + ".CommandsCost"); + final boolean boolCloseOnClick = this.getConfig().getBoolean( + "GUI." + guiName + ".GUIItems." + guiItemName + "." + guiItem + ".CloseOnClick"); + final double dblCommandsCost = this.getConfig().getInt( + "GUI." + guiName + ".GUIItems." + guiItemName + "." + guiItem + ".CommandsCost"); if (inventoryClickEvent .getCurrentItem() .getItemMeta() @@ -243,16 +240,16 @@ public class Main extends JavaPlugin implements Listener { player, this.getConfig() .getString( - "GUI." + s + "GUI." + guiName + ".GUIItems." - + s2 + "." + s3 + + guiItemName + "." + guiItem + ".Name", "") .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -264,38 +261,39 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()))))) { - if (player.hasPermission(string2) || string2.isEmpty()) { - if (Main.economy.getBalance(player) >= n || n == 0.0) { - if (boolean1) { + if (player.hasPermission(strPermission) || strPermission.isEmpty()) { + if (Main.econ.getBalance(player) >= dblCommandsCost + || dblCommandsCost == 0.0) { + if (boolCloseOnClick) { player.closeInventory(); } else { inventoryClickEvent.setCancelled(true); } - if (!upperCase.isEmpty()) { - float n2 = 1.0f; + if (!strClickSound.isEmpty()) { + final float n2 = 1.0f; player.playSound(player.getLocation(), - Sound.valueOf(upperCase), n2, n2); + Sound.valueOf(strClickSound), n2, n2); } - if (n != 0.0) { - Main.economy.withdrawPlayer(player, n); + if (dblCommandsCost != 0.0) { + Main.econ.withdrawPlayer(player, dblCommandsCost); } - for (String s4 : stringList) { - if (s4.contains("[RIGHT-CLICK]")) { + for (final String consoleCommand : strlConsoleCommands) { + if (consoleCommand.contains("[RIGHT-CLICK]")) { if (!inventoryClickEvent.isRightClick()) { continue; } this.getServer() .dispatchCommand( Bukkit.getConsoleSender(), - this.sendMessage(player, s4) + this.sendMessage(player, consoleCommand) .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -307,25 +305,25 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace("[RIGHT-CLICK]", "") .replace("[LEFT-CLICK]", "")); - } else if (s4.contains("[LEFT-CLICK]")) { + } else if (consoleCommand.contains("[LEFT-CLICK]")) { if (!inventoryClickEvent.isLeftClick()) { continue; } this.getServer() .dispatchCommand( Bukkit.getConsoleSender(), - this.sendMessage(player, s4) + this.sendMessage(player, consoleCommand) .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -337,26 +335,26 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace("[RIGHT-CLICK]", "") .replace("[LEFT-CLICK]", "")); } else { - if (s4.contains("[RIGHT-CLICK]") - && s4.contains("[LEFT-CLICK]")) { + if (consoleCommand.contains("[RIGHT-CLICK]") + && consoleCommand.contains("[LEFT-CLICK]")) { continue; } this.getServer() .dispatchCommand( Bukkit.getConsoleSender(), - this.sendMessage(player, s4) + this.sendMessage(player, consoleCommand) .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -368,28 +366,28 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace("[RIGHT-CLICK]", "") .replace("[LEFT-CLICK]", "")); } } - for (String s5 : stringList2) { - if (s5.contains("[RIGHT-CLICK]")) { + for (final String playerCommand : strlPlayerCommands) { + if (playerCommand.contains("[RIGHT-CLICK]")) { if (!inventoryClickEvent.isRightClick()) { continue; } this.getServer() .dispatchCommand( player, - this.sendMessage(player, s5) + this.sendMessage(player, playerCommand) .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -401,25 +399,25 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace("[RIGHT-CLICK]", "") .replace("[LEFT-CLICK]", "")); - } else if (s5.contains("[LEFT-CLICK]")) { + } else if (playerCommand.contains("[LEFT-CLICK]")) { if (!inventoryClickEvent.isLeftClick()) { continue; } this.getServer() .dispatchCommand( player, - this.sendMessage(player, s5) + this.sendMessage(player, playerCommand) .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -431,26 +429,26 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace("[RIGHT-CLICK]", "") .replace("[LEFT-CLICK]", "")); } else { - if (s5.contains("[RIGHT-CLICK]") - && s5.contains("[LEFT-CLICK]")) { + if (playerCommand.contains("[RIGHT-CLICK]") + && playerCommand.contains("[LEFT-CLICK]")) { continue; } this.getServer() .dispatchCommand( player, - this.sendMessage(player, s5) + this.sendMessage(player, playerCommand) .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -462,28 +460,28 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace("[RIGHT-CLICK]", "") .replace("[LEFT-CLICK]", "")); } } - for (String s6 : stringList3) { - if (s6.contains("[RIGHT-CLICK]")) { + for (final String playerMessage : strlPlayerMessages) { + if (playerMessage.contains("[RIGHT-CLICK]")) { if (!inventoryClickEvent.isRightClick()) { continue; } player.sendMessage(ChatColor .translateAlternateColorCodes( '&', - this.sendMessage(player, s6) + this.sendMessage(player, playerMessage) .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -495,25 +493,25 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace("[RIGHT-CLICK]", "") .replace("[LEFT-CLICK]", ""))); - } else if (s6.contains("[LEFT-CLICK]")) { + } else if (playerMessage.contains("[LEFT-CLICK]")) { if (!inventoryClickEvent.isLeftClick()) { continue; } player.sendMessage(ChatColor .translateAlternateColorCodes( '&', - this.sendMessage(player, s6) + this.sendMessage(player, playerMessage) .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -525,26 +523,26 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace("[RIGHT-CLICK]", "") .replace("[LEFT-CLICK]", ""))); } else { - if (s6.contains("[RIGHT-CLICK]") - && s6.contains("[LEFT-CLICK]")) { + if (playerMessage.contains("[RIGHT-CLICK]") + && playerMessage.contains("[LEFT-CLICK]")) { continue; } player.sendMessage(ChatColor .translateAlternateColorCodes( '&', - this.sendMessage(player, s6) + this.sendMessage(player, playerMessage) .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -556,15 +554,15 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace("[RIGHT-CLICK]", "") .replace("[LEFT-CLICK]", ""))); } } - for (String s7 : stringList4) { - if (s7.contains("[RIGHT-CLICK]")) { + for (final String broadcastMessage : strlBroadcastMessages) { + if (broadcastMessage.contains("[RIGHT-CLICK]")) { if (!inventoryClickEvent.isRightClick()) { continue; } @@ -574,14 +572,14 @@ public class Main extends JavaPlugin implements Listener { .translateAlternateColorCodes( '&', this.sendMessage( - player, s7) + player, broadcastMessage) .replace( "%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -593,7 +591,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace( "[RIGHT-CLICK]", @@ -601,7 +599,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "[LEFT-CLICK]", ""))); - } else if (s7.contains("[LEFT-CLICK]")) { + } else if (broadcastMessage.contains("[LEFT-CLICK]")) { if (!inventoryClickEvent.isLeftClick()) { continue; } @@ -611,14 +609,14 @@ public class Main extends JavaPlugin implements Listener { .translateAlternateColorCodes( '&', this.sendMessage( - player, s7) + player, broadcastMessage) .replace( "%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -630,7 +628,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace( "[RIGHT-CLICK]", @@ -639,8 +637,8 @@ public class Main extends JavaPlugin implements Listener { "[LEFT-CLICK]", ""))); } else { - if (s7.contains("[RIGHT-CLICK]") - && s7.contains("[LEFT-CLICK]")) { + if (broadcastMessage.contains("[RIGHT-CLICK]") + && broadcastMessage.contains("[LEFT-CLICK]")) { continue; } this.getServer() @@ -649,14 +647,14 @@ public class Main extends JavaPlugin implements Listener { .translateAlternateColorCodes( '&', this.sendMessage( - player, s7) + player, broadcastMessage) .replace( "%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -668,7 +666,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString()) .replace( "[RIGHT-CLICK]", @@ -678,20 +676,20 @@ public class Main extends JavaPlugin implements Listener { ""))); } } - if (!this.getConfig().getBoolean("GUI." + s + ".Bungee") + if (!this.getConfig().getBoolean("GUI." + guiName + ".Bungee") || this.getConfig() .getString( - "GUI." + s + ".GUIItems." + s2 - + "." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + + "." + guiItem + ".SendToServer", "") .isEmpty()) { continue; } - ByteArrayDataOutput dataOutput = ByteStreams + final ByteArrayDataOutput dataOutput = ByteStreams .newDataOutput(); dataOutput.writeUTF("Connect"); dataOutput.writeUTF(this.getConfig().getString( - "GUI." + s + ".GUIItems." + s2 + "." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + "." + guiItem + ".SendToServer", "")); Bukkit.getPlayer(player.getName()).sendPluginMessage(this, "BungeeCord", dataOutput.toByteArray()); @@ -710,7 +708,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -722,14 +720,14 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString())))); - if (upperCase2.isEmpty()) { + if (strNoPermsClickSound.isEmpty()) { continue; } - float n3 = 1.0f; + final float fSoundTime = 1.0f; player.playSound(player.getLocation(), - Sound.valueOf(upperCase2), n3, n3); + Sound.valueOf(strNoPermsClickSound), fSoundTime, fSoundTime); } } else { player.closeInventory(); @@ -745,7 +743,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -757,14 +755,14 @@ public class Main extends JavaPlugin implements Listener { .replace( "%COMMANDSCOST%", new StringBuilder() - .append(n) + .append(dblCommandsCost) .toString())))); - if (upperCase2.isEmpty()) { + if (strNoPermsClickSound.isEmpty()) { continue; } - float n4 = 1.0f; + final float fSoundTime = 1.0f; player.playSound(player.getLocation(), - Sound.valueOf(upperCase2), n4, n4); + Sound.valueOf(strNoPermsClickSound), fSoundTime, fSoundTime); } } } @@ -772,26 +770,26 @@ public class Main extends JavaPlugin implements Listener { } inventoryClickEvent.setCancelled(true); } else { - if (this.getConfig().getBoolean("GUI." + s + ".InventoryGUIItemMovement")) { + if (this.getConfig().getBoolean("GUI." + guiName + ".InventoryGUIItemMovement")) { continue; } - List stringList5 = this.getConfig().getStringList( - "GUI." + s + ".InventoryGUIItems"); - for (int i = 0; i < stringList5.size(); ++i) { - String[] split = stringList5.get(i).split(";"); + final List strlInventoryGUIItems = this.getConfig().getStringList( + "GUI." + guiName + ".InventoryGUIItems"); + for (int i = 0; i < strlInventoryGUIItems.size(); ++i) { + final String[] itemInfo = strlInventoryGUIItems.get(i).split(";"); if (inventoryClickEvent.getCurrentItem().getType() == Material - .getMaterial(split[1]) + .getMaterial(itemInfo[1]) && inventoryClickEvent.getCurrentItem().getData().getData() == (byte) Integer - .parseInt(split[2]) + .parseInt(itemInfo[2]) && inventoryClickEvent .getCurrentItem() .getItemMeta() .getDisplayName() .contentEquals( ChatColor.translateAlternateColorCodes('&', - split[0])) + itemInfo[0])) && inventoryClickEvent.getCurrentItem().getEnchantments() - .toString().contentEquals(split[3])) { + .toString().contentEquals(itemInfo[3])) { inventoryClickEvent.setCancelled(true); } } @@ -802,26 +800,26 @@ public class Main extends JavaPlugin implements Listener { @SuppressWarnings("deprecation") @EventHandler - public void playerDropEvent(PlayerDropItemEvent playerDropItemEvent) { - for (String s : this.getConfig().getConfigurationSection("GUI").getKeys(false)) { - if (!this.getConfig().getBoolean("GUI." + s + ".InventoryGUIItemMovement")) { - List stringList = this.getConfig().getStringList( - "GUI." + s + ".InventoryGUIItems"); - for (int i = 0; i < stringList.size(); ++i) { - String[] split = stringList.get(i).split(";"); + public void playerDropEvent(final PlayerDropItemEvent playerDropItemEvent) { + for (final String guiName : this.getConfig().getConfigurationSection("GUI").getKeys(false)) { + if (!this.getConfig().getBoolean("GUI." + guiName + ".InventoryGUIItemMovement")) { + final List strlInventoryGUIItems = this.getConfig().getStringList( + "GUI." + guiName + ".InventoryGUIItems"); + for (int i = 0; i < strlInventoryGUIItems.size(); ++i) { + final String[] itemInfo = strlInventoryGUIItems.get(i).split(";"); if (playerDropItemEvent.getItemDrop().getItemStack().getType() == Material - .getMaterial(split[1]) + .getMaterial(itemInfo[1]) && playerDropItemEvent.getItemDrop().getItemStack().getData().getData() == (byte) Integer - .parseInt(split[2]) + .parseInt(itemInfo[2]) && playerDropItemEvent .getItemDrop() .getItemStack() .getItemMeta() .getDisplayName() .contentEquals( - ChatColor.translateAlternateColorCodes('&', split[0])) + ChatColor.translateAlternateColorCodes('&', itemInfo[0])) && playerDropItemEvent.getItemDrop().getItemStack().getEnchantments() - .toString().contentEquals(split[3])) { + .toString().contentEquals(itemInfo[3])) { playerDropItemEvent.setCancelled(true); } } @@ -831,30 +829,30 @@ public class Main extends JavaPlugin implements Listener { @SuppressWarnings("deprecation") @EventHandler - public void playerInteract(PlayerInteractEvent playerInteractEvent) { + public void playerInteract(final PlayerInteractEvent playerInteractEvent) { if (playerInteractEvent.getAction() == Action.RIGHT_CLICK_BLOCK || playerInteractEvent.getAction() == Action.RIGHT_CLICK_AIR) { - Player player = playerInteractEvent.getPlayer(); - for (String s : this.getConfig().getConfigurationSection("GUI").getKeys(false)) { - List stringList = this.getConfig().getStringList( - "GUI." + s + ".InventoryGUIItems"); - for (int i = 0; i < stringList.size(); ++i) { - String[] split = stringList.get(i).split(";"); - if ((split[4].equalsIgnoreCase("both") || split[4].equalsIgnoreCase("right")) + final Player player = playerInteractEvent.getPlayer(); + for (final String guiName : this.getConfig().getConfigurationSection("GUI").getKeys(false)) { + final List strlInventoryGUIItems = this.getConfig().getStringList( + "GUI." + guiName + ".InventoryGUIItems"); + for (int i = 0; i < strlInventoryGUIItems.size(); ++i) { + final String[] itemInfo = strlInventoryGUIItems.get(i).split(";"); + if ((itemInfo[4].equalsIgnoreCase("both") || itemInfo[4].equalsIgnoreCase("right")) && playerInteractEvent.getItem().getType() == Material - .getMaterial(split[1]) + .getMaterial(itemInfo[1]) && playerInteractEvent.getItem().getData().getData() == (byte) Integer - .parseInt(split[2]) + .parseInt(itemInfo[2]) && playerInteractEvent .getItem() .getItemMeta() .getDisplayName() .contentEquals( - ChatColor.translateAlternateColorCodes('&', split[0])) + ChatColor.translateAlternateColorCodes('&', itemInfo[0])) && playerInteractEvent.getItem().getEnchantments().toString() - .contentEquals(split[3])) { + .contentEquals(itemInfo[3])) { player.performCommand("customgui open " - + this.getConfig().getStringList("GUI." + s + ".GUICommand").get(0)); + + this.getConfig().getStringList("GUI." + guiName + ".GUICommand").get(0)); playerInteractEvent.setCancelled(true); } } @@ -862,27 +860,27 @@ public class Main extends JavaPlugin implements Listener { } if (playerInteractEvent.getAction() == Action.LEFT_CLICK_BLOCK || playerInteractEvent.getAction() == Action.LEFT_CLICK_AIR) { - Player player2 = playerInteractEvent.getPlayer(); - for (String s2 : this.getConfig().getConfigurationSection("GUI").getKeys(false)) { - List stringList2 = this.getConfig().getStringList( - "GUI." + s2 + ".InventoryGUIItems"); - for (int j = 0; j < stringList2.size(); ++j) { - String[] split2 = stringList2.get(j).split(";"); - if ((split2[4].equalsIgnoreCase("both") || split2[4].equalsIgnoreCase("left")) + final Player player = playerInteractEvent.getPlayer(); + for (final String guiName : this.getConfig().getConfigurationSection("GUI").getKeys(false)) { + final List strlInventoryGUIItems = this.getConfig().getStringList( + "GUI." + guiName + ".InventoryGUIItems"); + for (int j = 0; j < strlInventoryGUIItems.size(); ++j) { + final String[] itemInfo = strlInventoryGUIItems.get(j).split(";"); + if ((itemInfo[4].equalsIgnoreCase("both") || itemInfo[4].equalsIgnoreCase("left")) && playerInteractEvent.getItem().getType() == Material - .getMaterial(split2[1]) + .getMaterial(itemInfo[1]) && playerInteractEvent.getItem().getData().getData() == (byte) Integer - .parseInt(split2[2]) + .parseInt(itemInfo[2]) && playerInteractEvent .getItem() .getItemMeta() .getDisplayName() .contentEquals( - ChatColor.translateAlternateColorCodes('&', split2[0])) + ChatColor.translateAlternateColorCodes('&', itemInfo[0])) && playerInteractEvent.getItem().getEnchantments().toString() - .contentEquals(split2[3])) { - player2.performCommand("customgui open " - + this.getConfig().getStringList("GUI." + s2 + ".GUICommand") + .contentEquals(itemInfo[3])) { + player.performCommand("customgui open " + + this.getConfig().getStringList("GUI." + guiName + ".GUICommand") .get(0)); playerInteractEvent.setCancelled(true); } @@ -891,20 +889,15 @@ public class Main extends JavaPlugin implements Listener { } } - @Override @SuppressWarnings("deprecation") - public boolean onCommand(CommandSender commandSender, Command command, String s, String[] array) { - Player player = null; - if (commandSender instanceof Player) { - player = (Player) commandSender; - } else { - this.getServer().getConsoleSender().sendMessage("&c控制台无法使用此命令!"); - return true; - } + @Override + public boolean onCommand(final CommandSender commandSender, final Command command, + final String s, final String[] args) { if (command.getName().equalsIgnoreCase("customgui")) { - if (array.length == 0) { + final Player player = (Player) commandSender; + if (args.length == 0) { if (player.hasPermission("customgui.help")) { - Iterator iterator = this.messagesFile.getStringList("HelpFormat") + final Iterator iterator = this.messagesFile.getStringList("HelpFormat") .iterator(); while (iterator.hasNext()) { player.sendMessage(ChatColor.translateAlternateColorCodes('&', @@ -920,7 +913,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder().append( - Main.economy.getBalance(player)) + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", @@ -929,7 +922,7 @@ public class Main extends JavaPlugin implements Listener { } return false; } - if (array[0].equalsIgnoreCase("reload")) { + if (args[0].equalsIgnoreCase("reload")) { if (player.hasPermission("customgui.reload")) { this.reloadConfig(); try { @@ -951,7 +944,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder().append( - Main.economy.getBalance(player)) + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", @@ -967,17 +960,17 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder().append( - Main.economy.getBalance(player)) + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", new StringBuilder().append(player.getLevel()) .toString())))); } - } else if (array[0].equalsIgnoreCase("help")) { + } else if (args[0].equalsIgnoreCase("help")) { if (player.hasPermission("customgui.help")) { - Iterator iterator2 = this.messagesFile.getStringList("HelpFormat") - .iterator(); + final Iterator iterator2 = this.messagesFile + .getStringList("HelpFormat").iterator(); while (iterator2.hasNext()) { player.sendMessage(ChatColor.translateAlternateColorCodes('&', this.sendMessage(player, iterator2.next()))); @@ -992,32 +985,34 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder().append( - Main.economy.getBalance(player)) + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", new StringBuilder().append(player.getLevel()) .toString())))); } - } else if (array[0].equalsIgnoreCase("setitem") && array.length == 3) { + } else if (args[0].equalsIgnoreCase("setitem") && args.length == 3) { if (player.hasPermission("customgui.setitem")) { if (this.getConfig().getConfigurationSection("GUI").getKeys(false) - .contains(array[1])) { - if (array[2].equalsIgnoreCase("both") || array[2].equalsIgnoreCase("right") - || array[2].equalsIgnoreCase("left")) { - List stringList = this.getConfig().getStringList( - "GUI." + array[1] + ".InventoryGUIItems"); - String displayName = player.getItemInHand().getItemMeta() + .contains(args[1])) { + if (args[2].equalsIgnoreCase("both") || args[2].equalsIgnoreCase("right") + || args[2].equalsIgnoreCase("left")) { + final List strlInventoryGUIItems = this.getConfig() + .getStringList("GUI." + args[1] + ".InventoryGUIItems"); + final String displayName = player.getItemInHand().getItemMeta() .getDisplayName(); - String string = player.getItemInHand().getEnchantments().toString(); - String name = player.getItemInHand().getType().name(); - byte data = player.getItemInHand().getData().getData(); - if (!stringList.contains(String.valueOf(displayName) + ";" + name + ";" - + data + ";" + string + ";" + array[2].toUpperCase())) { - stringList.add(String.valueOf(displayName) + ";" + name + ";" - + data + ";" + string + ";" + array[2].toUpperCase()); - this.getConfig().set("GUI." + array[1] + ".InventoryGUIItems", - stringList); + final String ench = player.getItemInHand().getEnchantments() + .toString(); + final String itemtype = player.getItemInHand().getType().name(); + final byte itemdata = player.getItemInHand().getData().getData(); + if (!strlInventoryGUIItems.contains(String.valueOf(displayName) + ";" + + itemtype + ";" + itemdata + ";" + ench + ";" + + args[2].toUpperCase())) { + strlInventoryGUIItems.add(String.valueOf(displayName) + ";" + itemtype + + ";" + itemdata + ";" + ench + ";" + args[2].toUpperCase()); + this.getConfig().set("GUI." + args[1] + ".InventoryGUIItems", + strlInventoryGUIItems); this.saveConfig(); player.sendMessage(ChatColor.translateAlternateColorCodes( '&', @@ -1029,7 +1024,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1037,7 +1032,7 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder().append( player.getLevel()) .toString()) - .replace("%GUI%", array[1])))); + .replace("%GUI%", args[1])))); } else { player.sendMessage(ChatColor.translateAlternateColorCodes( '&', @@ -1049,7 +1044,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1057,7 +1052,7 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder().append( player.getLevel()) .toString()) - .replace("%GUI%", array[1])))); + .replace("%GUI%", args[1])))); } } else { player.sendMessage(ChatColor.translateAlternateColorCodes('&', this @@ -1068,9 +1063,8 @@ public class Main extends JavaPlugin implements Listener { .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", - new StringBuilder() - .append(Main.economy - .getBalance(player)) + new StringBuilder().append( + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", @@ -1087,7 +1081,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder().append( - Main.economy.getBalance(player)) + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", @@ -1102,39 +1096,42 @@ public class Main extends JavaPlugin implements Listener { .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", - new StringBuilder().append( - Main.economy.getBalance(player)).toString()) + new StringBuilder() + .append(Main.econ.getBalance(player)) + .toString()) .replace( "%PLAYERLEVEL%", new StringBuilder().append(player.getLevel()) .toString()))); } - } else if (array[0].equalsIgnoreCase("deleteitem") && array.length == 2) { + } else if (args[0].equalsIgnoreCase("deleteitem") && args.length == 2) { if (player.hasPermission("customgui.deleteitem")) { if (this.getConfig().getConfigurationSection("GUI").getKeys(false) - .contains(array[1])) { - List stringList2 = this.getConfig().getStringList( - "GUI." + array[1] + ".InventoryGUIItems"); - String displayName2 = player.getItemInHand().getItemMeta().getDisplayName(); - String string2 = player.getItemInHand().getEnchantments().toString(); - String name2 = player.getItemInHand().getType().name(); - byte data2 = player.getItemInHand().getData().getData(); - if (stringList2.contains(String.valueOf(displayName2) + ";" + name2 + ";" - + data2 + ";" + string2 + ";" + "RIGHT") - || stringList2.contains(String.valueOf(displayName2) + ";" + name2 - + ";" + data2 + ";" + string2 + ";" + "LEFT") - || stringList2.contains(String.valueOf(displayName2) + ";" + name2 - + ";" + data2 + ";" + string2 + ";" + "BOTH")) { - ArrayList list = new ArrayList(); + .contains(args[1])) { + final List strlInventoryGUIItems = this.getConfig().getStringList( + "GUI." + args[1] + ".InventoryGUIItems"); + final String displayName = player.getItemInHand().getItemMeta() + .getDisplayName(); + final String ench = player.getItemInHand().getEnchantments().toString(); + final String itemtype = player.getItemInHand().getType().name(); + final byte itemdata = player.getItemInHand().getData().getData(); + if (strlInventoryGUIItems.contains(String.valueOf(displayName) + ";" + + itemtype + ";" + itemdata + ";" + ench + ";" + "RIGHT") + || strlInventoryGUIItems.contains(String.valueOf(displayName) + + ";" + itemtype + ";" + itemdata + ";" + ench + ";" + "LEFT") + || strlInventoryGUIItems.contains(String.valueOf(displayName) + + ";" + itemtype + ";" + itemdata + ";" + ench + ";" + "BOTH")) { + final ArrayList list = new ArrayList(); list.add("RIGHT"); list.add("LEFT"); list.add("BOTH"); - Iterator iterator3 = list.iterator(); + final Iterator iterator3 = list.iterator(); while (iterator3.hasNext()) { - stringList2.remove(String.valueOf(displayName2) + ";" + name2 + ";" - + data2 + ";" + string2 + ";" + iterator3.next()); - this.getConfig().set("GUI." + array[1] + ".InventoryGUIItems", - stringList2); + strlInventoryGUIItems.remove(String.valueOf(displayName) + ";" + + itemtype + ";" + itemdata + ";" + ench + ";" + + iterator3.next()); + this.getConfig().set("GUI." + args[1] + ".InventoryGUIItems", + strlInventoryGUIItems); this.saveConfig(); } player.sendMessage(ChatColor.translateAlternateColorCodes('&', this @@ -1145,15 +1142,14 @@ public class Main extends JavaPlugin implements Listener { .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", - new StringBuilder() - .append(Main.economy - .getBalance(player)) + new StringBuilder().append( + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", new StringBuilder().append( player.getLevel()).toString()) - .replace("%GUI%", array[1])))); + .replace("%GUI%", args[1])))); } else { player.sendMessage(ChatColor.translateAlternateColorCodes('&', this .sendMessage( @@ -1163,15 +1159,14 @@ public class Main extends JavaPlugin implements Listener { .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", - new StringBuilder() - .append(Main.economy - .getBalance(player)) + new StringBuilder().append( + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", new StringBuilder().append( player.getLevel()).toString()) - .replace("%GUI%", array[1])))); + .replace("%GUI%", args[1])))); } } else { player.sendMessage(ChatColor.translateAlternateColorCodes('&', this @@ -1183,7 +1178,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder().append( - Main.economy.getBalance(player)) + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", @@ -1200,48 +1195,50 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder().append( - Main.economy.getBalance(player)) + Main.econ.getBalance(player)) .toString()) .replace( "%PLAYERLEVEL%", new StringBuilder().append(player.getLevel()) .toString())))); } - } else if (array[0].equalsIgnoreCase("open") && array.length == 2) { - Set keys = this.getConfig().getConfigurationSection("GUI").getKeys(false); - for (String s2 : keys) { - Iterator iterator5 = this.getConfig() - .getStringList("GUI." + s2 + ".GUICommand").iterator(); - while (iterator5.hasNext()) { - if (array[1].equalsIgnoreCase(iterator5.next())) { - if (keys.contains(s2)) { - String string3 = this.getConfig().getString( - "GUI." + s2 + ".GUIPermission", ""); - List stringList3 = this.getConfig().getStringList( - "GUI." + s2 + ".WhitelistedWorlds"); - if (stringList3.contains(player.getWorld().getName()) - || stringList3 == null || stringList3.isEmpty()) { - if (player.hasPermission(string3)) { - String string4 = this.getConfig().getString( - "GUI." + s2 + ".ChestName", ""); - int int1 = this.getConfig().getInt( - "GUI." + s2 + ".ChestSize"); - Set keys2 = this.getConfig() - .getConfigurationSection("GUI." + s2 + ".GUIItems") + } else if (args[0].equalsIgnoreCase("open") && args.length == 2) { + final Set strGUI = this.getConfig().getConfigurationSection("GUI") + .getKeys(false); + for (final String guiName : strGUI) { + final Iterator iGUICommand = this.getConfig() + .getStringList("GUI." + guiName + ".GUICommand").iterator(); + while (iGUICommand.hasNext()) { + if (args[1].equalsIgnoreCase(iGUICommand.next())) { + if (strGUI.contains(guiName)) { + final String strGUIPermission = this.getConfig().getString( + "GUI." + guiName + ".GUIPermission", ""); + final List strlWhitelistedWorlds = this.getConfig() + .getStringList("GUI." + guiName + ".WhitelistedWorlds"); + if (strlWhitelistedWorlds.contains(player.getWorld().getName()) + || strlWhitelistedWorlds == null + || strlWhitelistedWorlds.isEmpty()) { + if (player.hasPermission(strGUIPermission)) { + final String strChestName = this.getConfig().getString( + "GUI." + guiName + ".ChestName", ""); + final int intChestSize = this.getConfig().getInt( + "GUI." + guiName + ".ChestSize"); + final Set strGUIItems = this.getConfig() + .getConfigurationSection("GUI." + guiName + ".GUIItems") .getKeys(false); - Inventory inventory = Bukkit + final Inventory inventory = Bukkit .createInventory( (InventoryHolder) null, - int1, + intChestSize, ChatColor .translateAlternateColorCodes( '&', - string4.replace("%PLAYER%", + strChestName.replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1250,141 +1247,130 @@ public class Main extends JavaPlugin implements Listener { .append(player .getLevel()) .toString()))); - for (String s3 : keys2) { - Double value = this.getConfig().getDouble( - "GUI." + s2 + ".GUIItems." + s3 + for (final String guiItemName : strGUIItems) { + final Double value = this.getConfig().getDouble( + "GUI." + guiName + ".GUIItems." + guiItemName + ".OPItem.CommandsCost"); - Double value2 = this.getConfig().getDouble( - "GUI." + s2 + ".GUIItems." + s3 + final Double value2 = this.getConfig().getDouble( + "GUI." + guiName + ".GUIItems." + guiItemName + ".PermissionItem.CommandsCost"); - Double value3 = this.getConfig().getDouble( - "GUI." + s2 + ".GUIItems." + s3 + final Double value3 = this.getConfig().getDouble( + "GUI." + guiName + ".GUIItems." + guiItemName + ".BalanceItem.CommandsCost"); - Double value4 = this.getConfig().getDouble( - "GUI." + s2 + ".GUIItems." + s3 + final Double value4 = this.getConfig().getDouble( + "GUI." + guiName + ".GUIItems." + guiItemName + ".EXPItem.CommandsCost"); - Double value5 = this.getConfig().getDouble( - "GUI." + s2 + ".GUIItems." + s3 + final Double value5 = this.getConfig().getDouble( + "GUI." + guiName + ".GUIItems." + guiItemName + ".DefaultItem.CommandsCost"); - String[] split = this + final String[] split = this .getConfig() .getString( - "GUI." + s2 + ".GUIItems." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + ".OPItem.Item", "") .toUpperCase().split(";"); - String string5 = this.getConfig().getString( - "GUI." + s2 + ".GUIItems." + s3 + final String string5 = this.getConfig().getString( + "GUI." + guiName + ".GUIItems." + guiItemName + ".OPItem.Name", ""); - List stringList4 = this.getConfig() + final List strlOPItemLore = this.getConfig() .getStringList( - "GUI." + s2 + ".GUIItems." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + ".OPItem.Lore"); - String[] split2 = this + final List strlOPItemEnchant = this.getConfig() + .getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + + ".OPItem.Enchant"); + final String strPermissionItemPermission = this + .getConfig().getString( + "GUI." + guiName + ".GUIItems." + guiItemName + + ".PermissionItem.Permission", + ""); + final String[] splPermissionItemItem = this .getConfig() .getString( - "GUI." + s2 + ".GUIItems." + s3 - + ".OPItem.Enchant", "") - .toUpperCase().split(";"); - String s4 = split2[0]; - String string6 = this.getConfig().getString( - "GUI." + s2 + ".GUIItems." + s3 - + ".PermissionItem.Permission", ""); - String[] split3 = this - .getConfig() - .getString( - "GUI." + s2 + ".GUIItems." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + ".PermissionItem.Item", "") .toUpperCase().split(";"); - String string7 = this.getConfig().getString( - "GUI." + s2 + ".GUIItems." + s3 - + ".PermissionItem.Name", ""); - List stringList5 = this.getConfig() - .getStringList( - "GUI." + s2 + ".GUIItems." + s3 + final String strPermissionItemName = this.getConfig() + .getString( + "GUI." + guiName + ".GUIItems." + guiItemName + + ".PermissionItem.Name", ""); + final List strlPermissionItemLore = this + .getConfig().getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + ".PermissionItem.Lore"); - String[] split4 = this - .getConfig() - .getString( - "GUI." + s2 + ".GUIItems." + s3 - + ".PermissionItem.Enchant", "") - .toUpperCase().split(";"); - String s5 = split4[0]; - int int2 = this.getConfig().getInt( - "GUI." + s2 + ".GUIItems." + s3 + final List strlPermissionItemEnchant = this + .getConfig().getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + + ".PermissionItem.Enchant"); + final int intBalanceItemBalance = this.getConfig() + .getInt("GUI." + guiName + ".GUIItems." + guiItemName + ".BalanceItem.Balance"); - String[] split5 = this + final String[] splBalanceItemItem = this .getConfig() .getString( - "GUI." + s2 + ".GUIItems." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + ".BalanceItem.Item", "") .toUpperCase().split(";"); - String string8 = this.getConfig().getString( - "GUI." + s2 + ".GUIItems." + s3 - + ".BalanceItem.Name", ""); - List stringList6 = this.getConfig() - .getStringList( - "GUI." + s2 + ".GUIItems." + s3 + final String strBalanceItemName = this.getConfig() + .getString( + "GUI." + guiName + ".GUIItems." + guiItemName + + ".BalanceItem.Name", ""); + final List strlBalanceItemLore = this + .getConfig().getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + ".BalanceItem.Lore"); - String[] split6 = this - .getConfig() - .getString( - "GUI." + s2 + ".GUIItems." + s3 - + ".BalanceItem.Enchant", "") - .toUpperCase().split(";"); - String s6 = split6[0]; - int int3 = this.getConfig().getInt( - "GUI." + s2 + ".GUIItems." + s3 + final List stringList9 = this.getConfig() + .getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + + ".BalanceItem.Enchant"); + final int int3 = this.getConfig().getInt( + "GUI." + guiName + ".GUIItems." + guiItemName + ".EXPItem.Level"); - String[] split7 = this + final String[] split4 = this .getConfig() .getString( - "GUI." + s2 + ".GUIItems." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + ".EXPItem.Item", "") .toUpperCase().split(";"); - String string9 = this.getConfig().getString( - "GUI." + s2 + ".GUIItems." + s3 + final String string9 = this.getConfig().getString( + "GUI." + guiName + ".GUIItems." + guiItemName + ".EXPItem.Name", ""); - List stringList7 = this.getConfig() + final List stringList10 = this.getConfig() .getStringList( - "GUI." + s2 + ".GUIItems." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + ".EXPItem.Lore"); - String[] split8 = this + final List stringList11 = this.getConfig() + .getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + + ".EXPItem.Enchant"); + final String[] split5 = this .getConfig() .getString( - "GUI." + s2 + ".GUIItems." + s3 - + ".EXPItem.Enchant", "") - .toUpperCase().split(";"); - String s7 = split8[0]; - String[] split9 = this - .getConfig() - .getString( - "GUI." + s2 + ".GUIItems." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + ".DefaultItem.Item", "") .toUpperCase().split(";"); - String string10 = this.getConfig().getString( - "GUI." + s2 + ".GUIItems." + s3 + final String string10 = this.getConfig().getString( + "GUI." + guiName + ".GUIItems." + guiItemName + ".DefaultItem.Name", ""); - List stringList8 = this.getConfig() + final List stringList12 = this.getConfig() .getStringList( - "GUI." + s2 + ".GUIItems." + s3 + "GUI." + guiName + ".GUIItems." + guiItemName + ".DefaultItem.Lore"); - String[] split10 = this - .getConfig() - .getString( - "GUI." + s2 + ".GUIItems." + s3 - + ".DefaultItem.Enchant", "") - .toUpperCase().split(";"); - String s8 = split10[0]; - int int4 = this.getConfig().getInt( - "GUI." + s2 + ".GUIItems." + s3 + ".ItemSlot"); + final List stringList13 = this.getConfig() + .getStringList( + "GUI." + guiName + ".GUIItems." + guiItemName + + ".DefaultItem.Enchant"); + final int int4 = this.getConfig().getInt( + "GUI." + guiName + ".GUIItems." + guiItemName + ".ItemSlot"); if (player.isOp() && this.getConfig().getBoolean( - "GUI." + s2 + ".OPItem")) { + "GUI." + guiName + ".OPItem")) { if (split[0].equalsIgnoreCase("SKULL_ITEM")) { - ItemStack itemStack = new ItemStack( + final ItemStack itemStack = new ItemStack( Material.SKULL_ITEM, Integer.parseInt(split[1]), (short) 3); - SkullMeta itemMeta = (SkullMeta) itemStack + final SkullMeta itemMeta = (SkullMeta) itemStack .getItemMeta(); itemMeta.setOwner(split[2].replace("%PLAYER%", player.getName())); @@ -1397,7 +1383,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1411,9 +1397,9 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value) .toString())))); - ArrayList lore = new ArrayList(); - if (!stringList4.isEmpty()) { - Iterator iterator7 = stringList4 + final ArrayList lore = new ArrayList(); + if (!strlOPItemLore.isEmpty()) { + final Iterator iterator7 = strlOPItemLore .iterator(); while (iterator7.hasNext()) { lore.add(ChatColor.translateAlternateColorCodes( @@ -1428,7 +1414,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1446,18 +1432,27 @@ public class Main extends JavaPlugin implements Listener { } itemMeta.setLore(lore); itemStack.setItemMeta(itemMeta); - if (!s4.isEmpty()) { - itemStack.addUnsafeEnchantment( - Enchantment.getByName(split2[0]), - Integer.parseInt(split2[1])); + if (!strlOPItemEnchant.isEmpty()) { + final Iterator iterator8 = strlOPItemEnchant + .iterator(); + while (iterator8.hasNext()) { + final String[] split6 = iterator8 + .next().toUpperCase() + .split(";"); + itemStack.addUnsafeEnchantment( + Enchantment + .getByName(split6[0]), + Integer.parseInt(split6[1])); + } } inventory.setItem(int4, itemStack); } else { - ItemStack itemStack2 = new ItemStack( + final ItemStack itemStack2 = new ItemStack( Material.getMaterial(split[0]), Integer.parseInt(split[1]), (byte) Integer.parseInt(split[2])); - ItemMeta itemMeta2 = itemStack2.getItemMeta(); + final ItemMeta itemMeta2 = itemStack2 + .getItemMeta(); itemMeta2 .setDisplayName(ChatColor.translateAlternateColorCodes( '&', @@ -1469,7 +1464,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1483,16 +1478,16 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value) .toString())))); - ArrayList lore2 = new ArrayList(); - if (!stringList4.isEmpty()) { - Iterator iterator8 = stringList4 + final ArrayList lore2 = new ArrayList(); + if (!strlOPItemLore.isEmpty()) { + final Iterator iterator9 = strlOPItemLore .iterator(); - while (iterator8.hasNext()) { + while (iterator9.hasNext()) { lore2.add(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - iterator8 + iterator9 .next() .replace( "%PLAYER%", @@ -1500,7 +1495,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1518,37 +1513,49 @@ public class Main extends JavaPlugin implements Listener { } itemMeta2.setLore(lore2); itemStack2.setItemMeta(itemMeta2); - if (!s4.isEmpty()) { - itemStack2.addUnsafeEnchantment( - Enchantment.getByName(split2[0]), - Integer.parseInt(split2[1])); + if (!strlOPItemEnchant.isEmpty()) { + final Iterator iterator10 = strlOPItemEnchant + .iterator(); + while (iterator10.hasNext()) { + final String[] split7 = iterator10 + .next().toUpperCase() + .split(";"); + itemStack2.addUnsafeEnchantment( + Enchantment + .getByName(split7[0]), + Integer.parseInt(split7[1])); + } } inventory.setItem(int4, itemStack2); } - } else if (player.hasPermission(string6) + } else if (player + .hasPermission(strPermissionItemPermission) && !player.isOp() && this.getConfig().getBoolean( - "GUI." + s2 + ".PermissionItem")) { - if (split3[0].equalsIgnoreCase("SKULL_ITEM")) { - ItemStack itemStack3 = new ItemStack( + "GUI." + guiName + ".PermissionItem")) { + if (splPermissionItemItem[0] + .equalsIgnoreCase("SKULL_ITEM")) { + final ItemStack itemStack3 = new ItemStack( Material.SKULL_ITEM, - Integer.parseInt(split3[1]), (short) 3); - SkullMeta itemMeta3 = (SkullMeta) itemStack3 + Integer.parseInt(splPermissionItemItem[1]), + (short) 3); + final SkullMeta itemMeta3 = (SkullMeta) itemStack3 .getItemMeta(); - itemMeta3.setOwner(split3[2].replace( - "%PLAYER%", player.getName())); + itemMeta3.setOwner(splPermissionItemItem[2] + .replace("%PLAYER%", player.getName())); itemMeta3 .setDisplayName(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - string7.replace( - "%PLAYER%", - player.getName()) + strPermissionItemName + .replace( + "%PLAYER%", + player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1562,16 +1569,16 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value2) .toString())))); - ArrayList lore3 = new ArrayList(); - if (!stringList5.isEmpty()) { - Iterator iterator9 = stringList5 + final ArrayList lore3 = new ArrayList(); + if (!strlPermissionItemLore.isEmpty()) { + final Iterator iterator11 = strlPermissionItemLore .iterator(); - while (iterator9.hasNext()) { + while (iterator11.hasNext()) { lore3.add(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - iterator9 + iterator11 .next() .replace( "%PLAYER%", @@ -1579,7 +1586,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1597,30 +1604,41 @@ public class Main extends JavaPlugin implements Listener { } itemMeta3.setLore(lore3); itemStack3.setItemMeta(itemMeta3); - if (!s5.isEmpty()) { - itemStack3.addUnsafeEnchantment( - Enchantment.getByName(split4[0]), - Integer.parseInt(split4[1])); + if (!strlPermissionItemEnchant.isEmpty()) { + final Iterator iterator12 = strlPermissionItemEnchant + .iterator(); + while (iterator12.hasNext()) { + final String[] split8 = iterator12 + .next().toUpperCase() + .split(";"); + itemStack3.addUnsafeEnchantment( + Enchantment + .getByName(split8[0]), + Integer.parseInt(split8[1])); + } } inventory.setItem(int4, itemStack3); } else { - ItemStack itemStack4 = new ItemStack( - Material.getMaterial(split3[0]), - Integer.parseInt(split3[1]), - (byte) Integer.parseInt(split3[2])); - ItemMeta itemMeta4 = itemStack4.getItemMeta(); + final ItemStack itemStack4 = new ItemStack( + Material.getMaterial(splPermissionItemItem[0]), + Integer.parseInt(splPermissionItemItem[1]), + (byte) Integer + .parseInt(splPermissionItemItem[2])); + final ItemMeta itemMeta4 = itemStack4 + .getItemMeta(); itemMeta4 .setDisplayName(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - string7.replace( - "%PLAYER%", - player.getName()) + strPermissionItemName + .replace( + "%PLAYER%", + player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1634,16 +1652,16 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value2) .toString())))); - ArrayList lore4 = new ArrayList(); - if (!stringList5.isEmpty()) { - Iterator iterator10 = stringList5 + final ArrayList lore4 = new ArrayList(); + if (!strlPermissionItemLore.isEmpty()) { + final Iterator iterator13 = strlPermissionItemLore .iterator(); - while (iterator10.hasNext()) { + while (iterator13.hasNext()) { lore4.add(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - iterator10 + iterator13 .next() .replace( "%PLAYER%", @@ -1651,7 +1669,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1669,39 +1687,50 @@ public class Main extends JavaPlugin implements Listener { } itemMeta4.setLore(lore4); itemStack4.setItemMeta(itemMeta4); - if (!s5.isEmpty()) { - itemStack4.addUnsafeEnchantment( - Enchantment.getByName(split4[0]), - Integer.parseInt(split4[1])); + if (!strlPermissionItemEnchant.isEmpty()) { + final Iterator iterator14 = strlPermissionItemEnchant + .iterator(); + while (iterator14.hasNext()) { + final String[] split9 = iterator14 + .next().toUpperCase() + .split(";"); + itemStack4.addUnsafeEnchantment( + Enchantment + .getByName(split9[0]), + Integer.parseInt(split9[1])); + } } inventory.setItem(int4, itemStack4); } - } else if (Main.economy.getBalance(player) >= int2 + } else if (Main.econ.getBalance(player) >= intBalanceItemBalance && this.getConfig().getBoolean( - "GUI." + s2 + ".BalanceItem") - && int2 != 0 + "GUI." + guiName + ".BalanceItem") + && intBalanceItemBalance != 0 && this.getServer().getPluginManager() .getPlugin("Vault") != null) { - if (split5[0].equalsIgnoreCase("SKULL_ITEM")) { - ItemStack itemStack5 = new ItemStack( + if (splBalanceItemItem[0] + .equalsIgnoreCase("SKULL_ITEM")) { + final ItemStack itemStack5 = new ItemStack( Material.SKULL_ITEM, - Integer.parseInt(split5[1]), (short) 3); - SkullMeta itemMeta5 = (SkullMeta) itemStack5 + Integer.parseInt(splBalanceItemItem[1]), + (short) 3); + final SkullMeta itemMeta5 = (SkullMeta) itemStack5 .getItemMeta(); - itemMeta5.setOwner(split5[2].replace( - "%PLAYER%", player.getName())); + itemMeta5.setOwner(splBalanceItemItem[2] + .replace("%PLAYER%", player.getName())); itemMeta5 .setDisplayName(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - string8.replace( - "%PLAYER%", - player.getName()) + strBalanceItemName + .replace( + "%PLAYER%", + player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1715,16 +1744,16 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value3) .toString())))); - ArrayList lore5 = new ArrayList(); - if (!stringList6.isEmpty()) { - Iterator iterator11 = stringList6 + final ArrayList lore5 = new ArrayList(); + if (!strlBalanceItemLore.isEmpty()) { + final Iterator iterator15 = strlBalanceItemLore .iterator(); - while (iterator11.hasNext()) { + while (iterator15.hasNext()) { lore5.add(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - iterator11 + iterator15 .next() .replace( "%PLAYER%", @@ -1732,7 +1761,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1750,30 +1779,41 @@ public class Main extends JavaPlugin implements Listener { } itemMeta5.setLore(lore5); itemStack5.setItemMeta(itemMeta5); - if (!s6.isEmpty()) { - itemStack5.addUnsafeEnchantment( - Enchantment.getByName(split6[0]), - Integer.parseInt(split6[1])); + if (!stringList9.isEmpty()) { + final Iterator iterator16 = stringList9 + .iterator(); + while (iterator16.hasNext()) { + final String[] split10 = iterator16 + .next().toUpperCase() + .split(";"); + itemStack5.addUnsafeEnchantment( + Enchantment + .getByName(split10[0]), + Integer.parseInt(split10[1])); + } } inventory.setItem(int4, itemStack5); } else { - ItemStack itemStack6 = new ItemStack( - Material.getMaterial(split5[0]), - Integer.parseInt(split5[1]), - (byte) Integer.parseInt(split5[2])); - ItemMeta itemMeta6 = itemStack6.getItemMeta(); + final ItemStack itemStack6 = new ItemStack( + Material.getMaterial(splBalanceItemItem[0]), + Integer.parseInt(splBalanceItemItem[1]), + (byte) Integer + .parseInt(splBalanceItemItem[2])); + final ItemMeta itemMeta6 = itemStack6 + .getItemMeta(); itemMeta6 .setDisplayName(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - string8.replace( - "%PLAYER%", - player.getName()) + strBalanceItemName + .replace( + "%PLAYER%", + player.getName()) .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1787,16 +1827,16 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value3) .toString())))); - ArrayList lore6 = new ArrayList(); - if (!stringList6.isEmpty()) { - Iterator iterator12 = stringList6 + final ArrayList lore6 = new ArrayList(); + if (!strlBalanceItemLore.isEmpty()) { + final Iterator iterator17 = strlBalanceItemLore .iterator(); - while (iterator12.hasNext()) { + while (iterator17.hasNext()) { lore6.add(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - iterator12 + iterator17 .next() .replace( "%PLAYER%", @@ -1804,7 +1844,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1822,23 +1862,31 @@ public class Main extends JavaPlugin implements Listener { } itemMeta6.setLore(lore6); itemStack6.setItemMeta(itemMeta6); - if (!s6.isEmpty()) { - itemStack6.addUnsafeEnchantment( - Enchantment.getByName(split6[0]), - Integer.parseInt(split6[1])); + if (!stringList9.isEmpty()) { + final Iterator iterator18 = stringList9 + .iterator(); + while (iterator18.hasNext()) { + final String[] split11 = iterator18 + .next().toUpperCase() + .split(";"); + itemStack6.addUnsafeEnchantment( + Enchantment + .getByName(split11[0]), + Integer.parseInt(split11[1])); + } } inventory.setItem(int4, itemStack6); } } else if (player.getLevel() >= int3 && this.getConfig().getBoolean( - "GUI." + s2 + ".EXPItem")) { - if (split7[0].equalsIgnoreCase("SKULL_ITEM")) { - ItemStack itemStack7 = new ItemStack( + "GUI." + guiName + ".EXPItem")) { + if (split4[0].equalsIgnoreCase("SKULL_ITEM")) { + final ItemStack itemStack7 = new ItemStack( Material.SKULL_ITEM, - Integer.parseInt(split7[1]), (short) 3); - SkullMeta itemMeta7 = (SkullMeta) itemStack7 + Integer.parseInt(split4[1]), (short) 3); + final SkullMeta itemMeta7 = (SkullMeta) itemStack7 .getItemMeta(); - itemMeta7.setOwner(split7[2].replace( + itemMeta7.setOwner(split4[2].replace( "%PLAYER%", player.getName())); itemMeta7 .setDisplayName(ChatColor.translateAlternateColorCodes( @@ -1851,7 +1899,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1865,16 +1913,16 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value4) .toString())))); - ArrayList lore7 = new ArrayList(); - if (!stringList7.isEmpty()) { - Iterator iterator13 = stringList7 + final ArrayList lore7 = new ArrayList(); + if (!stringList10.isEmpty()) { + final Iterator iterator19 = stringList10 .iterator(); - while (iterator13.hasNext()) { + while (iterator19.hasNext()) { lore7.add(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - iterator13 + iterator19 .next() .replace( "%PLAYER%", @@ -1882,7 +1930,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1900,18 +1948,27 @@ public class Main extends JavaPlugin implements Listener { } itemMeta7.setLore(lore7); itemStack7.setItemMeta(itemMeta7); - if (!s7.isEmpty()) { - itemStack7.addUnsafeEnchantment( - Enchantment.getByName(split8[0]), - Integer.parseInt(split8[1])); + if (!stringList11.isEmpty()) { + final Iterator iterator20 = stringList11 + .iterator(); + while (iterator20.hasNext()) { + final String[] split12 = iterator20 + .next().toUpperCase() + .split(";"); + itemStack7.addUnsafeEnchantment( + Enchantment + .getByName(split12[0]), + Integer.parseInt(split12[1])); + } } inventory.setItem(int4, itemStack7); } else { - ItemStack itemStack8 = new ItemStack( - Material.getMaterial(split7[0]), - Integer.parseInt(split7[1]), - (byte) Integer.parseInt(split7[2])); - ItemMeta itemMeta8 = itemStack8.getItemMeta(); + final ItemStack itemStack8 = new ItemStack( + Material.getMaterial(split4[0]), + Integer.parseInt(split4[1]), + (byte) Integer.parseInt(split4[2])); + final ItemMeta itemMeta8 = itemStack8 + .getItemMeta(); itemMeta8 .setDisplayName(ChatColor.translateAlternateColorCodes( '&', @@ -1923,7 +1980,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1937,16 +1994,16 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value4) .toString())))); - ArrayList lore8 = new ArrayList(); - if (!stringList7.isEmpty()) { - Iterator iterator14 = stringList7 + final ArrayList lore8 = new ArrayList(); + if (!stringList10.isEmpty()) { + final Iterator iterator21 = stringList10 .iterator(); - while (iterator14.hasNext()) { + while (iterator21.hasNext()) { lore8.add(ChatColor.translateAlternateColorCodes( '&', this.sendMessage( player, - iterator14 + iterator21 .next() .replace( "%PLAYER%", @@ -1954,7 +2011,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -1972,20 +2029,28 @@ public class Main extends JavaPlugin implements Listener { } itemMeta8.setLore(lore8); itemStack8.setItemMeta(itemMeta8); - if (!s7.isEmpty()) { - itemStack8.addUnsafeEnchantment( - Enchantment.getByName(split8[0]), - Integer.parseInt(split8[1])); + if (!stringList11.isEmpty()) { + final Iterator iterator22 = stringList11 + .iterator(); + while (iterator22.hasNext()) { + final String[] split13 = iterator22 + .next().toUpperCase() + .split(";"); + itemStack8.addUnsafeEnchantment( + Enchantment + .getByName(split13[0]), + Integer.parseInt(split13[1])); + } } inventory.setItem(int4, itemStack8); } - } else if (split9[0].equalsIgnoreCase("SKULL_ITEM")) { - ItemStack itemStack9 = new ItemStack( + } else if (split5[0].equalsIgnoreCase("SKULL_ITEM")) { + final ItemStack itemStack9 = new ItemStack( Material.SKULL_ITEM, - Integer.parseInt(split9[1]), (short) 3); - SkullMeta itemMeta9 = (SkullMeta) itemStack9 + Integer.parseInt(split5[1]), (short) 3); + final SkullMeta itemMeta9 = (SkullMeta) itemStack9 .getItemMeta(); - itemMeta9.setOwner(split9[2].replace("%PLAYER%", + itemMeta9.setOwner(split5[2].replace("%PLAYER%", player.getName())); itemMeta9 .setDisplayName(ChatColor @@ -1999,7 +2064,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -2013,17 +2078,17 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value5) .toString())))); - ArrayList lore9 = new ArrayList(); - if (!stringList8.isEmpty()) { - Iterator iterator15 = stringList8 + final ArrayList lore9 = new ArrayList(); + if (!stringList12.isEmpty()) { + final Iterator iterator23 = stringList12 .iterator(); - while (iterator15.hasNext()) { + while (iterator23.hasNext()) { lore9.add(ChatColor .translateAlternateColorCodes( '&', this.sendMessage( player, - iterator15 + iterator23 .next() .replace( "%PLAYER%", @@ -2031,7 +2096,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -2049,18 +2114,25 @@ public class Main extends JavaPlugin implements Listener { } itemMeta9.setLore(lore9); itemStack9.setItemMeta(itemMeta9); - if (!s8.isEmpty()) { - itemStack9.addUnsafeEnchantment( - Enchantment.getByName(split10[0]), - Integer.parseInt(split10[1])); + if (!stringList13.isEmpty()) { + final Iterator iterator24 = stringList13 + .iterator(); + while (iterator24.hasNext()) { + final String[] split14 = iterator24.next() + .toUpperCase().split(";"); + itemStack9.addUnsafeEnchantment( + Enchantment.getByName(split14[0]), + Integer.parseInt(split14[1])); + } } inventory.setItem(int4, itemStack9); } else { - ItemStack itemStack10 = new ItemStack( - Material.getMaterial(split9[0]), - Integer.parseInt(split9[1]), - (byte) Integer.parseInt(split9[2])); - ItemMeta itemMeta10 = itemStack10.getItemMeta(); + final ItemStack itemStack10 = new ItemStack( + Material.getMaterial(split5[0]), + Integer.parseInt(split5[1]), + (byte) Integer.parseInt(split5[2])); + final ItemMeta itemMeta10 = itemStack10 + .getItemMeta(); itemMeta10 .setDisplayName(ChatColor .translateAlternateColorCodes( @@ -2073,7 +2145,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -2087,17 +2159,17 @@ public class Main extends JavaPlugin implements Listener { new StringBuilder() .append(value5) .toString())))); - ArrayList lore10 = new ArrayList(); - if (!stringList8.isEmpty()) { - Iterator iterator16 = stringList8 + final ArrayList lore10 = new ArrayList(); + if (!stringList12.isEmpty()) { + final Iterator iterator25 = stringList12 .iterator(); - while (iterator16.hasNext()) { + while (iterator25.hasNext()) { lore10.add(ChatColor .translateAlternateColorCodes( '&', this.sendMessage( player, - iterator16 + iterator25 .next() .replace( "%PLAYER%", @@ -2105,7 +2177,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -2123,22 +2195,28 @@ public class Main extends JavaPlugin implements Listener { } itemMeta10.setLore(lore10); itemStack10.setItemMeta(itemMeta10); - if (!s8.isEmpty()) { - itemStack10.addUnsafeEnchantment( - Enchantment.getByName(s8), - Integer.parseInt(split10[1])); + if (!stringList13.isEmpty()) { + final Iterator iterator26 = stringList13 + .iterator(); + while (iterator26.hasNext()) { + final String[] split15 = iterator26.next() + .toUpperCase().split(";"); + itemStack10.addUnsafeEnchantment( + Enchantment.getByName(split15[0]), + Integer.parseInt(split15[1])); + } } inventory.setItem(int4, itemStack10); } } player.openInventory(inventory); - String upperCase = this.getConfig() - .getString("GUI." + s2 + ".OpenSound", "") + final String upperCase = this.getConfig() + .getString("GUI." + guiName + ".OpenSound", "") .toUpperCase(); if (upperCase.isEmpty() || upperCase == null) { continue; } - float n = 1.0f; + final float n = 1.0f; player.playSound(player.getLocation(), Sound.valueOf(upperCase), n, n); } else { @@ -2153,7 +2231,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -2173,7 +2251,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -2193,7 +2271,7 @@ public class Main extends JavaPlugin implements Listener { .replace( "%BALANCE%", new StringBuilder() - .append(Main.economy + .append(Main.econ .getBalance(player)) .toString()) .replace( @@ -2213,7 +2291,7 @@ public class Main extends JavaPlugin implements Listener { .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", - new StringBuilder().append(Main.economy.getBalance(player)) + new StringBuilder().append(Main.econ.getBalance(player)) .toString()) .replace("%PLAYERLEVEL%", new StringBuilder().append(player.getLevel()).toString())))); @@ -2225,7 +2303,7 @@ public class Main extends JavaPlugin implements Listener { .replace("%PLAYER%", player.getName()) .replace( "%BALANCE%", - new StringBuilder().append(Main.economy.getBalance(player)) + new StringBuilder().append(Main.econ.getBalance(player)) .toString()) .replace("%PLAYERLEVEL%", new StringBuilder().append(player.getLevel()).toString())))); diff --git a/src/plugin.yml b/src/plugin.yml index 2c12155..840b590 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,5 +1,5 @@ name: CustomGUI -version: 1.4.3.4 +version: 1.4.4 main: me.jacobculley.customgui.Main depend: [Vault, PlaceholderAPI]