Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Piano;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.DyeColor;
- import org.bukkit.Sound;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.inventory.InventoryClickEvent;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.material.Wool;
- import org.bukkit.plugin.Plugin;
- public class Menu implements Listener {
- private Inventory inv;
- private ItemStack a;
- private ItemStack b;
- private ItemStack c;
- private ItemStack d;
- private ItemStack e;
- private ItemStack f;
- private ItemStack g;
- private ItemStack h;
- private ItemStack i;
- private ItemStack j;
- private ItemStack k;
- private ItemStack l;
- private ItemStack m;
- private ItemStack n;
- private ItemStack o;
- private ItemStack p2;
- private ItemStack q;
- private ItemStack r;
- private ItemStack s;
- private ItemStack t;
- private ItemStack u;
- private ItemStack v;
- private ItemStack w;
- private ItemStack x;
- private ItemStack y;
- private ItemStack z;
- public Menu(Plugin p) {
- inv = Bukkit.getServer().createInventory(null, 54, "Piano");
- a = createItem(DyeColor.BLACK, ChatColor.GRAY + "F# O0");
- b = createItem(DyeColor.WHITE, ChatColor.WHITE + "G O0");
- c = createItem(DyeColor.BLACK, ChatColor.GRAY + "G# O0");
- d = createItem(DyeColor.WHITE, ChatColor.WHITE + "A O0");
- e = createItem(DyeColor.BLACK, ChatColor.GRAY + "A# O0");
- f = createItem(DyeColor.WHITE, ChatColor.WHITE + "B O0");
- g = createItem(DyeColor.WHITE, ChatColor.WHITE + "C O0");
- h = createItem(DyeColor.BLACK, ChatColor.GRAY + "C# O0");
- i = createItem(DyeColor.WHITE, ChatColor.WHITE + "D O0");
- j = createItem(DyeColor.BLACK, ChatColor.GRAY + "D# O0");
- k = createItem(DyeColor.WHITE, ChatColor.WHITE + "E O0");
- l = createItem(DyeColor.WHITE, ChatColor.WHITE + "F O0");
- m = createItem(DyeColor.BLACK, ChatColor.GRAY + "F# O1");
- n = createItem(DyeColor.WHITE, ChatColor.WHITE + "G O1");
- o = createItem(DyeColor.BLACK, ChatColor.GRAY + "G# O1");
- p2 = createItem(DyeColor.WHITE, ChatColor.WHITE + "A O1");
- q = createItem(DyeColor.BLACK, ChatColor.GRAY + "A# O1");
- r = createItem(DyeColor.WHITE, ChatColor.WHITE + "B O1");
- s = createItem(DyeColor.WHITE, ChatColor.WHITE + "C O1");
- t = createItem(DyeColor.BLACK, ChatColor.GRAY + "C# O1");
- u = createItem(DyeColor.WHITE, ChatColor.WHITE + "D O1");
- v = createItem(DyeColor.BLACK, ChatColor.GRAY + "D# O1");
- w = createItem(DyeColor.WHITE, ChatColor.WHITE + "E O1");
- x = createItem(DyeColor.WHITE, ChatColor.WHITE + "F O1");
- y = createItem(DyeColor.BLACK, ChatColor.GRAY + "F# O2");
- z = createItem(DyeColor.RED, ChatColor.RED + "Exit");
- inv.setItem(0, a);
- inv.setItem(1, b);
- inv.setItem(2, c);
- inv.setItem(3, d);
- inv.setItem(4, e);
- inv.setItem(5, f);
- inv.setItem(6, g);
- inv.setItem(7, h);
- inv.setItem(8, i);
- inv.setItem(9, j);
- inv.setItem(10, k);
- inv.setItem(11, l);
- inv.setItem(12, m);
- inv.setItem(13, n);
- inv.setItem(14, o);
- inv.setItem(15, p2);
- inv.setItem(16, q);
- inv.setItem(17, r);
- inv.setItem(18, s);
- inv.setItem(19, t);
- inv.setItem(20, u);
- inv.setItem(21, v);
- inv.setItem(22, w);
- inv.setItem(23, x);
- inv.setItem(24, y);
- inv.setItem(53, z);
- Bukkit.getServer().getPluginManager().registerEvents(this, p);
- }
- private ItemStack createItem(DyeColor dc, String name) {
- ItemStack i = new Wool(dc).toItemStack(1);
- ItemMeta im = i.getItemMeta();
- im.setDisplayName(name);
- i.setItemMeta(im);
- return i;
- }
- public void show(Player p) {
- p.openInventory(inv);
- }
- @EventHandler
- public void onInventoryClick(InventoryClickEvent e) {
- if (!e.getInventory().getName().equalsIgnoreCase(inv.getName())) return;
- if (e.getCurrentItem().getItemMeta() == null) return;
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("F# O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.500f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("G O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.525f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("G# O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.550f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("A O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.600f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("A# O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.650f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("B O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.675f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("C O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.700f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("C# O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.750f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("D O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.800f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("D# O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.850f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("E O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.900f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("F O0")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 0.950f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("F# O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("G O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.050f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("G# O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.100f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("A O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.200f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("A# O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.250f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("B O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.350f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("C O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.400f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("C# O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.450f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("D O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.600f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("D# O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.700f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("E O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.750f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("F O1")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 1.900f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("F# O2")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.NOTE_PIANO, 1, 2.00f);
- }
- else if (e.getCurrentItem().getItemMeta().getDisplayName().contains(ChatColor.RED + "Exit")) {
- e.setCancelled(true);
- e.getWhoClicked().getLocation().getWorld().playSound(e.getWhoClicked().getLocation(), Sound.GHAST_SCREAM, 1, 1);
- e.getWhoClicked().closeInventory();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement