Check what block sign is attached to

Discussion in 'Plugin Development' started by rcth, Nov 23, 2013.

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

    rcth

    Hi,

    I'm making something in my plugin, that when a sign with a specific tag (on first line) is attached to a mobspawner block, it sends the player who creates it a message.

    I already have this, but that doesn't work:
    Code:
    	@EventHandler
    	public void onSignChange(SignChangeEvent event) {
    		Player player = event.getPlayer();
    		Block block = event.getBlock();
    		if (block.getType() == Material.WALL_SIGN) {
    			Sign sign = (Sign)block.getState();
    			Attachable attached = (Attachable)sign.getData();
    			Block attachedBlock = block.getRelative(attached.getAttachedFace());
    			if (attachedBlock.getType() == Material.MOB_SPAWNER) {
    				if (sign.getLine(0).equalsIgnoreCase("[mobsp]")) {
    					player.sendMessage(ChatColor.GREEN + "Mobspawner sign succesfully created!");
    				}
    			}
    		}
    	}
    
    Anyone can help?
     
  2. Offline

    spoony_loony

  3. Offline

    rcth

    What method should be used then?
     
Thread Status:
Not open for further replies.

Share This Page