getBlockY dosen't work

Discussion in 'Plugin Development' started by MaRrDG, Apr 2, 2021.

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

    MaRrDG

    Hello! I keep getting this error, how should I solve it?
    "Cannot resolve method 'getBlockY' in 'Player'"

    Code:

    @EventHandler
    public void onBuild (BlockPlaceEvent e) {
    Player p = e.getPlayer(); if(p.getWorld().getName().equalsIgnoreCase("world_nether")) {
    if(p.getBlockY() > 125) {
    e.setCancelled(true);}
    }
    }
     
  2. Offline

    timtower Administrator Administrator Moderator

    @MaRrDG call getLocation first...
     
  3. Offline

    davidclue

    You need to do
    Code:
    p.getLocation().getBlock().getBlockY();
     
Thread Status:
Not open for further replies.

Share This Page