Error

Discussion in 'Spigot Plugin Development' started by KingDotCom, Jun 4, 2016.

  1. I was wondering why this is an error?

    If you could help reply asap :)

    Code (Text):
    OfflinePlayer[] q = Bukkit.getServer().getOfflinePlayers();
    q.setStatistic(org.bukkit.Statistic.PLAYER_KILLS, 0);
    q.setStatistic(org.bukkit.Statistic.DEATHS, 0);
    I am trying to set all Statistics for these two up here to 0. Thanks
     
  2. As far as I know getOfflinePlayers() is not an array but a collection.
     
  3. So how could I use it to get all players in the files
     
  4. for(OfflinePlayer player : Bukkit.getOfflinePlayers()){

    }
     
  5. for(String players : getConfig().getConfigurationSection("Players").getKeys(false)) {

    if you're using a config, this would get all of the names of the players in the "Players" section.

    Example:

    Players:
    Bob2313:
    stuff​
    PoopyFace9231:
    stuff​

    that line should grab "Bob2313" and "PoopyFace9231"
     
  6. He's not trying to use his own configuration, he wants to loop through all the player data and set the stats to 0.