Solved NullPointerException

Discussion in 'Plugin Development' started by PieMan456, Dec 13, 2013.

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

    PieMan456

    Why is this null? I am getting an error saying this is null:
    Code:java
    1. .replaceAll("(name)", p.getName());

    Here is code before it:
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String label,
    2. String[] args) {
    3. if (!(sender instanceof Player)) {
    4. sender.sendMessage(ChatColor.RED
    5. + "Only a player can use this command!");
    6. return true;
    7. }
    8. Player p = (Player) sender;
    9. if (cmd.getName().equalsIgnoreCase("reclaim")) {
    10. if (p.hasPermission("TCReclaim.reclaim")) {
    11. if (p.hasPermission("TCReclaim.Cookie")) {
    12. String l = getConfig().getString("TCReclaim.Cookie")
    13. .replaceAll("(name)", p.getName());
     
  2. Offline

    felixfritz

    My guess is that the string you're trying to get ("TCReclaim.Cookie") doesn't exist.
     
  3. Offline

    PieMan456

Thread Status:
Not open for further replies.

Share This Page