loop

Discussion in 'Plugin Development' started by stamline, Mar 3, 2016.

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

    stamline

    Code:
    if(args[0].equalsIgnoreCase("list") && sender instanceof Player){
                Player player = (Player) sender;
                if(player.hasPermission("Friends.add")){
                    List<String> list = plugin.getConfig().getStringList(player.getUniqueId().toString() + ".Friends");
                    player.sendMessage(ChatColor.BLUE + "You have " + list.size() + " friends.");
                    for(int i = 0; i<list.size(); i++){
                        player.sendMessage(ChatColor.BLUE + ""+(i+1) + ". " + ChatColor.GREEN + plugin.api().UUIDToName(list.get(i)));
                    }
                }
            }
    When i enter the command for this methods it works. But when i do it again it do not. Only works once.

    It said its something wrong with this on line 10.
    Code:
    public String UUIDToName(String uuid){
            NameFetcher fetcher = new NameFetcher(Arrays.asList(UUID.fromString(uuid)));
            Map<UUID, String> response = null;
            try {
                response = fetcher.call();
            } catch(Exception e){
                plugin.getLogger().warning("Exception while running NameFetcher");
                e.printStackTrace();
            }
            String name = response.get(UUID.fromString(uuid));
            return name;
        }
     
  2. Offline

    HoeMC

    Why not use Bukkit.getPlayer(uuid)?
     
  3. Offline

    stamline

    Want so they dont need to be online.
     
  4. Offline

    HoeMC

    Bukkit.getOfflinePlayer()
     
Thread Status:
Not open for further replies.

Share This Page