Spectating and Contributing menu

Discussion in 'Plugin Development' started by Frotch, Jul 5, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Frotch

    Can anyone help me with this?
     
  2. Offline

    eyamaz

    Start by being a little less vague, and maybe someone will be able to help you.
     
    TheGamesHawk2001 likes this.
  3. @Frotch What exactly do you need help with? What are you trying to achieve, what have you tried already, do you have errors with your current code, what are they? We can't read minds, we need some information :p
     
  4. Offline

    Frotch

    @bwfcwalshy I've tried some code, but that that's what i'm asking about, Like how do i make a "inventory" contain all the players heads with they're name as the "Item Name"
     
  5. Offline

    CrystallFTW

    @Frotch
    1. Create a custom inventory.
    2. Loop through players and create an itemstack, set the Displayname to player's name
    3. Add the item in the inventory.
    A schematic form of what you should do:
    Code:
    
            Inventory inv = Bukkit.createInventory(null, 54, title);
          
            for(Player p : Bukkit.getOnlinePlayers()){
              
                ItemStack item = new ItemStack(Material.SIGN,1);
                ItemMeta meta = item.getItemMeta();
                meta.setDisplayName(p.getName());
                item.setItemMeta(meta);
              
                inv.addItem(item);
            }
    
    
    
    P.S I didn't tested it.
     
  6. Offline

    Frotch

    @CrystallFTW That's a nice peace of code. But what would i do to make like a MATERIAL.HEAD and set it's skin to the players head.

    @CrystallFTW and how do i make the player teleport to the p?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  7. @Frotch
    Learn java and look at the bukkit api (google)
     
  8. Offline

    CrystallFTW

    @Frotch To set their head as the item, use SkullMeta and set their name as the skull owner.
    To teleport simply teleport yourself to their location.
     
Thread Status:
Not open for further replies.

Share This Page