Custom rendered map problems

Discussion in 'Plugin Development' started by thok13, Dec 15, 2013.

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

    thok13

    I made a command that allows a user to draw an image on a map. My custom render class draws the image on the map's canvas, I give the player the map, etc, etc. I then send the map view to all the players on the server.
    But there's a problem. The map only renders if its in the players inventory. What I mean by this is that the other players cannot see the map if I put it in an item frame. I can give them the map, and it renders fine. They don't even have to look at the map, it just has to be in their inventory. I know I could just give every user the map and then take it away, but I was wondering if there's any other solution. Tell me if you need any of my code.

    Or is this a client issue?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  2. Offline

    NathanWolf

    You might need to show your code- I think this ought to work, are you using the "contextual" constructor for MapRenderer? Otherwise hooking up the renderer once to the right map id should let everyone see it.

    At least I'm pretty sure- to be honest, I just started working with maps, and for all I know no one but me can see them. Though I do know I can see maps even if I don't have it in my inventory. If you're curious, you can check out my server at "mine.elmakers.com" - if the custom maps show up for you, then feel free to check out my code :)

    https://raw.github.com/elBukkit/Mag...om/elmakers/mine/bukkit/utilities/URLMap.java

    Maybe you're not hooking the renderer back up on load? Are you sure it's that they need the map, versus maybe once you create a map everyone can see it?

    Are you creating a new map id every time? Or do all players get the same map id and you want them to all see the same thing?

    Are you saving your map ids and re-registering the renderers on restart?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  3. Offline

    thok13

    All players get the same map id. I am working on saving maps in the config.yml
     
  4. Offline

    NathanWolf


    Ok- the reason I asked is because this

    Looked like it would generate a new map for each player.

    As I found out the hard way, persistence is a requirement to make a working map renderer. You absolutely have to save your map id(s) to a config file and on load re-register the renderers.

    I think these two problems together are causing your issue- the second one will mean the maps don't render until you hook up the renderer, which would happen if you create a new map for someone with the same id as an existing one. But I'm not sure how even this would happen if you're not saving the map ids.

    Good look, it's complex stuff- feel free to look at the code I linked to, it might be helpful. If what you're rendering are images hosted on URLs you could just use it outright, otherwise it wouldn't be too hard to modify it to support custom rendering.
     
Thread Status:
Not open for further replies.

Share This Page