Solved sendBlockChange. Break event.

Discussion in 'Plugin Development' started by Xogos1997, Dec 20, 2015.

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

    Xogos1997

    hi. i creating visible block for only one player. but can i detect if player try break this block? i have this event.

    Code:
      player.sendBlockChange(loc,Material.CARPET,(byte) 5);   
    
    Code:
        public void BlockBreak(BlockBreakEvent event)
        {
            Player player = event.getPlayer();
           
            if(event.getBlock().getType() == Material.CARPET && event.getBlock().getData() == 4)
            {
                player.sendMessage("yop faka");
            }
           
            if(event.getBlock().getType() == Material.CARPET)
            {
                player.sendMessage("yop faka");
            }
        }
    
     
  2. Offline

    Zombie_Striker

    @Xogos1997
    Sorry, sendblockchange doesn't act like that. The only information that gets sent from the player is where the block has been broken, not the type. Also, BlockBreakEvent gets the blocks by checking which blocks actually exist, not what the player sees.

    There is no way to detect what the player sees, and there is no way to check if a player breaks a "fake block".
     
  3. Offline

    Xogos1997

    okey. thx.
     
Thread Status:
Not open for further replies.

Share This Page