Cancel the Event not working on Right Click of Entity

  • 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.

Cirom

Member
May 19, 2017
2
0
1
I have a pretty basic skript file.

Code:
on right click on a pig:
    player's tool is saddle:
        name of player's tool is not "":
            send "[&eInfo&f] You cannot saddle a pig with an &o&bImperfect Saddle&f." to player
            cancel the event

Basically, this code is to prevent players from saddling pigs with named saddles, including a saddle named "Imperfect Saddle" which is craftable on the server. (The reasoning for this is that the pigs drop an un-named saddle on death)

The first four lines display properly. I right click the pig with the Imperfect Saddle, and the message is sent to me just fine. However, what once worked in 1.8 (cancel the event) is no longer cancelling the event, and the pig is being saddled anyway. Ah-!

This also seems to apply for another system on the server...

Code:
on right click on villager:
    cancel the event
    set {tk-usingVillager.%UUID of player%} to true
    make player execute command "/shopmenu"
    set {tk-usingVillager.%UUID of player%} to false

What this basically does is open up HyperMerchant's /shopmenu when right clicking a villager... but right now it's just opening the regular villager GUI, despite there being a "cancel the event" thing in there. :c
 
I have no idea why cancelling the event doesn't work but here's a workaround:
code_language.skript:
on right click on a pig:
    player's tool is saddle:
        name of player's tool is not "":
            kill the event-entity
            spawn a pig at event-entity's location
            send "[&eInfo&f] You cannot saddle a pig with an &o&bImperfect Saddle&f." to player
            player's gamemode is survival:
                give player a saddle named "%name of player's tool%"
 
Hm, has anyone else gotten cancelling events to work on 1.11 (or even 1.12?) yet? Nice to know that it's a bug rather than intended behaviour, so if there's someone who managed to get it to work, I guess we could work backwards to see what's causing it. ;o
 
Cancelling other events work for me on 1.11.2 it's just canceling the saddle that isnt working
 
Status
Not open for further replies.