Solved A small question hopefully can answer?

Discussion in 'Plugin Development' started by _Ass4ssin_, Dec 26, 2012.

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

    _Ass4ssin_

    Hello,

    I have a small question what I think is not that hard?
    I am trying to check when someone breaks a block if it is a specific chunk and if not cancel it.
    I got everything working except I am not sure how to see if it is a certain chunk.

    What I am doing is a onBlockBreak event and have an if where it gets the chunk and see if it is the right one but I don't seem to get it right?

    Code:
    public void onBlockBreak(BlockBreakEvent event) {
        Block block = event.getBlock();
        if(block.getLocation().getChunk() == -18,-16){
            //some code here
        }else{
            event.setCancelled(true);
        }
    I have changed the -18,-16 to a lot of things but none seems to really works?
    I made a quick command where if you write /chunck it sends a message like player.getLocation.getChunck() and tried copy that into eclipse, yet it still gave errors so anyone know what I should put after the getChunck() == ?

    Thanks in advanced!
     
  2. Offline

    fireblast709

    just compare the chunks x and z coordinate
     
    _Ass4ssin_ likes this.
  3. Offline

    _Ass4ssin_

    I see, thanks a lot fireblast also within 2 minutes :confused:! Damn you're awesome. You helped me last time and you do now again and I see you do with a lot of ppl :D thanks!
     
  4. Offline

    kingBS11

    Yeah I see him helping tons of people out with their plugins.
     
Thread Status:
Not open for further replies.

Share This Page