BlockPlaceEvent just stops working

Discussion in 'Spigot Plugin Development' started by Ziron5, May 28, 2015.

  1. Hi community!

    I have a super weird occasion on my project: The BlockPlaceEvent stopped working. Sounds very dumb but it's actually the case. All other events in the SAME class work fine, the BlockBreakEvent aswell... I have no idea whats going on and it used to work before.

    Code (Text):
    @EventHandler
        public void onBlockPlace(BlockPlaceEvent e)
        {
            Bukkit.broadcastMessage("TEST"); //DEBUG
            bpe = e;
            Player p = e.getPlayer();
            Block b = e.getBlock();
            if(plugin.ge.edit.containsKey(p.getUniqueId()))
            {
                plugin.ge.editGate(p, e.getBlock(), plugin.ge.edit.get(p.getUniqueId()).split("%")[0], plugin.ge.edit.get(p.getUniqueId()).split("%")[1]);
                return;
            }
            else if(plugin.d.edit.containsKey(p.getUniqueId()))
            {
                plugin.d.saveDoor(b, plugin.d.edit.get(p.getUniqueId()), p);
                return;
            }


            if(plugin.editors.contains(p.getUniqueId())) return;
            if(plugin.started == true)
            {
                if(b.getType().equals(Material.WOOL) || b.getType().equals(Material.BANNER) || b.getType().equals(Material.STANDING_BANNER) || b.getType().equals(Material.WALL_BANNER))
                {
                    Bukkit.broadcastMessage("ID"); //DEBUG
                    identify(b, true, p);
                }
                else
                {
                    if(plugin.bk.getRelative(b, p).isEmpty()) e.setCancelled(true);
                }
            }
            else
            {
                e.setCancelled(true);
            }

        }

    I suppose it's not very useful to post this code since it's 100% correct. The other events are registered properly wich means there can't be an issue with imports or wrong event registering.

    I tried setting up a different BlockPlaceEvent in a different listener class. It also didn't work.

    All that happens when I place a block is, it gets cancelled but no debug message (line 4) is shown.

    This problem drives me mad and I wanted to ask if anyone knows about this or a solution for it!

    thanks in advance! :)


    Ziron5
     
  2. Try adding some sysouts (debugging codes). I wouldn't prefer broadcasting a message for debugging.
     
  3. Doesn't matter I solved it myself. I cancelled the playerInteractEvent... I am not a smart man. As it seems this kills the BlockPlaceEvent as the player interacts with a block by placing a block.

    closed and solved ^^
     
  4. Theres was also a problem with NoCheatPlus recently, where players couldn't place blocks if they had a to high ping :D Nearly everyone had a too high ping
     
  5. So is the event just not firing or is the block not being placed?
     
  6. Do you even read the topic? OP said he solved it..
     
  7. My bad. An any case, I'm glad you solved it.