What is the best way to do thid

Discussion in 'Spigot Plugin Development' started by Kyllian, Apr 29, 2017.

  1. Hello,

    I have the following plan. When the player executes a command it should clear an 100x100x100 area around the player (should only clear blocks I specified like stone, wood, etc no ores) then after a few seconds it should put the blocks back to normal.

    One thing to note is that the blockchanges are only for the player itself, not for other ones

    I tought of the following
    1. Get the players location
    2. (Somehow) send 100x100x100 block changes. Without including diamond ores etc
    3. Make sure that the player cant right click blocks so they update
    4. After a few seconds make the player update the blocks (maybe teleporting?)
    I can test with that.

    The only thing I really want to know is how I shoukd scan a 100x100x100 area without lagging the server (probably aSync?) But i've never used that.
  2. You could try iterate bit by bit, e.g. find the area you need to modify first. Then iterate by say, 10x10x10 at once?
  3. So I should get the block where the player is on and then add 50 and clear that. Then 49. Then 48 etc etc

    I know I can do it with for loops but math isnt my strongest point
  4. I expect ProtocolLib to be used for such client-side changes
    • Agree Agree x 1
  5. "Deprecated. Magic value"
    Yeh, the "Magic value" throughout the docs refers to using ids for things such as block data and materials.
    • Informative Informative x 1