[SPIGOT-4222] retrieve map (filled) is giving an empty map Created: 03/Aug/18 Updated: 03/Aug/18 Resolved: 03/Aug/18 |
|
Status: | Closed |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Carlos Diego | Assignee: | Unassigned |
Resolution: | Invalid | Votes: | 0 |
Labels: | empty, filled, map |
Attachments: |
![]() |
Version: | CraftBukkit version git-Spigot-69774b3-671581e (MC: 1.13) (Implementing API version 1.13-R0.1-SNAPSHOT) |
Guidelines Read: | Yes |
Description |
When I try to give me a map created before with this code:
private void giveMap(Player player, int number) { ItemStack myMap= new ItemStack(Material.MAP, 1); myMap.setDurability((short) (number) ); player.getInventory().addItem(myMap); }
so I use: /giveMap 5 /giveMap 6 /giveMap 7 /giveMap 8 but is always giving an empty map I used this exact code in 1.9.4 and it works |
Comments |
Comment by Black Hole [ 03/Aug/18 ] |
MapMeta is used for FILLED_MAP only. |
Comment by Carlos Diego [ 03/Aug/18 ] |
Thank you by your reply, but sorry for asking you here how can I check the MapMeta? I changed the code to this private void giveMap(Player player, int number) { ItemStack myMap = new ItemStack(Material.MAP, 1); MapMeta meta = (MapMeta) myMap.getItemMeta(); meta.setMapId(number); myMap.setItemMeta(meta); player.getInventory().addItem(myMap); } and I get this error Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_13_R1.inventory.CraftMetaItem cannot be cast to org.bukkit.inventory.meta.MapMeta |
Comment by Black Hole [ 03/Aug/18 ] |
Those damage values are provided for legacy conversion only. Have a look at MapMeta to set the map id. |