Need Help Open The Next Inventory

Discussion in 'Plugin Development' started by ZxFrankxZ, Jul 24, 2018.

Thread Status:
Not open for further replies.
  1. I don't know how can i open the inventory "crearInventarioBaneo".
    i need a String to open this inventory but i don't know what i need. (I'm new, this is my first plugin)

    Code:
        @EventHandler
        public void clickearInventarioSanciones(InventoryClickEvent event) {
            FileConfiguration messages = plugin.getMessages();
            String titulo = ChatColor.translateAlternateColorCodes('&', messages.getString("Messages.sancionesInventoryName"));
            String tituloM = ChatColor.stripColor(titulo);
            if(!ChatColor.stripColor(event.getInventory().getName()).equals(tituloM)){
                return;
            }else {
                if(event.getCurrentItem() == null) {
                    event.setCancelled(true);
                    return;
                }
                if(event.getCurrentItem().getType() == Material.AIR || event.getSlotType() == null) {
                    event.setCancelled(true);
                    return;
                }else {
                    Player jugador = (Player) event.getWhoClicked();
                    event.setCancelled(true);
                    if(event.getSlot() == 9) {
                      
                        crearInventarioBaneo(jugador,?);
                        return;
                    }else {
                        return;
                    }
                }
            }
        }
      
        @SuppressWarnings("deprecation")
        public void crearInventarioBaneo(Player jugador,String jugadorSancionado) {
            FileConfiguration messages = plugin.getMessages();
            Inventory inv = Bukkit.createInventory(null,8,ChatColor.translateAlternateColorCodes('&', messages.getString("Messages.sancionesInventoryName -> &a[&4Ban&a]")));
            ItemStack tiempo = new ItemStack(7,1,(short) 4);
            ItemMeta metatiempo = tiempo.getItemMeta();
            metatiempo.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&a6 Horas"));
            List<String> loretiempo = new ArrayList<String>();
            loretiempo.add(ChatColor.translateAlternateColorCodes('&', "&7Banea al jugador por 6 Horas"));
            metatiempo.setLore(loretiempo);
            tiempo.setItemMeta(metatiempo);
            inv.setItem(0, tiempo);
          
            tiempo = new ItemStack(8,1,(short) 4);
            metatiempo = tiempo.getItemMeta();
            metatiempo.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&a12 Horas"));
            loretiempo = new ArrayList<String>();
            loretiempo.add(ChatColor.translateAlternateColorCodes('&', "&7Banea al jugador por 12 Horas"));
            metatiempo.setLore(loretiempo);
            tiempo.setItemMeta(metatiempo);
            inv.setItem(0, tiempo);
          
            jugador.openInventory(inv);
          
            Sancion sancion = new Sancion(jugadorSancionado, jugador.getName());
            if(plugin.jugadorEstaSancionando(jugador.getName())) {
                plugin.agregarSancion(sancion);
            }
            return;
        }
     
  2. Offline

    InstanceofDeath

    I can‘t read this language but in my point of view just remove the parameter in your method, when you don‘t need it.
    And if you copied the method I would guess that you have to add the playersname there,who banned they player.
     
Thread Status:
Not open for further replies.

Share This Page