Solved Remove A LOT of blocks

Discussion in 'Spigot Plugin Development' started by DelfikPro, Mar 12, 2018.

  1. I'm sure that you guys know what fastbridge is.
    I decided to make a separate server to train to build bridges.
    My question is: How can I clean bridges built by players after they fall?
    I'm sure saving each block in the List<Location> is not a good idea.

    I was thinking about allocating to each player an area in the size of, for example, 20 by 20 chunks, and after that just to regenerate these chunks.
    However, I ran into the problem of clearing the chunks in which the player is located.
    The fact is that after the player accidentally falls from the bridge, he must immediately teleport to the cleared map.
    Is it a good idea to allocate a new 20x20 chunks to the player after the fall and clean up the previous 400 chunks?
     
  2. If the bridges will not be too long, I would use a Map<UUID, List<Vector>> for storing the blocks placed by a player and clear it when the blocks are removed or when the player logs out. This would be much more simple than allocating huge areas for players.
     
    • Informative Informative x 1
  3. Mas

    Mas

    If this is just for players to practice bridging, clearing an area yourself with worldedit or whatever would seem fine, then keep track of all the blocks a player places in the area (Map<Player, Set<Location>>), then each time they fall, get all the blocks they placed and reset them. You really won't be dealing with a large amount of blocks at all, I'm not exactly clear on why you feel you will need to be resetting whole chunks for something like this.
     
    • Informative Informative x 1
  4. Thank you guys ^^
     
  5. Or instead of saving the blocks anywhere, if the players practice their bridging stuff on a seperate server, just make that into a Limbo server which sends a packet to fill the player inventory with some blocks and maybe creates a spawn block. Done and you don't have to worry about anything else since these Limbo servers don't even save the block changes a player did.
    (I think Limbo is kind of being used as the "official" word there right? Well it's just a standalone new server which sends the initial packets, echoes KeepAlive packets and does almost nothing else, an example would be on Hypixel server I think where you are spawned into a Limbo server when you are afk. Check out this Github project, even if not listed there, it works for at least 1.12)

    Or I guess if you really want to use a default Spigot server maybe do it exactly like a Limbo server and
    • hide all players from each other
    • send an (almost) empty world
    • fill the players inventory with blocks
    • Let players place their blocks but prevent the block change packets from being send to other players. You have to cancel the block change packets, doing anything with events there will probably not work
     
    • Informative Informative x 1