What's wrong with these if lines?

Discussion in 'Plugin Development' started by bogdacutu, Jan 7, 2012.

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

    bogdacutu

    Code:
        public void onBlockBreak(BlockBreakEvent event) {
            Location loc = event.getBlock().getLocation();
            if ((loc.getBlockX()+1)%(sizex*16) < 2) {
                event.setCancelled(true);
            } else if ((loc.getBlockZ()+1)%(sizez*16) < 2) {
                event.setCancelled(true);
            } else if (loc.getBlockY() == 127) {
                event.setCancelled(true);
            }
        }
    Every time it gets fired it fails:
    I changed the plugin name for security reasons (don't want anyone to copy my idea).

    sizex and sizez are both defined (ints) as 5. They are separate because who knows, I may want them to be different.

    Line 21 is the first "if" line.
     
  2. Your worried about people stealing your idea from the name...

    Paranoid much :p

    What are the variables sizez and sizex are you sure they are not null as the rest of the code looks fine?
     
  3. Offline

    bogdacutu

    No, they are both set to 5.
    This behaviour also happens with onPlayerMove, same code.
     
  4. What is the line causing the error? I know line 23 but in the code you posted what line is it?
     
  5. Offline

    bogdacutu

    Line 21 causes the error.
     
Thread Status:
Not open for further replies.

Share This Page