Solved [Help] List error again

Discussion in 'Spigot Plugin Development' started by SwagiWagi, Jun 14, 2016.

  1. Hey guys,

    For some reason I have an error here:
    Code (Text):
    package me.rom.com;

    import java.util.List;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.Plugin;

    public class Event implements CommandExecutor {

        public Event(Core plugin){
            plugin.getServer().getPluginManager();
        }
       
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] arg3) {
            if (label.equalsIgnoreCase("List") && sender.hasPermission("List.use")) {
                if (!(sender instanceof Player)) {
                    sender.sendMessage("Hey! You must be a player to use this command!");
                    return false;
                }
                Player player = (Player) sender;
                List<String> ws = plugin.getConfig().getStringList("List");
                for (String wsm : ws) {
                    player.sendMessage(wsm);
                }
                return true;
            }
        }
    }
     
    The error is in plugin.getConfig().getStringList("List");
     
  2. You need to make an instance of Core outside of the constructor. and give it a value in the constructor
     
  3. I don't know that was the problem, just restarted eclipse and it disappeared.