Playing with maps !

Discussion in 'Plugin Development' started by Ribesg, Oct 23, 2011.

Thread Status:
Not open for further replies.
  1. Hi !
    I'm trying to use the Map API of bukkit.
    I'm testing something : I want that if I write something like /revealmap, all the transparent blocks in the map are changed to what they should look like.
    How do I do this ? I found no tutorial about it

    Thanks

    I can't figure out how I can reveal the map... This should be easy !
    http://yerwol.co.uk/bukkitdoxy/html/d7/d5e/classnet_1_1minecraft_1_1server_1_1WorldMap.htm
    https://github.com/Bukkit/CraftBukk.../org/bukkit/craftbukkit/map/CraftMapView.java

    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    2. if (commandLabel.equalsIgnoreCase("map")) {
    3. if (sender.hasPermission("itsn3wMap.base") || sender.isOp()) {
    4. if (!(sender instanceof Player)) {
    5. sender.sendMessage(HEADER + "In Game only command");
    6. return false;
    7. } else {
    8. Player player = (Player) sender;
    9. if (player.getItemInHand().getType().equals(Material.MAP)) {
    10. MapView map = getServer().getMap(player.getItemInHand().getDurability());
    11. map.setCenterX((int) player.getLocation().getX());
    12. map.setCenterZ((int) player.getLocation().getZ());
    13. map.setScale(Scale.FARTHEST);
    14. /*
    15.   Reveal the map here !
    16.   //*/
    17. player.sendMap(map);
    18. return true;
    19. } else {
    20. player.sendMessage("No map held");
    21. return false;
    22. }
    23. }
    24. } else {
    25. sender.sendMessage(HEADER + "No permission !");
    26. return false;
    27. }
    28. } else {
    29. return false;
    30. }
    31. }


    Ok so this is just impossible.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 20, 2016
  2. You need to write your own MapRenderer wich populates the map. The map is just a canvas where you can draw on. It's not a prerenderd map with just some "fog of war" over it. It redraws the blocks when you move.

    PS: I had a lot of trouble figuring the map out. PM me if you need a kick-start.
     
Thread Status:
Not open for further replies.

Share This Page