Solved Get a Door's Top or Bottom Half - 1.15

Discussion in 'Spigot Plugin Development' started by PRLL001, Feb 23, 2020.

  1. I'm currently trying to get a door's location, this includes it's top and bottom half. I tried using the "deprecated" method of Door.isTopHalf() but it would always return false, it didn't matter which half I was clicking/looking at.

    I already get the location correctly of whichever half i'm looking at, and i already have a working conditional which will evaluate if the block is a door or not. I'm just missing a way to find out if i'm looking/clicking at the door's bottom or top half.

    Is there any way this could be done?

    Thanks in advance to any advice!
     
  2. Use either:
    Bisected
    or
    Door

    Door extends Bisected
    Bisected extends BlockData
     
    • Winner Winner x 1
  3. Thank you very much for your answer! It worked just as intended.

    For anyone stumbling unto this thread, here is a sample of the type of code i used for testing:

    Code (Text):
    Block block = //get the block any way you require
    Bisected data = (Bisected) block.getBlockData();
    player.sendMessage(data.getHalf().toString()); //Prints either TOP or BOTTOM
    In-game screenshot of result:

    screenshot.png
     
  4. Mark the thread as solved : P