Chunk Map Message

Discussion in 'Plugin Development' started by Coopah, Feb 6, 2019.

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

    Coopah

    Anyone know how to make a command similar to /f map. I have made my own plugin similar to factions and am confused about how to get all the chunks around a player who types the command and send it in a message format.
     
  2. Offline

    Coopah

  3. Offline

    0-o

    I would do something like this:

    Code:
    Player player = (Player) sender;
    World world = player.getWorld();
    Location location = player.getLocation();
    
    for(int x = -4; x <= 4; x++) {
        for(int z = -4; z <= 4; z++) {
            Chunk chunk = world.getChunkAt(new Location(location.getX() + (x*16), location.getY(), location.getZ() + (z*16)));
        }
    }
    You should be able to grab every chunk in a 4 chunk radius around the player (unless I did something wrong). It's a start anyway
     
  4. Offline

    Coopah

    @0-o
    Yeah mate that's the way I was thinking. My issue is more about formatting. How do you turn that into a message that is reflective of where the chunks are. I can't think of any good way of doing this way more than a few chunks.
     
  5. Offline

    KarimAKL

    @Coopah Maybe you could use StringBuilder and append 1 box (if you want the chunks as boxes in the message), then check the length, if it's more than the amount of 4 (in case of 4*4) then make a new line before adding the next box.
     
  6. Offline

    0-o

    I would use a StringBuilder and add a line break after a row of chunks is completed.
     
Thread Status:
Not open for further replies.

Share This Page