I have no idea why this code is throwing me a null pointer, it's at line 18, please help! -Croug Code:java package com.CalcuProcessing.SuperMeatBoy; import org.bukkit.Location;import org.bukkit.World; public class WorldMap { private Location Start, End; public WorldMap(Location Start, Location End){ this.Start = Start; this.End = End; sort(); } private void sort(){ double bufx; double bufy; double bufz; if(Start.getX() > End.getX()){ bufx = End.getX(); End.setX(Start.getX()); Start.setX(bufx); } if(Start.getY() > End.getY()){ bufy = End.getY(); End.setY(Start.getY()); Start.setY(bufy); } if(Start.getZ() > End.getZ()){ bufz = End.getZ(); End.setZ(Start.getZ()); Start.setX(bufz); } } public boolean Contains(Location loc){ if(loc.getX() > Start.getX() && loc.getY() > Start.getY() && loc.getZ() > Start.getZ() && loc.getX() < End.getX() && loc.getY() < End.getY() && loc.getZ() < End.getZ()){ return true; } return false; }}
Your Locations need to be initialized. Location constructor: Code:java Location location = new Location(world, x, y, z);
hmm, i don't think so, but now that i think about it, i never checked to make sure my player listener was listener. Solved it, i forgot to initialize my player listener class haha. EDIT by Moderator: merged posts, please use the edit button instead of double posting.