[UnSolved] Force a map to update from a different world

Discussion in 'Plugin Development' started by Jogy34, Sep 25, 2013.

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

    Jogy34

    For one of my plugins I want the players to be able to track where something is with a map when they are in a different world. I have it so that the object shows up on the map with a cursor but the map won't update the terrain. Does anyone know a way to do this?
     
  2. Offline

    bodhistrontg

  3. Offline

    Jogy34

  4. Offline

    bodhistrontg

    Yeah i know just showing you something that is there
     
  5. Offline

    Jogy34

    Anyone?
     
  6. Offline

    Jogy34

    I still need to know how to do this.
     
  7. Offline

    Garris0n

    You probably have to load the chunks or something along those lines.
     
  8. Offline

    Fozie

    Well your problem is that maps are saved in the worlds folder so to access them from another world you need to make somekind of "clone" that shows the exact same thing or something
     
  9. Offline

    xTrollxDudex

    Jogy34
    PHP:
    MapView map Bukkit.createMap(Bukkit.getWorld(/*your world here*/));
    player.getInventory().addItem(new ItemStack(Material.MAP1map.getId()));
     
  10. Offline

    Jogy34

    The maps don't update if they are being used from a different world even when the chunks where the map displays are loaded.



    The problem with this is that I would have to manually map every block to a color on the map and constantly use my own algorithm to figure out where to place each pixel and then constantly do this each time the map is updated by a player. I was going to do this but it would be really tedious to implement and it probably won't be very efficient. I'd really like to avoid doing that if I'm able to.


    I already have the maps. I want to be able to render them from a different world as, currently, they don't update the terrain if they are being used from a different world.
     
  11. Offline

    xTrollxDudex

    Jogy34
    You probably need a MapCanvas or something...
     
  12. Offline

    Jogy34


    A MapCanvas is the thing that all of the pixels are drawn on. I fail to see how I would be able make one forcibly render the terrain from a different world.
     
  13. Offline

    xTrollxDudex

    Jogy34
    I believe that MapCanvas is responsible for loading the map although I'm not sure
     
  14. Offline

    Jogy34

    The map renderers are responsible for loading the map. They draw the map onto the canvas. But, again, they don't do that if the map that is being drawn to is in a different world.
     
  15. Offline

    Fozie

    Well i find the answer:
    Do as xTrollxDudex says but instead of player.getInventory().addItem(new ItemStack(Material.MAP, 1, map.getId()));
    Do player.sendMap({MapView});

    Final code:
    Code:java
    1. MapView map = Bukkit.createMap(Bukkit.getWorld(/*your world here*/));
    2. {YourPlayer}.sendMap(map);
    3. // And if you want give the map to the player
    4.  
     
    xTrollxDudex likes this.
Thread Status:
Not open for further replies.

Share This Page