onChunkLoaded doesn't work for me

Discussion in 'Plugin Development' started by xPaw, Mar 13, 2011.

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

    xPaw

    I register event like this
    Code:
    pm.registerEvent( Event.Type.CHUNK_LOADED, worldListener, Priority.Normal, this );
    and it doesn't get called for me :(

    here's my worldListener code:
    Code:
    public class FlatEarthWorldListener extends WorldListener
    {
    	public FlatEarthWorldListener( )
    	{
    		System.out.print( "WorldListener herp derp!" ); // this message is printed
    	}
    	
    	public void onChunkLoaded( ChunkLoadEvent event )
    	{
    		World world = event.getWorld( );
    		
    		System.out.print( "Chunk loaded: " + event.getChunk( ) );
    		
    		Integer x = event.getChunk( ).getX( ) << 4;
    		Integer z = event.getChunk( ).getZ( ) << 4;
    		Material ReplacementBlock = Material.STONE;
    		
    		if( world.getEnvironment( ) == World.Environment.NETHER )
    			ReplacementBlock = Material.NETHERRACK;
    		
    		for( int X = x; X < x + 16; X++ )
    		{
    			for( int Z = z; Z < z + 16; Z++ )
    			{
    				System.out.print( X + " / " + Z );
    				
    				if( world.getBlockAt( X, 0, Z ).getType( ) != Material.BEDROCK )
    					world.getBlockAt( X, 0, Z ).setType( Material.BEDROCK );
    				
    				// DEBUGGING!!! Make this only in nether !!
    				if( world.getBlockAt( X, 127, Z ).getType( ) != Material.BEDROCK )
    					world.getBlockAt( X, 127, Z ).setType( Material.BEDROCK );
    				
    				if( world.getBlockAt( X, 1, Z ).getType( ) == Material.BEDROCK )
    					world.getBlockAt( X, 1, Z ).setType( ReplacementBlock );
    				
    				if( world.getBlockAt( X, 2, Z ).getType( ) == Material.BEDROCK )
    					world.getBlockAt( X, 2, Z ).setType( ReplacementBlock );
    				
    				if( world.getBlockAt( X, 3, Z ).getType( ) == Material.BEDROCK )
    					world.getBlockAt( X, 3, Z ).setType( ReplacementBlock );
    				
    				if( world.getBlockAt( X, 4, Z ).getType( ) == Material.BEDROCK )
    					world.getBlockAt( X, 4, Z ).setType( ReplacementBlock );
    			}
    		}
    	}
    }
     
  2. Offline

    Sammy

    I'm a noob so the only help I can try and give is with simple stuff that might have slipped you =)


    Code:
    FlatEarthWorldListener WorldListener = new FlatEarthWorldListener ();
    
    Has this your declaration ? or did you declare WorldListener on the event registration ?
     
  3. Offline

    xPaw

    bump :(
     
Thread Status:
Not open for further replies.

Share This Page