public void UpdateNotificationAndBook(){ Bukkit.getScheduler().runTaskAsynchronously(Cardinal.getInstance(), new Runnable() { @Override public void run() { try { chat = ComponentSerializer.parse(GitUtil.getUpdateMessage(notificationUrl)); ItemStack NMSbook = new ItemStack(Item.getById(387)); try { NBTBase nbtbase = MojangsonParser.parse(ChatColor.translateAlternateColorCodes('`', GitUtil.getUpdateMessage(bookUrl))); NMSbook.setTag((NBTTagCompound) nbtbase); } catch (MojangsonParseException mojangsonparseexception) { Bukkit.getConsoleSender().sendMessage(mojangsonparseexception.getMessage()); return; } book = CraftItemStack.asBukkitCopy(NMSbook); } catch (IOException ignored) { } } }); }
@Override public ItemStack modifyItemStack(ItemStack stack, String arguments) { net.minecraft.server.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack); try { nmsStack.setTag((NBTTagCompound) MojangsonParser.parse(arguments)); } catch (MojangsonParseException ex) { Logger.getLogger(CraftMagicNumbers.class.getName()).log(Level.SEVERE, null, ex); } stack.setItemMeta(CraftItemStack.getItemMeta(nmsStack)); return stack; }
@Override public ItemStack modifyItemStack(ItemStack stack, String arguments) { net.minecraft.server.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack); nmsStack.setTag((NBTTagCompound) MojangsonParser.parse(arguments)); stack.setItemMeta(CraftItemStack.getItemMeta(nmsStack)); return stack; }