Solved Temporarily spawn block

Discussion in 'Plugin Development' started by LanteanKnight, Jul 28, 2013.

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


    Hey I'm working on a sort of hologram table which displays the locations of players by putting their skull on a block corresponding with their location.
    It's all working perfectly fine, but when the players move their previous skulls aren't removed.

    I tried clearing a specified area every few seconds and then updating the locations of the skulls, but that caused a bit of lag. Is there any better way to do this? Like temporarily spawning the block?
  2. You could try removing the block a given period after spawning it. For example:

    1. @eventhandler
    2. //Your code to spawn the block
    4. new BukkitRunnable(){
    5. public void run(){
    6. //Your code to remove the block
    7. }
    8. }.runTaskLater(plugin, (20*60)); //Will wait 1min before running the remove code

    So that way you can have the block always go after a set amount of time anyway.
    Also, are you actually spawing the blocks, or just sending block updates?
    I owuld never suggest actually modifying blocks if you are.

    This may be of no use to you, you didn't really give a lot of information, so I can't be sure what your plugin really does, but I hope it does help. :)
  3. Offline


    The current scripts iterates over the area to see if any heads are there. Those heads are then removed and new ones are placed that correspond with the new locations.
    I'm already using a timer for this and the lag may have been caused by some network problems I had earlier, because it seems to be reduced to virtually nothing.

    Would sending block updates to all players not be the same as spawning blocks?
  4. Offline


    That would be a no because sending is virtual, it doesn't actually exist eccept for the client.
    On the other hand, an actual block is rendered in the world, therefore there would be a small performance improvement.
  5. Offline


    I see, I will change my code then

    On the other hand, is it still possible to work with skulls if you're working with block updates? I need to check the owner of the skull for this to work and you can only get that type of information form a Block object.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 3, 2016
  6. Offline


    There is a byte paramaeter but I don't know ho that works. It sends block data with sendBlockChange(which I assume you are using)
  7. Offline


    I left it to be a block change because I couldn't get meta data from the block when using sendBlockChange.
    The lag issue is solved now, thanks for your help.
Thread Status:
Not open for further replies.

Share This Page