test for a specific block under player

hey guys(again) im making a plugin which tests the block under the player and then sets it to air, I have a problem with it
this works:
@EventHandler
public void onunder(PlayerMoveEvent e){

Player p = e.getPlayer();

Block under = p.getLevelBlock().subtract(0, 1, 0).getLevelBlock();

p.sendMessage("You are standing on a " + under + " block ")


}
this works but I cant do something like this

@EventHandler
public void onEF(PlayerMoveEvent e){

Player p = e.getPlayer();

if (p.getLevelBlock().subtract(0, 1, 0).getLevelBlock().equals(Block.STONE)){
p.sendMessage("i-dv99ureu0efn0urfh84fuergfjrhgufhuu9fhrrgy3fergju4tygj45uygoh5guf7r")
}

}
this doesnt work









































































































































































































}
 

Joshua CC

Member
do if(p.subtract(0, 1, 0).getLevelBlock().getId() == Block.STONE) instead

Block.STONE is the ID of the block. If you wanna get the Block, do Block.get(Block.STONE)
 

Joshua CC

Member
oh and btw, you should join the Discord server for Cloudburst (Nukkit) to know more information because we have some active members to help you when I'm not online here
 
how does items in cloudburst work? this doesnt work
Item stick = new Item(Item.STICK);
(that is in nukkit)
in cloudburst it doesnt work
 
oh and btw, you should join the Discord server for Cloudburst (Nukkit) to know more information because we have some active members to help you when I'm not online here
oh and btw, you should join the Discord server for Cloudburst (Nukkit) to know more information because we have some active members to help you when I'm not online here
I have hoined the discord server but isnt allowed to send messages
 

Joshua CC

Member
how does items in cloudburst work? this doesnt work
Item stick = new Item(Item.STICK);
(that is in nukkit)
in cloudburst it doesnt work
idk about cloudburst, never tried to make plugins there because it's still not ready for production and will never be working with it until its beta

you can probably do Item.get(Item.STICK); if i remember correctly
 
Top