Matocolotoe / Skript-1.8

The Skript plugin made for Minecraft 1.8.x only. Releases will follow the original repository, except for some bug fixes. Please read the README before updating to Skript-1.8 !
https://discord.gg/yh3Z98m
GNU General Public License v3.0
47 stars 4 forks source link

Vanilla gui not working as expected. #53

Closed Griffeng closed 3 months ago

Griffeng commented 2 years ago

Skript Version

[18:06:22 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases [18:06:22 INFO]: [Skript] Skript's documentation can be found here: https://skriptlang.github.io/Skript [18:06:22 INFO]: [Skript] Server Version: git-PaperSpigot-445 (MC: 1.8.8) [18:06:22 INFO]: [Skript] Skript Version: 2.6.1 [18:06:22 INFO]: [Skript] Installed Skript Addons: [18:06:22 INFO]: [Skript] - Skellett v1.9.8 (https://forums.skunity.com/resources/skellett.24/) [18:06:22 INFO]: [Skript] - DiSky v2.1 (https://disky.itsthesky.info/) [18:06:22 INFO]: [Skript] - skript-yaml v1.3.2 [18:06:22 INFO]: [Skript] - skDragon v0.16 [18:06:22 INFO]: [Skript] - skUtilities v0.9.2 (https://tim740.github.io/) [18:06:22 INFO]: [Skript] - skript-reflect v2.3 (https://github.com/TPGamesNL/skript-reflect) [18:06:22 INFO]: [Skript] - skRayFall v1.9.20 (https://sk.rayfall.net/) [18:06:22 INFO]: [Skript] - SkriptJSON v1.0.0 [18:06:22 INFO]: [Skript] - SkBee v1.10.2 (https://github.com/ShaneBeee/SkBee) [18:06:22 INFO]: [Skript] Installed dependencies: [18:06:22 INFO]: [Skript] - SQLibrary v7.1 [18:06:22 INFO]: [Skript] - Vault v1.7.2-b107 [18:06:22 INFO]: [Skript] - WorldGuard v6.1

Bug Description

So im using metadata to save the inventory like this:

set metadata tag "inventory.%player%" of player to chest inventory with 5 rows named "%player%'s - %{vagtrank::%UUID of player%}% Dashbord"

I then add the slots:

set slot 15 of metadata tag "inventory.%player%" of player to Glass Bottle named "&8&m--------------------------------" with lore "       &c&lBUFFS"

But when i then use the on inventory event to detect a click in the inventory it just dosent work. I can also take things out of the inventory even tho i cancel the event.

on inventory click:
    if event-inventory is (metadata tag "inventory.%player%" of player):
        cancel event

        if event-slot is 15:
            buff(player)

Expected Behavior

I should execute the function buff(player).

This works in 2.5 and 2.6 official versions on 1.18

Steps to Reproduce

Make a vanilla inventory

Errors or Screenshots

No errors

Other

No response

Agreement

wallace4BR commented 2 years ago

try waiting a tick

Matocolotoe commented 1 year ago

Still haven't figured out how to fix this. The objects really are the same though, so it's an issue with Skript. As a workaround, you could try using the following with skript-reflect :

set {_m} to player.getMetadata("vanillaGUI")
if {_m}.isEmpty() is false:
    if event.getClickedInventory().equals({_m}.get(0).value()):
NotSoDelayed commented 6 months ago

This has been an issue up to MC 1.12, hence this function is used for comparison:

function compare(1: inventory, 2: inventory) :: boolean:
    return false if (name of {_1}) != (name of {_2})
    return false if (rows of {_1}) != (rows of {_2})
    return false if type of {_1} != type of {_2}
    return true