Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SkriptAPIException when looping through item #2336

Open
Wealthyturtle opened this issue Aug 5, 2019 · 2 comments
Open

SkriptAPIException when looping through item #2336

Wealthyturtle opened this issue Aug 5, 2019 · 2 comments
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements).

Comments

@Wealthyturtle
Copy link
Member

Description

When attempting to loop through an item, a SkriptAPIException would be thrown in the console logs. I was thinking that there could possibly be a test for shulker boxes, to allow you to loop through shulker box items and get their inventory (or at least just not throw an exception).

Another wierd thing is the console error says the source is from line -1 (which shouldn't happen?)

Steps to Reproduce

command /test:
    trigger:
        set {_i} to player's tool
        loop all items in {_i}:
            broadcast "%loop-item%"

Expected Behavior

Errors / Screenshots

[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! [Skript] Severe Error:
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! Something went horribly wrong with Skript.
[Server thread/ERROR]: #!#! This issue is NOT your fault! You probably can't fix it yourself, either.
[Server thread/ERROR]: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons).
[Server thread/ERROR]: #!#! Here is full list of them:
[Server thread/ERROR]: #!#! skRayFall (https://sk.rayfall.net/) TuSKe (github.com/Tuke-Nuke/TuSKe) SK-NBeeT (https://github.com/ShaneBeee/Sk-NBeeT)
[Server thread/ERROR]: #!#! We could not identify which of those are specially related, so this might also be Skript issue.
[Server thread/ERROR]: #!#! You should try disabling those plugins one by one, trying to find which one causes it.
[Server thread/ERROR]: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue.
[Server thread/ERROR]: #!#! In that case, you will be given instruction on how should you report it.
[Server thread/ERROR]: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin.
[Server thread/ERROR]: #!#! Only if the author tells you to do so, report it to Skript's issue tracker.
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! Stack trace:
[Server thread/ERROR]: #!#! ch.njol.skript.SkriptAPIException:
[Server thread/ERROR]: #!#!     at ch.njol.skript.lang.Variable.iterator(Variable.java:357)
[Server thread/ERROR]: #!#!     at ch.njol.skript.expressions.ExprItemsIn.iterator(ExprItemsIn.java:92)
[Server thread/ERROR]: #!#!     at ch.njol.skript.lang.Loop.walk(Loop.java:79)
[Server thread/ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[Server thread/ERROR]: #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:57)
[Server thread/ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:292)
[Server thread/ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:251)
[Server thread/ERROR]: #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:252)
[Server thread/ERROR]: #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:169)
[Server thread/ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[Server thread/ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[Server thread/ERROR]: #!#!     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[Server thread/ERROR]: #!#!     at java.lang.reflect.Method.invoke(Unknown Source)
[Server thread/ERROR]: #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:316)
[Server thread/ERROR]: #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
[Server thread/ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:529)
[Server thread/ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:514)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.PlayerConnection.handleCommand(PlayerConnection.java:1633)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.PlayerConnection.a(PlayerConnection.java:1481)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.PacketPlayInChat.a(PacketPlayInChat.java:47)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.PacketPlayInChat.a(PacketPlayInChat.java:1)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:19)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.TickTask.run(SourceFile:18)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeTask(SourceFile:144)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeNext(SourceFile:118)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.MinecraftServer.aX(MinecraftServer.java:910)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.MinecraftServer.executeNext(MinecraftServer.java:903)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.awaitTasks(SourceFile:127)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.MinecraftServer.sleepForTick(MinecraftServer.java:887)
[Server thread/ERROR]: #!#!     at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:820)
[Server thread/ERROR]: #!#!     at java.lang.Thread.run(Unknown Source)
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! Version Information:
[Server thread/ERROR]: #!#!   Skript: 2.4-beta5 (latest)
[Server thread/ERROR]: #!#!     Flavor: skriptlang-github
[Server thread/ERROR]: #!#!     Date: 2019-08-04
[Server thread/ERROR]: #!#!   Bukkit: 1.14.4-R0.1-SNAPSHOT
[Server thread/ERROR]: #!#!   Minecraft: 1.14.4
[Server thread/ERROR]: #!#!   Java: 1.8.0_221 (Java HotSpot(TM) 64-Bit Server VM 25.221-b11)
[Server thread/ERROR]: #!#!   OS: Windows 10 amd64 10.0
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! Server platform: Spigot
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! Current node: null
[Server thread/ERROR]: #!#! Current item: loop items in {_i}(as org.bukkit.inventory.Inventory)
[Server thread/ERROR]: #!#! Current trigger: command /test (simple event) (test.sk, line -1)
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! Thread: Server thread
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! Language: english
[Server thread/ERROR]: #!#! Link parse mode: DISABLED
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! End of Error.
[Server thread/ERROR]: #!#!

Server Information

  • Server version/platform: Spigot 1.14.4
  • Skript version: Skript 2.4-beta5

Additional Context

@Wealthyturtle Wealthyturtle added enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements). labels Oct 15, 2019
@TPGamesNL
Copy link
Member

TPGamesNL commented May 8, 2021

I don't think Bukkit provides much API for non-placed shulker boxes.
Also, the exception was fixed in 38d4a82#diff-481faba8bce3de9b133534e61b100c346d9c76ff41c435c0fb620d67bd78ea3d

@FranKusmiruk
Copy link
Member

I don't think Bukkit provides much API for non-placed shulker boxes.

It does, it is just that the system for it sucks. You've got to get the ItemMeta, cast it to BlockStateMeta and then get the ShulkerBox block state instance from the BlockStateMeta and then modify the snapshot inventory (Container#getSnapshotInventory) of the ShulkerBox instance and finally set the ShulkerBox instance of the BlockStateMeta to ours with the inventory modified.

@TheLimeGlass TheLimeGlass added the PR available Issues which have a yet-to-be merged PR resolving it label Mar 25, 2023
@APickledWalrus APickledWalrus added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it completed The issue has been fully resolved and the change will be in the next Skript update. labels Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements).
Projects
None yet
Development

No branches or pull requests

5 participants