Prevent Chunk Sending

Discussion in 'Plugin Development' started by caHarkness, Jun 29, 2011.

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

    caHarkness

    I was wondering if there was an API for preventing a chunk from even being sent to the player who's "requesting" it. I wanted to add a feature to my plugin that enables a server to simulate limited space, without using things like bedrock or player position comparison.

    I'm looking for something like event.setCancelled(true) in the onChunkLoad() method. If there isn't a way, would you (the Bukkit team) consider adding such a feature? Thanks :D
     
  2. Offline

    codename_B

    How about event.setCancelled(true) on the onChunkLoad(ChunkLoadEvent event)?
     
    feildmaster likes this.
  3. Offline

    Weltall 7

    How about you 1. reading the post carefully and 2. looking at the javadocs? ChunkLoadEvent is not cancellable...

    I don't know if this works, but it should do what you want:
    Code:java
    1. if (isOutside(event.getChunk())) { // your test whether the chunk is not in your limited world
    2. event.getWorld().unloadChunk(event.getChunk().getX(), event.getChunk().getZ());
    3. }

    if this doesn't work, you can try the other unload methods, including requests and/or safe = false.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  4. Offline

    caHarkness

    Maybe, the last time I tried that, I did it wrong, but it's worth another shot. I'm wondering if unloadChunkRequest() tells the clients to unload them as well. Thanks for the help! I'll report back soon, hopefully with some good news.
     
Thread Status:
Not open for further replies.

Share This Page