Problem cancelling a BukkitRunnable.

Discussion in 'Spigot Plugin Development' started by Xuho, Aug 3, 2018.

  1. I'm getting this error when I cancel a BukkitRunnable.
    Error: https://hastebin.com/jezagokare.pl
    Event:
    Code (Text):
        @EventHandler
        public void leave(PlayerQuitEvent e) {
            Player p = e.getPlayer();
            ScoreboardManager.removeScoreBoard(p);
            e.setQuitMessage(null);
            if (HowhitPlayer.howhitPlayers.containsKey(p.getName())) {
                HowhitPlayer hp = HowhitPlayer.howhitPlayers.get(p.getName());
                hp.getRecompensaCooldownTask().cancel(); //this is the line of the error.
                hp.setRecompensaCooldownTask(null);
                MySQL.saveData(hp);
                HowhitPlayer.howhitPlayers.remove(p.getName(), new HowhitPlayer(p));
            }
        }
     
  2. Code (Text):
    Caused by: java.lang.NullPointerException
    It looks like either hp, or getRecompensaCooldownTask(), yields null.
     
  3. please show the class that contains the runnable
     
  4. I will try checking if it is null.