Solved Getting faction name (FactionsUUID)

Discussion in 'Spigot Plugin Development' started by JacksonHogan, Jun 7, 2016.

Thread Status:
Not open for further replies.
  1. Any idea how i can get a players faction name?
     
    #1 JacksonHogan, Jun 7, 2016
    Last edited: Jun 7, 2016
  2. Get the FPlayer then
    fplayer.getFactionId()
     
  3. oh i didnt see xD
     
    • Funny Funny x 1
  4. This is what i tried:

    [
    Code (Text):
    while(z < Bukkit.getOnlinePlayers().size()){
                for(Player plist : staff){
                    FPlayer fplayer = new FPlayer(plist);
                   
                    m.setDisplayName(plist.getDisplayName());
                    ArrayList<String> slore = new ArrayList<String>();
                    slore.add(ChatColor.GREEN + "" + ChatColor.BOLD + FantasyCore.economy.getBalance(plist));
                    slore.add(ChatColor.GREEN + "" + ChatColor.BOLD + fplayer.getFactionId());
                    m.setLore(slore);
                    i.setItemMeta(m);
                    inv.setItem(z, i);
                    z++;
                }
            player.openInventory(inv);
            }
    I get this error in eclipse:
    Cannot instantiate the type FPlayer
     
  5. while(z < Bukkit.getOnlinePlayers().size()){
    Dear god..
     
  6. Whats wrong with that?
     
  7. Why do you need it?
     
  8. Well, Now that im thinking about it.. I dont lol... (Thanks)
     
    • Like Like x 1
  9. Also I am pretty sure it is FPlayers.SomethingHere :p

    To get the FPlayer instance
     
    • Agree Agree x 1
  10. Thanks <3
     
    • Friendly Friendly x 1
  11. Can someone help me.. I can't figure out why this is duplicating the items in the gui every time someone opens it.
    Code (Text):
    public static void openStaffInv(Player player){
            Inventory inv = Bukkit.createInventory(player, 54, "Staff");
           
            for(Player players : Bukkit.getOnlinePlayers()){
                if(PermissionsEx.getPermissionManager().getUser(players).inGroup("Owner")
                        || PermissionsEx.getPermissionManager().getUser(players).inGroup("Admin")
                        || PermissionsEx.getPermissionManager().getUser(players).inGroup("Dev")){
                    staff.add(players);
                }
            }
            ItemStack i = new ItemStack(Material.SKULL_ITEM);
            ItemMeta m = i.getItemMeta();
            i.setDurability((short) 3);
           
            int z = 0;
            while(z < Bukkit.getOnlinePlayers().size()){
                for(Player plist : staff){
                    FPlayer fplayer = FPlayers.getInstance().getByPlayer(plist);
                   
                    m.setDisplayName(plist.getDisplayName());
                    ArrayList<String> slore = new ArrayList<String>();
                    slore.add(ChatColor.GREEN + "" + ChatColor.BOLD + FantasyCore.economy.getBalance(plist));
                    slore.add(ChatColor.GREEN + "" + ChatColor.BOLD + fplayer.getFaction().getTag());
                    m.setLore(slore);
                    i.setItemMeta(m);
                    inv.setItem(z, i);
                    z++;
                }
            }
            player.openInventory(inv);
        }
     
Thread Status:
Not open for further replies.