[SPIGOT-5593] isSimilar broken for base64 textured skulls Created: 22/Feb/20 Updated: 22/Feb/20 Resolved: 22/Feb/20 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Jack Tango | Assignee: | Unassigned |
Resolution: | Invalid | Votes: | 0 |
Labels: | Spigot, bug, error |
Attachments: |
![]() |
Version: | CraftBukkit version git-Spigot-8faa8b4-fba9f48 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) |
Guidelines Read: | Yes |
Description |
Getting a null pointer when using ItemStack isSimilar on skulls using base64 textures.
Using the following code: public class Main extends JavaPlugin { @Override public void onEnable() { ItemStack head1 = new ItemStack(Material.PLAYER_HEAD); UUID uuid = UUID.randomUUID(); GameProfile profile1 = new GameProfile(uuid, null); profile1.getProperties().put("textures", new Property("textures", "some random skin value")); setProfile(head1, profile1); ItemStack head2 = head1.clone(); if(head1.isSimilar(head2)) { // NPE here System.out.println("Is similar"); } } private void setProfile(ItemStack item, GameProfile profile) { ItemMeta meta = item.getItemMeta(); try { Field field = meta.getClass().getDeclaredField("profile"); field.setAccessible(true); field.set(meta, profile); } catch (NoSuchFieldException | IllegalAccessException ex) { ex.printStackTrace(); } item.setItemMeta(meta); } }
NOTE: Code works fine using 1.14.4 |
Comments |
Comment by md_5 [ 22/Feb/20 ] |
NMS is not API, the implementation changed and your reflection doesn't handle it. |