Solved Get the type of a clicked block

Discussion in 'Plugin Development' started by AntonioC94, Dec 7, 2019.

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


    Hi there, sooo i just want to know, how can i get the type of a right clicked block. I tried with this code and another code, but without results

    P.D: my code doesnt run here "if (pot.getType() == Material.FLOWER_POT) {"
    P.D2: All right, i was testing a litle bit more and when i do a system.out. i have " LEGACY_AIR" when i do a click in the pot, so.. what is happening?
    P.D3: All right its done, i just need to add in my plugin.yml "api-version: 1.14"

        public void bloque(PlayerInteractEvent event) {
            Player player = event.getPlayer();
            Block pot= event.getClickedBlock();
            if (player != null) {
                if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
                    if (pot.getType() == Material.FLOWER_POT) {
    Last edited: Dec 7, 2019
Thread Status:
Not open for further replies.

Share This Page