Working with signs

Discussion in 'Plugin Development' started by hskrasek, Jan 20, 2013.

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

    hskrasek

    Alright so my plugin has been functioning just fine all the up until 1.4.6 and then something changed with one small part, that kills of a feature of my plugin. How the heck are you supposed to remove or update sign text?

    In the past I got the sign in question by doing this, and this method still works for creating new signs:
    Code:
    Block signBlock = blockLocation.getBlock();
    Sign plotSign = (Sign)signBlock.getState();
    And for a while this has worked for removing them (well setting them to blank, since a client bug that spams everyone in the server with a Cannot locate sign at X Y Z exists in 1.4.6 anyway). But now when I try to do that I get this error:

    Code:
    Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_4_6.block.CraftBlockState cannot be cast to org.bukkit.block.Sign
    
    So I am not sure what the like new way is supposed to be after the whatever it is that cause the v1__4__6 namespacing to show up. Any help would be great.
     
  2. Offline

    fireblast709

    apparently you cast a normal block to Sign. Also check if the block is not null (as it might not be loaded)
     
  3. Offline

    hskrasek

    Sorry been busy with server stuff today but thats the thing, I have made sure of it and I am infact working with a Sign Block when this error happens. I can check the not null thing, but would I be seeing NullPointerExceptions ontop, or instead of the ClassCastException? Either way is there anyway to force that chunk to load when the method tried to remove the sign?
     
  4. Offline

    fireblast709

    iirc world.getBlockAt(x,y,z) loads the chunk (as it uses Chunk.getBlockAt(x,y,z), so it has to load the chunk). But if that does not work you can also force-load the chunk with world.loadChunk(x >> 4, z >> 4);
     
  5. Offline

    hskrasek

    Alright thanks, I will give that a try and see what happens. Just wish I knew what changed between 1.4.6 earlier beta builds and the R0.3 to start giving me such a hard time.
     
Thread Status:
Not open for further replies.

Share This Page