1. 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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Chestshop hook

Discussion in 'Addon Suggestions' started by YellowZaki, Jun 28, 2017.

Tags:
  1. YellowZaki

    YellowZaki Member

    Joined:
    Mar 6, 2017
    Messages:
    24
    Likes Received:
    0
    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.
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    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 Like x 1
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    I didn't know you could hook with Skelett.
    How? I can't find anything related to that.
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    upload_2017-6-29_2-2-24.png
     
    • Like Like x 1
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    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 Like x 1
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    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:


    --- Double Post Merged, Jun 29, 2017, Original Post Date: Jun 29, 2017 ---
    If someone want this:

    In CustomEvents.yml from Skellett:

    Code (Skript):
    1.   3:
    2.     Event: "com.Acrobot.ChestShop.Events.TransactionEvent"
    3.     Syntax: "[on] chestshop"
    In a skript:

    Code (Skript):
    1. on chestshop:
    2.     set {_client} to method "getClient"  #The player who is buying/selling
    3.     set {_owner} to method "getOwner"  #Who created the chestshop
    4.     set {_price} to method "getPrice"  #Price
    5.     set {_stock} to method "getStock"  #Amount of items
    6.     set {_type} to method "getTransactionType"  #Returns BUY or SELL
    7.     broadcast "%{_client}% %{_owner}%  %{_price}%   %{_stock}%   %{_type}%"
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    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 "..."
     
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    No, the event is run when you right click the sign (on right click sign won't work)
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    @LimeGlass - I will just tag him, he probably knows how to cancel a custom event.
     
  10. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    Is the event can be cancelled you can use cancel event on it. If not then you can't.
     
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    Anyways what are you trying to cancel? @YellowZaki , add a boolean (if condition) if your conditio is met, code stuff about it.
     
  12. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    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.
     
  13. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    How the CustomEvents.yml should look:
    Code (Skript):
    1. CustomEvents: false
    2. # Unleash the power, and stride onwards!
    3. CustomEventSetup:
    4.   NumberOfEvents: 1
    5.   1:
    6.     Event: "com.Acrobot.ChestShop.Events.PreTransactionEvent"
    7.     Syntax: "[on] [player] chest[ ]shop (buy|transaction)"
    Source code of the event https://github.com/ChestShop-authors/ChestShop-3/blob/master/src/main/java/com/Acrobot/ChestShop/Events/PreTransactionEvent.java

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

    Code (Skript):
    1. on chestshop buy:
    2.     set {_owner} to method "getOwner"
    3.     set {_client} to method "getClient"
    4.     set {_price} to method "getPrice"
    5.     set {_returnAction} to method "getTransactionType"
    6.  
    The return action returns one of these https://github.com/ChestShop-authors/ChestShop-3/blob/master/src/main/java/com/Acrobot/ChestShop/Events/PreTransactionEvent.java#L183-L208

    Pretty self explanitory as to what each one being returned is.
     
    • Like Like x 1
  14. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,176
    Likes Received:
    217
    Thanks you a lot, I didn't see the the PreTransactionEvent.
    --- Double Post Merged, Jun 29, 2017, Original Post Date: Jun 29, 2017 ---
    Edit: That event can't be cancelled neither. @LimeGlass
    --- Double Post Merged, Jun 29, 2017 ---
    I finally edited ChestShop source code to implement what I wanted. Thank you anyway.
     
  15. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    I am trying to stop the purchase of an ITEM and be able to show a confirmation message. This is possible?
     

Share This Page

Loading...