NPE error but it cuts off before telling me why

Discussion in 'Plugin Development' started by Scorpionvssub, Aug 18, 2016.

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

    Scorpionvssub

    Code:
        private void offlinecomparer(Player p, String offline1, Player args) {
            p.sendMessage("p1 iss offline");
            int wins = plugin.stats.getInt(offline1 + ".wins");
            int fails = plugin.stats.getInt(offline1 + ".fails");
            int losses = plugin.stats.getInt(offline1 + ".losses");
            String name = plugin.player.getString(offline1 + ".name");
            UUID uuid = args.getUniqueId();
            int wins1 = plugin.stats.getInt(uuid + ".wins");
            int fails1 = plugin.stats.getInt(uuid + ".fails");
            int losses1 = plugin.stats.getInt(uuid + ".losses");
            String name1 = plugin.player.getString(uuid + ".name");
            p.sendMessage("Wins is " + wins1);
            p.sendMessage("fails is " + fails1);
            p.sendMessage("name is " + name1);
            p.sendMessage("loss is " + losses1);
            List<String> comparestats = plugin.getConfig().getStringList("comparestats");
            for (String s : comparestats) {
                p.sendMessage(ChatColor.translateAlternateColorCodes('&', s).replaceAll("%player%", name)
                        .replaceAll("%wins%", String.valueOf(wins))
                        .replaceAll("%fails%", String.valueOf(fails))
                        .replaceAll("%losses%", String.valueOf(losses))
                        .replaceAll("%player1%", name1)
                        .replaceAll("%wins1%", String.valueOf(wins1))
                        .replaceAll("%fails1%", String.valueOf(fails1))
                        .replaceAll("%losses%", String.valueOf(losses1))
                        .replace("%Compare%", plugin.getConfig().getString("offlinevar"))
                        .replace("%compare%", plugin.getConfig().getString("offlinevar")));
            }
        }
    I know its big... but thats beside the point.

    I've got 2 comparers atm 1 of them is just as long but working.
    This 1 cuts off as soon as it needs to sent a msg for Player "args".
    The p.sendmessage at the top is filled and processed with all the info needed.
    For some reason however on replacing all that data in this 1 it fails to do so.

    Again, Console won't tell me why, it cuts off right after it shows NullPointerException
     
  2. Online

    timtower Administrator Administrator Moderator

  3. first : "p1 is offline" not iss
    second : you worked with the offline players name ->
    but the same way with the online players uuid ->
    are there both (uuid and name possible [are both in the config])?
     
Thread Status:
Not open for further replies.

Share This Page