PlayerInteractEvent

Discussion in 'Spigot Plugin Development' started by daantee13, Jul 18, 2018.

  1. help me to get the location of the block that the player clicks and verifies if it is the same as the config

    config:

    world:-470:106:-567:
    dono: watyn

    my code:

    Block bloco = event.getClickedBlock();
    if(bloco.getLocation().equals(Main.maquinaConfig.get(bloco.getWorld().getName() + ":" + bloco.getX() + ":" + bloco.getY() + ":" + bloco.getZ()))) {

    }
     
  2. You're comparing a location object and a config element?

    You'll have to create a new Location object and compare the two locations that way.
     
  3. Stai usando il codice in modo sbagliato, non è necessario aggiungere le coordinate.
    Prova così:
    Code (Java):
    Block bloco = event.getClickedBlock();
    if(bloco.getLocation().equals(Main.getConfig().getString("Bloco"));
    }