tr7zw/Item-NBT-API

Setting double thinks I'm inputting a boolean

ImNotStable opened this issue · 2 comments

My Code

  public ItemStack getBankNote(double amount, Player player) {
    ItemStack item = new ItemStack(Material.PAPER);
    NBTItem nbt = new NBTItem(item);
    nbt.setDouble("amount", amount);
    nbt.setString("player", player.getName());
    nbt.applyNBT(item);
    ItemMeta meta = item.getItemMeta();
    meta.displayName(Messages.getParsedMessage(MessageType.WITHDRAW_BANKNOTE_DISPLAYNAME,
      Number.formatCommas(amount),
      player.getName()
    ));
    meta.lore(Collections.singletonList(Messages.getParsedMessage(MessageType.WITHDRAW_BANKNOTE_LORE,
      Number.formatCommas(amount),
      player.getName()
    )));
    meta.setCustomModelData(1234567890);
    item.setItemMeta(meta);
    return item;
  }

Error

[17:49:50 INFO]: [NBTAPI] [NBTAPI] Found Spigot: v1_20_R3! Trying to find NMS support
[17:49:50 WARN]: [NBTAPI] [NBTAPI] This Server-Version(v1_20_R3) is not supported by this NBT-API Version(2.11.2) located at com.imnotstable.qualityeconomy.nbtapi.utils.MinecraftVersion. The NBT-API will try to work as good as it can! Some functions may not work!
[17:49:50 INFO]: [NBTAPI] [NBTAPI] Found Gson: class com.google.gson.Gson
[17:49:50 ERROR]: [CommandAPI] Unhandled exception executing '/withdraw 1'
com.imnotstable.qualityeconomy.nbtapi.NbtApiException: [?]Error while calling the method 'putDouble(java.lang.String,double)', loaded: true, Enum: COMPOUND_SET_DOUBLE, Passed Class: class java.lang.Boolean
        at com.imnotstable.qualityeconomy.nbtapi.utils.nmsmappings.ReflectionMethod.run(ReflectionMethod.java:358) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.nbtapi.NBTReflectionUtil.setData(NBTReflectionUtil.java:615) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.nbtapi.NBTCompound.setDouble(NBTCompound.java:185) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.commands.WithdrawCommand.getBankNote(WithdrawCommand.java:62) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.commands.WithdrawCommand.withdraw(WithdrawCommand.java:53) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.commandapi.executors.PlayerCommandExecutor.run(PlayerCommandExecutor.java:48) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.commandapi.executors.NormalExecutor.executeWith(NormalExecutor.java:44) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.commandapi.CommandAPIExecutor.execute(CommandAPIExecutor.java:137) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.commandapi.CommandAPIExecutor.execute(CommandAPIExecutor.java:110) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.commandapi.CommandAPIExecutor.execute(CommandAPIExecutor.java:91) ~[QualityEconomy-1.4.5.jar:?]
        at com.imnotstable.qualityeconomy.commandapi.CommandAPIHandler.lambda$generateCommand$0(CommandAPIHandler.java:258) ~[QualityEconomy-1.4.5.jar:?]
        at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.2.9.jar:?]
        at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:32) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:19) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.commands.execution.CommandQueueEntry.a(CommandQueueEntry.java:5) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:101) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:444) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:345) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:332) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2234) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$16(ServerGamePacketListenerImpl.java:2194) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1458) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:194) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1435) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1358) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1336) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[paper-1.20.4.jar:git-Paper-364]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:321) ~[paper-1.20.4.jar:git-Paper-364]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at com.imnotstable.qualityeconomy.nbtapi.utils.nmsmappings.ReflectionMethod.run(ReflectionMethod.java:355) ~[QualityEconomy-1.4.5.jar:?]
        ... 36 more
[17:49:50 WARN]: [NBTAPI] [NBTAPI] The NBT-API located at 'package com.imnotstable.qualityeconomy.nbtapi' seems to be outdated!
[17:49:50 WARN]: [NBTAPI] [NBTAPI] Current Version: '2.11.2' Newest Version: 2.12.2'
[17:49:50 WARN]: [NBTAPI] [NBTAPI] Please update the NBTAPI or the plugin that contains the api(nag the mod author when the newest release has an old version, not the NBTAPI dev)!

[17:49:50 INFO]: [NBTAPI] [NBTAPI] Found Spigot: v1_20_R3! Trying to find NMS support
[17:49:50 WARN]: [NBTAPI] [NBTAPI] This Server-Version(v1_20_R3) is not supported by this NBT-API Version(2.11.2) located at com.imnotstable.qualityeconomy.nbtapi.utils.MinecraftVersion. The NBT-API will try to work as good as it can! Some functions may not work!

Update the api for 1.20.4 support.

[17:49:50 WARN]: [NBTAPI] [NBTAPI] Please update the NBTAPI or the plugin that contains the api(nag the mod author when the newest release has an old version, not the NBTAPI dev)!

That very last line is there for a reason.