Chestshop hook

  • 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 comminuty!

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

YellowZaki

Member
Mar 6, 2017
24
0
0
26
I would like an addon with the following:

Events:

on chestshop buy
on chestshop sell


Expressions:

event-buyer
event-seller
chestshop-quantity
chestshop-price


I think it would be a cool addon.

Thanks.
 
im not sure, btw im not clever. but you can hook selfmade with Skelett...


you need just find the Source, like this
bukkit.chestshop.price

or so... i don't know much about Java...
 
  • Like
Reactions: YellowZaki
I didn't know you could hook with Skelett.
How? I can't find anything related to that.
 
I didn't know you could hook with Skelett.
How? I can't find anything related to that.

upload_2017-6-29_2-2-24.png
 
  • Like
Reactions: YellowZaki
I would like an addon with the following:

Events:

on chestshop buy
on chestshop sell


Expressions:

event-buyer
event-seller
chestshop-quantity
chestshop-price


I think it would be a cool addon.

Thanks.

and you can also use the 'skellet get method' to get event-buyer, event-seller, and all that..

There's no proper tutorial yet, but Xannyifier, a votifier lisener script, uses the skellett method and the custom event.
 
  • Like
Reactions: YellowZaki
Really really cool, it works and I can get the price, buyer, seller, price...


But I can't cancell the events, which is the most important thing to me
. :emoji_frowning:


[doublepost=1498698900,1498696410][/doublepost]If someone want this:

In CustomEvents.yml from Skellett:

code_language.skript:
  3:
    Event: "com.Acrobot.ChestShop.Events.TransactionEvent"
    Syntax: "[on] chestshop"

In a skript:

code_language.skript:
on chestshop:
    set {_client} to method "getClient"  #The player who is buying/selling
    set {_owner} to method "getOwner"  #Who created the chestshop
    set {_price} to method "getPrice"  #Price
    set {_stock} to method "getStock"  #Amount of items
    set {_type} to method "getTransactionType"  #Returns BUY or SELL
    broadcast "%{_client}% %{_owner}%  %{_price}%   %{_stock}%   %{_type}%"
 
hm, one question, will this events active if you create a sign shop? (I don't have much infomantion about this Plugins)

If yes, so instead cancel event just (If this a sign)

set line 1 of event-block to "..."
 
No, the event is run when you right click the sign (on right click sign won't work)
 
Anyways what are you trying to cancel? @YellowZaki , add a boolean (if condition) if your conditio is met, code stuff about it.
 
I'm trying to do:

on buy on chestshop:
seller's balance is greater than (500*island level)
cancel event

The event can be cancelled, I'm sure, but it is not possible with Skellett.
 
How the CustomEvents.yml should look:
code_language.skript:
CustomEvents: false
# Unleash the power, and stride onwards!
CustomEventSetup:
  NumberOfEvents: 1
  1:
    Event: "com.Acrobot.ChestShop.Events.PreTransactionEvent"
    Syntax: "[on] [player] chest[ ]shop (buy|transaction)"
Source code of the event https://github.com/ChestShop-author...bot/ChestShop/Events/PreTransactionEvent.java

Example of getting the owner of the shop and client buying.

code_language.skript:
on chestshop buy:
    set {_owner} to method "getOwner"
    set {_client} to method "getClient"
    set {_price} to method "getPrice"
    set {_returnAction} to method "getTransactionType"
The return action returns one of these https://github.com/ChestShop-author...hop/Events/PreTransactionEvent.java#L183-L208

Pretty self explanitory as to what each one being returned is.
 
  • Like
Reactions: YellowZaki
How the CustomEvents.yml should look:
code_language.skript:
CustomEvents: false
# Unleash the power, and stride onwards!
CustomEventSetup:
  NumberOfEvents: 1
  1:
    Event: "com.Acrobot.ChestShop.Events.PreTransactionEvent"
    Syntax: "[on] [player] chest[ ]shop (buy|transaction)"
Source code of the event https://github.com/ChestShop-author...bot/ChestShop/Events/PreTransactionEvent.java

Example of getting the owner of the shop and client buying.

code_language.skript:
on chestshop buy:
    set {_owner} to method "getOwner"
    set {_client} to method "getClient"
    set {_price} to method "getPrice"
    set {_returnAction} to method "getTransactionType"
The return action returns one of these https://github.com/ChestShop-author...hop/Events/PreTransactionEvent.java#L183-L208

Pretty self explanitory as to what each one being returned is.
Thanks you a lot, I didn't see the the PreTransactionEvent.
[doublepost=1498733593,1498731631][/doublepost]Edit: That event can't be cancelled neither. @LimeGlass
[doublepost=1498753882][/doublepost]I finally edited ChestShop source code to implement what I wanted. Thank you anyway.
 
I am trying to stop the purchase of an ITEM and be able to show a confirmation message. This is possible?