Solved Could not pass event BlockPlaceEvent

Discussion in 'Plugin Development' started by XXLuigiMario, Aug 25, 2014.

Thread Status:
Not open for further replies.
  1. Nvm, I got it to work, it was just .contains being picky about ChatColor.GREEN.
    I now have this:
    Code:java
    1. public class ProtectionStonesCheck extends ProtectionStonesBlockListener {
    2. @Override
    3. @EventHandler(priority = EventPriority.LOW)
    4. public void onBlockPlace(BlockPlaceEvent e) {
    5. Player player = e.getPlayer();
    6. Block block = e.getBlock();
    7. Material type = block.getType();
    8. if (canBuild(player, block)) {
    9. if (type == Material.CLAY || type == Material.COAL_BLOCK || type == Material.OBSIDIAN || type == Material.BEDROCK) {
    10. ItemStack hand = player.getItemInHand();
    11. ItemMeta ps = hand.getItemMeta();
    12. if (ps.hasLore()){
    13. if (ps.getLore().contains(ProtectionStonesFix.this.lore)) {
    14. super.onBlockPlace(e);
    15. }
    16. }
    17. }
    18. }
    19. }
    20. }

    But the above code doesn't look like it ever runs.
     
  2. The event works just fine when it's not inside that sub class.
     
  3. I have registed the other listeners in that class, but how do I register the one in the subclass?
     
  4. Working flawlessly! Thanks :D
     
Thread Status:
Not open for further replies.

Share This Page