Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.wandnetwork;
- import java.util.Arrays;
- import org.bukkit.Bukkit;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- 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;
- public class Menu
- implements Listener
- {
- public static Main main;
- private static ItemStack skywars;
- private static ItemStack survival;
- private static ItemStack gamemode;
- private static ItemStack desaparecer;
- private static ItemStack desativarchat;
- private static ItemStack realnick;
- private static ItemStack reaparecer;
- private static ItemStack ativarchat;
- private static ItemStack lobby1;
- private static ItemStack lobby2;
- private static ItemStack lobby3;
- public static Inventory staff = Bukkit.createInventory(null, 18, "§f§l► §9Staff");
- public static Inventory lobby = Bukkit.createInventory(null, 9, "§f§l► §9Lobbys");
- public static Inventory menu = Bukkit.createInventory(null, 9, "§f§l► §9Games");
- static{
- skywars = item1("§f§l= §aSkyWars §f§l=");
- survival = item2("§f§l= §aSurvivalGames §f§l=");
- menu.setItem(2, skywars);
- menu.setItem(6, survival);
- gamemode = ite1("§9GameMode");
- desaparecer = ite2("§9Desaparecer");
- desativarchat = ite3("§9Desativar Chat");
- realnick = ite4("§9Nick Real");
- ativarchat = ite5("§9Ativar Chat");
- reaparecer = ite6("§9Aparecer");
- staff.setItem(2, gamemode);
- staff.setItem(4, desativarchat);
- staff.setItem(6, desaparecer);
- staff.setItem(9, realnick);
- staff.setItem(11, ativarchat);
- staff.setItem(13, reaparecer);
- lobby1 = lb1("§7§l= §9Lobby 1 §7§l=");
- lobby2 = lb2("§7§l= §9Lobby 2 §7§l=");
- lobby3 = lb3("§7§l= §9Lobby 3 §7§l=");
- lobby.setItem(2, lobby1);
- lobby.setItem(4, lobby2);
- lobby.setItem(6, lobby3);
- }
- private static ItemStack item1(String name)
- {
- ItemStack i = new ItemStack(new ItemStack(Material.FEATHER, 1));
- ItemMeta im = i.getItemMeta();
- im.setDisplayName(name);
- im.setLore(Arrays.asList(new String[] { "§9Lobby §f§l► §7SkyWars. §81.7 à 1.8" }));
- i.setItemMeta(im);
- return i;
- }
- private static ItemStack item2(String name2) {
- ItemStack i2 = new ItemStack(new ItemStack(Material.CHEST, 1));
- ItemMeta im2 = i2.getItemMeta();
- im2.setDisplayName(name2);
- im2.setLore(Arrays.asList(new String[] { "§9Lobby §f§l► §7Survival Games. §81.7 à 1.8" }));
- i2.setItemMeta(im2);
- return i2;
- }
- private static ItemStack ite1(String nome)
- {
- ItemStack a = new ItemStack(new ItemStack(Material.COMMAND, 1));
- ItemMeta am = a.getItemMeta();
- am.setDisplayName(nome);
- am.setLore(Arrays.asList(new String[] { "§f§l► §9Mudar de Gamemode" }));
- a.setItemMeta(am);
- return a;
- }
- private static ItemStack ite2(String nome2) {
- ItemStack a2 = new ItemStack(new ItemStack(Material.CHEST, 1));
- ItemMeta am2 = a2.getItemMeta();
- am2.setDisplayName(nome2);
- am2.setLore(Arrays.asList(new String[] { "§f§l► §9Desaparecer para outros jogadores" }));
- a2.setItemMeta(am2);
- return a2;
- }
- private static ItemStack ite3(String nome3) {
- ItemStack a3 = new ItemStack(new ItemStack(Material.REDSTONE, 1));
- ItemMeta am3 = a3.getItemMeta();
- am3.setDisplayName(nome3);
- am3.setLore(Arrays.asList(new String[] { "§f§l► §9Desativar o chat do lobby" }));
- a3.setItemMeta(am3);
- return a3;
- }
- private static ItemStack ite4(String nome4) {
- ItemStack a4 = new ItemStack(new ItemStack(Material.DIAMOND, 1));
- ItemMeta am4 = a4.getItemMeta();
- am4.setDisplayName(nome4);
- am4.setLore(Arrays.asList(new String[] { "§f§l► §9Voltar ao nick real" }));
- a4.setItemMeta(am4);
- return a4;
- }
- private static ItemStack ite5(String nome5) {
- ItemStack a5 = new ItemStack(new ItemStack(Material.DIAMOND_BLOCK, 1));
- ItemMeta am5 = a5.getItemMeta();
- am5.setDisplayName(nome5);
- am5.setLore(Arrays.asList(new String[] { "§f§l► §9Ativar Chat" }));
- a5.setItemMeta(am5);
- return a5;
- }
- private static ItemStack ite6(String nome6) {
- ItemStack a6 = new ItemStack(new ItemStack(Material.REDSTONE_BLOCK, 1));
- ItemMeta am6 = a6.getItemMeta();
- am6.setDisplayName(nome6);
- am6.setLore(Arrays.asList(new String[] { "§f§l► §9Aparecer" }));
- a6.setItemMeta(am6);
- return a6;
- }
- private static ItemStack lb1(String nime1) {
- ItemStack l = new ItemStack(new ItemStack(Material.NETHER_STAR, 1));
- ItemMeta lm = l.getItemMeta();
- lm.setDisplayName(nime1);
- lm.setLore(Arrays.asList(new String[] { "§f§l► §cVocê ja está nesse lobby!" }));
- l.setItemMeta(lm);
- return l;
- }
- private static ItemStack lb2(String nime2) {
- ItemStack l2 = new ItemStack(new ItemStack(Material.NETHER_STAR, 2));
- ItemMeta lm2 = l2.getItemMeta();
- lm2.setDisplayName(nime2);
- lm2.setLore(Arrays.asList(new String[] { "§f§l► §aClique para ir ao lobby 2!" }));
- l2.setItemMeta(lm2);
- return l2;
- }
- private static ItemStack lb3(String nime3) {
- ItemStack l3 = new ItemStack(new ItemStack(Material.NETHER_STAR, 3));
- ItemMeta lm3 = l3.getItemMeta();
- lm3.setDisplayName(nime3);
- lm3.setLore(Arrays.asList(new String[] { "§f§l► §aClique para ir ao lobby 3!" }));
- l3.setItemMeta(lm3);
- return l3;
- }
- @EventHandler
- public void onInventoryClick(InventoryClickEvent e) {
- World w = e.getWhoClicked().getWorld();
- Player p = (Player)e.getWhoClicked();
- if (!e.getInventory().getName().equalsIgnoreCase(menu.getName())) return;
- if (e.getCurrentItem().getItemMeta() == null) return;
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§f§l= §aSkyWars §f§l=")) {
- e.setCancelled(true);
- p.teleport(new Location(w, 99.5D, 100.0D, 101.5D, 45.0F, 0F));
- p.sendMessage("§9Teleporte > §7Teleportado para o SkyWars");
- p.closeInventory();
- }
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§f§l= §aSurvivalGames §f§l=")) {
- e.setCancelled(true);
- p.teleport(new Location(w, 286.5D, 28.0D, 541.5D, 180.0F, 2.0F));
- p.sendMessage("§9Teleporte > §7Teleportado para o Survival Games");
- p.closeInventory();
- }
- }
- @EventHandler
- public void onInventoryClick2(InventoryClickEvent e) {
- Player p = (Player)e.getWhoClicked();
- if (!e.getInventory().getName().equalsIgnoreCase(staff.getName())) return;
- if (e.getCurrentItem().getItemMeta() == null) return;
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§9GameMode")) {
- e.setCancelled(true);
- if(!p.hasPermission("wand.mod")){
- p.sendMessage("§9Erro > §7Sem permissão.");
- return;
- }
- if(p.getGameMode() == GameMode.CREATIVE){
- p.setGameMode(GameMode.SURVIVAL);
- p.sendMessage("§9Staff > §7Modo mudado para sobrevivencia.");
- }
- else{
- p.setGameMode(GameMode.CREATIVE);
- p.sendMessage("§9Staff > §7Modo mudado para criativo.");
- }
- p.closeInventory();
- }
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§9Desaparecer")) {
- e.setCancelled(true);
- if(!p.hasPermission("wand.mod")){
- p.sendMessage("§9Erro > §7Sem permissão.");
- return;
- }
- for (Player todos : Bukkit.getOnlinePlayers()){
- todos.hidePlayer(p);
- p.sendMessage("§9Staff > §7Desaparecido para todos.");
- }
- p.closeInventory();
- }
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§9Desativar Chat")) {
- e.setCancelled(true);
- if(!p.hasPermission("wand.mod")){
- p.sendMessage("§9Erro > §7Sem permissão.");
- return;
- }
- p.chat("/desativarchat");
- p.closeInventory();
- }
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§9Nick Real")) {
- e.setCancelled(true);
- if(!p.hasPermission("wand.mod")){
- p.sendMessage("§9Erro > §7Sem permissão.");
- return;
- }
- p.chat("/real");
- p.closeInventory();
- }
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§9Ativar Chat")) {
- e.setCancelled(true);
- if(!p.hasPermission("wand.mod")){
- p.sendMessage("§9Erro > §7Sem permissão.");
- return;
- }
- p.chat("/ativarchat");
- p.closeInventory();
- }
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§9Aparecer")) {
- e.setCancelled(true);
- if(!p.hasPermission("wand.mod")){
- p.sendMessage("§9Erro > §7Sem permissão.");
- return;
- }
- p.chat("/aparecer");
- p.closeInventory();
- }
- }
- @EventHandler
- public void onInventoryClick3(InventoryClickEvent e) {
- Player p = (Player)e.getWhoClicked();
- if (!e.getInventory().getName().equalsIgnoreCase(lobby.getName())) return;
- if (e.getCurrentItem().getItemMeta() == null) return;
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§7§l= §9Lobby 1 §7§l=")) {
- e.setCancelled(true);
- p.chat("/lobby1");
- p.closeInventory();
- }
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§7§l= §9Lobby 2 §7§l=")) {
- e.setCancelled(true);
- p.sendMessage("§9Server > §7Teleportando para o lobby 2 ...");
- p.chat("/lobby2");
- p.closeInventory();
- }
- if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§7§l= §9Lobby 3 §7§l=")) {
- e.setCancelled(true);
- p.sendMessage("§9Server > §7Teleportando para o lobby 3 ...");
- p.chat("/lobby3");
- p.closeInventory();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment