Solved Making player right click

Discussion in 'Plugin Development' started by GeorgeeeHD, Jun 22, 2016.

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

    GeorgeeeHD

    I am trying to give a player a custom map. It works using MapInitializeEvent. If I give the player an EMPTY_MAP and they right click it, it works, but if I give them a MAP, it will not even call the MapInitializeEvent. I don't want the player to have to right click the map. Is there a way to give a player a MAP and make it call the MapInitializeEvent or is there a way to give the player an EMPTY_MAP and somehow force them to right click using code only.

    Thanks for any help.
     
  2. Offline

    Zombie_Striker

    @GeorgeeeHD
    There is no way to force a player to click a map or call the map initialize event. You will need to give the player an Empty map, and set the image of that map when the player picks it up.
     
  3. Offline

    GeorgeeeHD

    @Zombie_Striker
    How would I set the image of the map? I set the item in the players hand to EMPTY_MAP. I have the code already for rendering the map, but that is in the MapInitializeEvent. How would I use that code in this situation.
     
  4. Offline

    Zombie_Striker

  5. Offline

    GeorgeeeHD

    @Zombie_Striker
    That works, however if there has already been a map created, it draws it on top of that map. Is there a way to clear the canvas?
     
  6. Offline

    Zombie_Striker

    @GeorgeeeHD
    You should be able to draw an blank image over the whole canvas. That should clear it.
     
  7. Offline

    GeorgeeeHD

    @Zombie_Striker
    I couldn't find a method that clears the canvas. Instead of using Bukkit.getMap((short) 0), I just create a new MapView using Bukkit.createMap(world) and then set the durability of the ItemStack I give to the map to MapView.getId(). This seems to work. Thanks for the help :)
     
  8. Offline

    Zombie_Striker

    @GeorgeeeHD
    Mark this thread as solved if your problem has been solved.
     
Thread Status:
Not open for further replies.

Share This Page