Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onInventoryClick(InventoryClickEvent e) throws IOException {
- Inventory inv = e.getInventory();
- if (!inv.getTitle().equals("Chat Colors"))
- return;
- if (!(e.getWhoClicked() instanceof Player))
- return;
- Player p = (Player) e.getWhoClicked();
- File swdir = SkysWarsCore.get().getDataFolder();
- File swdata = new File(swdir, "player_data");
- File pdata = new File(swdata, p.getUniqueId().toString() + ".yml");
- YamlConfiguration fc = YamlConfiguration.loadConfiguration(pdata);
- ItemStack item = e.getCurrentItem();
- if (item.getItemMeta().getDisplayName().equalsIgnoreCase("Dark Blue")) {
- fc.set("chat_color", "1");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.DARK_BLUE + "Dark Blue");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("dark green")) {
- fc.set("chat_color", "2");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.DARK_GREEN + "Dark Green");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("blue")) {
- fc.set("chat_color", "3");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.BLUE + "Blue");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("dark red")) {
- fc.set("chat_color", "4");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.DARK_RED + "Dark Red");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("purple")) {
- fc.set("chat_color", "5");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(
- ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.DARK_PURPLE + "Dark Purple");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("gold")) {
- fc.set("chat_color", "6");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.GOLD + "Gold");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("gray")) {
- fc.set("chat_color", "7");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.GRAY + "Gray");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("dark gray")) {
- fc.set("chat_color", "8");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.DARK_GRAY + "Dark Gray");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("cyan")) {
- fc.set("chat_color", "9");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.DARK_AQUA + "Cyan");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("black")) {
- fc.set("chat_color", "0");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.BLACK + "Black");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("light green")) {
- fc.set("chat_color", "a");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.GREEN + "Light Green");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("aqua")) {
- fc.set("chat_color", "b");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.AQUA + "Aqua");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("light red")) {
- fc.set("chat_color", "c");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.RED + "Light Red");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("light purple")) {
- fc.set("chat_color", "d");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(
- ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.LIGHT_PURPLE + "Light Purple");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("yellow")) {
- fc.set("chat_color", "e");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.YELLOW + "Yellow");
- } else if (item.getItemMeta().getDisplayName().equalsIgnoreCase("white")) {
- fc.set("chat_color", "f");
- fc.save(pdata);
- e.setCancelled(true);
- p.closeInventory();
- p.sendMessage(ChatColor.BLUE + "You have changed your Chat Color to" + ChatColor.WHITE + "White");
- }
- e.setCancelled(true);
- p.closeInventory();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement