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

On click on sign: Not working as expected #55

Closed Griffeng closed 2 years ago

Griffeng commented 2 years ago

Skript Version

[21:07:19 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases [21:07:19 INFO]: [Skript] Skript's documentation can be found here: https://skriptlang.github.io/Skript [21:07:19 INFO]: [Skript] Server Version: git-PaperSpigot-445 (MC: 1.8.8) [21:07:19 INFO]: [Skript] Skript Version: 2.6.1 [21:07:19 INFO]: [Skript] Installed Skript Addons: [21:07:19 INFO]: [Skript] - DiSky v2.1 (https://disky.itsthesky.info/) [21:07:19 INFO]: [Skript] - skript-reflect v2.3 (https://github.com/TPGamesNL/skript-reflect) [21:07:19 INFO]: [Skript] - skRayFall v1.9.20 (https://sk.rayfall.net/) [21:07:19 INFO]: [Skript] - SkBee v1.10.2 (https://github.com/ShaneBeee/SkBee) [21:07:19 INFO]: [Skript] Installed dependencies: [21:07:19 INFO]: [Skript] - SQLibrary v7.1 [21:07:19 INFO]: [Skript] - Vault v1.7.2-b107 [21:07:19 INFO]: [Skript] - WorldGuard v6.1

Bug Description

When using skript-1.8 click on sign event is kinda buggy. Tryed the same skript on 2.2-dev36 and worked without errors.

This is the skript used for tesing:

options:

    prefix: &c&lShop &8»

on sign change:

    if line 1 is "[Shop buy]":
        if player has the permission "staff":
            set {shop::item::shop%location of block%} to 2nd line parsed as item type
            set {shop::pris::shop%location of block%} to 3rd line parsed as number
            set {shop::amount::shop%location of block%} to 4th line parsed as number
            set 1st line to "&2&lBUY"
            set 2nd line to "&7%2nd line%"
            set 3rd line to "&7%3rd line%&8 $."
            set 4th line to "&7%4th line%&8 stk."
    if line 1 is "[Shop sell]":

        if player has the permission "staff":
            set {shop::item::shop%location of block%} to 2nd line parsed as item type
            set {shop::pris::shop%location of block%} to 3rd line parsed as number
            set {shop::amount::shop%location of block%} to 4th line parsed as number
            set 1st line to "&c&lSELL"
            set 2nd line to "&7%2nd line%"
            set 3rd line to "&7%3rd line%&8 $."
            set 4th line to "&7%4th line%&8 stk."

on rightclick on sign:
    if {shop::item::shop%location of block%} is set:
        if 1st line is "&2&lBUY":
            if player's balance is higher than {shop::pris::shop%location of block%} -1:
                add {shop::amount::shop%location of block%} of {shop::item::shop%location of block%} to player's inventory
                remove {shop::pris::shop%location of block%} from player's balance
                message "{@prefix} &7Du købte &c%{shop::amount::shop%location of block%}% &7stk. &c%{shop::item::shop%location of block%}%&7, som kostede dig &c$%{shop::pris::shop%location of block%}%&7."
            else:
                message "{@prefix} &7Du har ikke nok penge til at købe dette."

on rightclick on sign:
    if {shop::item::shop%location of block%} is set:
        if 1st line is "&c&lSELL":
            if number of {shop::item::shop%location of block%} in player's inventory is greater than or equal to {shop::amount::shop%location of block%}:
                remove {shop::amount::shop%location of block%} of {shop::item::shop%location of block%} from player's inventory
                add {shop::pris::shop%location of block%} to player's balance
                message "{@prefix} &7Du solgte &c%{shop::amount::shop%location of block%}% %{shop::item::shop%location of block%}% &7for &c$%{shop::pris::shop%location of block%}%&7."
            else:
                message "{@prefix} &7Du mangler &c%{shop::amount::shop%location of block%}%&7 stk. &c%{shop::item::shop%location of block%}%&7."

on leftclick on sign:
    if {shop::item::shop%location of block%} is set:
        if 1st line is "&c&lSELL":
            if player's inventory contains {shop::item::shop%location of block%}:
                set {_antal::%player%} to 0
                set {_antal::%player%} to number of {shop::item::shop%location of block%} in player's inventory
                remove all {shop::item::shop%location of block%} from player's inventory
                set {_pris::%player%} to 0
                set {_pris::%player%} to {_antal::%player%} * {shop::pris::shop%location of block%}
                add {_pris::%player%} to player's balance
                message "{@prefix} &7Du solgte &c%{_antal::%player%}% &7stykker &c%{shop::item::shop%location of block%}% &7for &c%{_pris::%player%}% $&7."
            else:
                message "{@prefix} &7Du har intet &c%{shop::item::shop%location of block%}% &7at sælge."

Expected Behavior

When clicking a sell sign it's supposed to remove the block and give the money but nothing triggers after clicking. Same with buying.

I have other signs that make the player run a command to open a gui but when players click the sign the gui opens but its empty. works fine if the type in the command in chat.

Steps to Reproduce

Try run the skript i provided yourself.

Errors or Screenshots

No response

Other

There is no errors in the console or ingame when reloading the skript

Agreement

Matocolotoe commented 2 years ago

There seems to be a problem within your code after the on right click on sign trigger, I cannot replicate the issue.

Griffeng commented 2 years ago

Yeah ok its fixed after the latest update not sure what the problem was, gonna close this now.