Action.RIGHT_CLICK_BLOCK after using sendBlockChange

Discussion in 'Plugin Development' started by Jucko13, Feb 13, 2012.

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

    Jucko13

    I am breaking my brains over this thing for like 2 days now and i cant seem to find an solution or a work-around..

    what I do:
    I use sendBlockChange to send an woodenblock to myself. this block appears right in front of me, and when i LeftClick that block with an empty hand i get an message that i clicked the block. after clicking on it it disappears.

    I log all the events that are caused by PlayerInteractEvent. but when i rightclick an block that was created by sendBlockChange i dont get an message and the debugger don't even trigger the void onPlayerInteract. also when rightclick in the air with your bare hand doesn't trigger this event.
    but when i rightclick on a block that was really there than the event gets triggered and the debugger pops up... strange...


    Maybe it's an bug in Bukkit or an limitation of MineCraft? Is there an work-around or am i missing something? I'm sure that my code works perfectly since my ZeeSlag plugin is working great with normal blocks... but as soon as i create blocks using sendBlockChange it doesn't get triggered at all....

    i hope you guys can help me,

    Jucko13.
     
  2. Offline

    Jucko13

    anyone? i even tried different priority options but nothing worked..
     
  3. Offline

    ZNickq

    The block created with setBlockChange isn't real, so of course it doesn't fire a RIGHT_CLICK_BLOCK event...it fires RIGHT_CLICK_AIR
     
  4. Offline

    Jucko13

    it won't fire any rightclick events. only leftclick.
     
  5. Offline

    Firefly

    If you don't mind if the block is visible to other players, you can physically set the air block infront of the player to wood, then your Event will fire properly when you click on the block.
     
  6. Offline

    Jucko13

    if you mean this than it would be awesome : changing the block normally, and then set it for the rest to air? that could be possible but there may NOT i repeat NOT be a chance that other players can see that block. this is an zeeslag game and allot of people are using xray to see where the boats are standing. so i was thinking of the SendBlockChange... but if an torch is placed in range of the block than it disapears. also with lightning and fire... so i dont want to let the others know where my boats are by using this function. but thanks for the idea :)
     
  7. Offline

    Firefly

    Oh, I was unaware of your intent for how the block needed to be visibility wise to other players. I don't know how this would be possible without some testing on my part.

    EDIT: Or perhaps doing what I suggested before, but sending a block change for every other player, making it seem as if nothing was there.
     
  8. Offline

    Jucko13

    yes indeed, and i will try to perform this. i will test this and will let you know if it's accurate enough to use. because of all the changes that will make the boats visible like an torch, lightning and other stuff... thank you again for the idea :p
     
  9. Offline

    yucww210

    good news[​IMG]
     
  10. Offline

    Jucko13

    welllllllll i just tested it all and i think it is a good solution but not the best... you cannot call player.SendBlockChange() right after Block.SetTypeIdAndData()... this means that you have to do it with some delay, causing the other player to see it for a very short time (one tick). and everytime the lightning hits the fields all boats are visible again.. so every turn i have to reset the playerfield, causing the boats to light up like we are standing in a disco... Maybe this will be considered as a bug an get fixed sometime because this is not a pleasure to work with... thanks for your help tough..
     
Thread Status:
Not open for further replies.

Share This Page