Get location of home Essentials

Discussion in 'Spigot Plugin Development' started by GB_6, Apr 13, 2017.

  1. Hello fellow developers!

    I wanted to know how to get the location of a certain home in the list homes. This is what I tried:
    Code (Text):
    String player = ((Player) sender).getName().toString();
                GUIname = GUIname.replace("%player%", player);
                List<String> homes = ess.getUser(player).getHomes();
                sender.sendMessage(message);
                if (homes.size() < 10) {
                    Inventory inv = Bukkit.createInventory(null, 9, GUIname);
                    for (int i = 0; i < homes.size(); i++) {
                        if (item != null) {
                            String home = ess.getUser(player).getHomes().get(i).getName();
                            Location lo = ess.getUser(player).getHome(home);
                            World world = lo.getWorld();
                            for(String l : lores){
                                l.replace("%world%", "" + world);
                            }
                           
                            String hname = ess.getUser(player).getHomes().get(i);
                            ItemStack itm = new ItemStack(nameItem(item, ChatColor.AQUA + hname, lores));
                            inv.setItem(i, itm);
                        } else {
                            inv.setItem(i, new ItemStack(Material.DIRT));
                        }
                    }
                    ((HumanEntity) sender).openInventory(inv);
                    return true;
    But.... getName(); isnt a function. Please help me :)
     
  2. try


    Code (Text):
    String home=ess.getUser(player).getHomes().get(i).toString();
     
     
  3. I think that will work, thanks for the suggestion will update you.