Owner of current inventory

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

PatoFrango

Active Member
Jul 12, 2017
240
14
18
Hi,

How can I check the region at the owner of the current inventory of a player?

I've tried doing
Code:
on inventory click:
    set {_owner} to owner of player's current inventory
    "%region at {_owner}%" contains "vault%player%"

And it works in-game, but it gives me this giant error in the console:
Code:
[ERROR] [Skript] Something went wrong when trying to get the owner of the specified inventory!

[ERROR] [Skript] Post the below info on the SkStuff thread in SkUnity:

[ERROR] #!#!

[ERROR] #!#! [Skript] Severe Error:

[ERROR] #!#!

[ERROR] #!#! Something went horribly wrong with Skript.

[ERROR] #!#! This issue is NOT your fault! You probably can't fix it yourself, either.

[ERROR] #!#! You're running outdated version of Skript! Please try updating it NOW; it might fix this.

[ERROR] #!#! You may download new version of Skript at https://github.com/bensku/Skript/releases

[ERROR] #!#! You will be given instructions how to report this error if it persists with latest Skript.

[ERROR] #!#! Issue tracker: https://github.com/SkriptLang/Skript/issues (only if you know what you're doing!)

[ERROR] #!#!

[ERROR] #!#! Stack trace:

[ERROR] #!#! java.lang.NullPointerException

[ERROR] #!#! at me.TheBukor.SkStuff.expressions.ExprInventoryOwner.get(ExprInventoryOwner.java:59)

[ERROR] #!#! at ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:102)

[ERROR] #!#! at ch.njol.skript.effects.EffChange.execute(EffChange.java:268)

[ERROR] #!#! at ch.njol.skript.lang.Effect.run(Effect.java:52)

[ERROR] #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)

[ERROR] #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)

[ERROR] #!#! at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)

[ERROR] #!#! at ch.njol.skript.SkriptEventHandler.check(SkriptEventHandler.java:151)

[ERROR] #!#! at ch.njol.skript.SkriptEventHandler$1.execute(SkriptEventHandler.java:109)

[ERROR] #!#! at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)

[ERROR] #!#! at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500)

[ERROR] #!#! at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485)

[ERROR] #!#! at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1889)

[ERROR] #!#! at net.minecraft.server.v1_12_R1.PacketPlayInWindowClick.a(SourceFile:33)

[ERROR] #!#! at net.minecraft.server.v1_12_R1.PacketPlayInWindowClick.a(SourceFile:10)

[ERROR] #!#! at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13)

[ERROR] #!#! at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

[ERROR] #!#! at java.util.concurrent.FutureTask.run(FutureTask.java:266)

[ERROR] #!#! at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46)

[ERROR] #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748)

[ERROR] #!#! at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406)

[ERROR] #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679)

[ERROR] #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577)

[ERROR] #!#! at java.lang.Thread.run(Thread.java:813)

[ERROR] #!#!

[ERROR] #!#! Version Information:

[ERROR] #!#! Skript: 2.2-dev36 (OUTDATED)

[ERROR] #!#! Bukkit: 1.12.2-R0.1-SNAPSHOT

[ERROR] #!#! Minecraft: 1.12.2

[ERROR] #!#! Java: 1.8.0_212 (Eclipse OpenJ9 VM openj9-0.14.0)

[ERROR] #!#! OS: Linux amd64 4.15.0-55-generic

[ERROR] #!#!

[ERROR] #!#! Server platform: Spigot

[ERROR] #!#!

[ERROR] #!#! Current node: null

[ERROR] #!#! Current item: set {_owner}(as java.lang.Object) to owner of event-inventory

[ERROR] #!#! Current trigger: inventory click (dispense/spawn/drop/craft/pickup/consume/break/despawn/merge) (vault.sk, line 20)

[ERROR] #!#!

[ERROR] #!#! Thread: Server thread

[ERROR] #!#!

[ERROR] #!#! Language: english

[ERROR] #!#! Link parse mode: DISABLED

[ERROR] #!#!

[ERROR] #!#! End of Error.

[ERROR] #!#!
And no, updating Skript is out of question as it breaks 90% of the scripts I've written in older versions... Any ideas?
 
Last edited:
huh what huh?
The player is the owner of their own inventory, who the heck else would it be?
Just use player
 
huh what huh?
The player is the owner of their own inventory, who the heck else would it be?
Just use player
I think he means like /invsee (player).
If you do mean that what about:
Code:
on command "invsee":
    set {owner.%player%} to "%arguments%" parsed as a player
 
huh what huh?
The player is the owner of their own inventory, who the heck else would it be?
Just use player
What if I have a blocks inventory open? Blocks have inventories too. I wanna check the region at the chest whose inventory is open for the player
 
What if I have a blocks inventory open? Blocks have inventories too. I wanna check the region at the chest whose inventory is open for the player
But a block, ie: a chest, wouldn't have an owner.

If Im not mistaken, you can only check for regions at players, not entities or blocks.

If you are worried about a player opening a chest that is in a region, whilst the player is outside of the region, you will need to expand your region.
 
Like enderchest?
Not quite. For example, when you open a chest you’re opening that blocks inventory. At least thats what I learned from Skript, as the owner of the inventory works with chests, I just dont like it spamming this error in the console every time I click a slot.

But a block, ie: a chest, wouldn't have an owner.

If Im not mistaken, you can only check for regions at players, not entities or blocks.

If you are worried about a player opening a chest that is in a region, whilst the player is outside of the region, you will need to expand your region.
Well, as I said earlier it does actually work. It doesn’t give me any compiling errors and it works at runtime, so in theory it does. And yes! You can check the region at a block. It’s super useful for what I do at my server. And you see, I can’t expand the region because there are multiple ones and they’re all small and pratically side to side. Each region belongs to a player, and the player can only open the chest at their region, even if they are inside someone else’s.
 
Not quite. For example, when you open a chest you’re opening that blocks inventory. At least thats what I learned from Skript, as the owner of the inventory works with chests, I just dont like it spamming this error in the console every time I click a slot.


Well, as I said earlier it does actually work. It doesn’t give me any compiling errors and it works at runtime, so in theory it does. And yes! You can check the region at a block. It’s super useful for what I do at my server. And you see, I can’t expand the region because there are multiple ones and they’re all small and pratically side to side. Each region belongs to a player, and the player can only open the chest at their region, even if they are inside someone else’s.
If this then are solved pls mark it as solved :emoji_slight_smile:
 
Have you tried updating skript? It is what the error says
Well I cant update Skript because it breaks all of my scripts lol. Im still on 2.2dev26 i believe, they must’ve changed something on how the actual language works because it gives me a lot of errors where it didn’t, and i mean a lot
 
Well I cant update Skript because it breaks all of my scripts lol. Im still on 2.2dev26 i believe, they must’ve changed something on how the actual language works because it gives me a lot of errors where it didn’t, and i mean a lot
I think it is the only way
 
Status
Not open for further replies.