I am making a Realm plugin for my server, and I am using a multiarray to detect the location of users portals, below is the code:
public static String[][][] realms;
@EventHandler
public void onPlayerInteract(final PlayerInteractEvent event) throws Exception {
if( event.getMaterial() == Material.NETHER_STAR ) {
int x = (int) event.getClickedBlock().getX();
int y = (int) event.getClickedBlock().getY();
int z = (int) event.getClickedBlock().getZ();
** realms[x][y][z] = event.getPlayer().getName();
createPortal();
}
}
I get a NullPointerException
at the line with the '**', can someone please explain what I am doing wrong? I have googled 'java multiarrays', and they all seem to work the same way.