Skript-1.8 icon indicating copy to clipboard operation
Skript-1.8 copied to clipboard

Vanilla gui not working as expected.

Open Griffeng opened this issue 3 years ago • 3 comments
trafficstars

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

  • [X] I have read the guidelines above and confirm I am following them with this report.

Griffeng avatar Apr 25 '22 16:04 Griffeng

try waiting a tick

wallace4BR avatar Jun 28 '22 20:06 wallace4BR

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()):

Matocolotoe avatar Jan 08 '23 16:01 Matocolotoe

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

NotSoDelayed avatar Jan 28 '24 03:01 NotSoDelayed