1.15.2 Check if block is Waterlogging.

Discussion in 'Spigot Plugin Development' started by MaiTheLord, Mar 23, 2020.

  1. drives_a_ford

    Moderator

  2. Thank you, but I don't really understand. can you give example?
     
  3. drives_a_ford

    Moderator

    What do you not understand exactly?

    I'm not going to spoonfeed you code. That won't help you (nor anyone else, really). You need to write the code yourself.


    If you don't really know java all that well, I'll refer you to the stickied README thread:
     
    • Winner Winner x 1
  4. I hate when people say this. The OP read the javadocs to find the isWaterLogged method, and simply just didn't understand how to use it.

    Here is the correct way of doing this:
    Code (Java):
    Block b = loc.getBlock();
    boolean isWaterLogged = false;
    if(b.getBlockData() instanceof Waterlogged){
       Waterlogged wl = (Waterlogged) b.getBlockData();
       isWaterLogged = wl.isWaterlogged();
    }
     
    • Agree Agree x 4