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.

[SOLVED] Skript Vault

Discussion in 'Addon Suggestions' started by ShaneBee, Jun 24, 2018.

  1. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    SOLVED:
    The plugin/Add-on SkVault has been made thanks to Donut

    Hello all. I have mentioned this a few times in other spots, but im going to throw this in here.

    A Skript VAULT add-on.

    One problem I know many people face is, they want to write their own economy, because maybe they have decided to drop the essentials java plugin, and write their own core. BUT.... we all come down to this one problem, If we write our OWN economy system, vault dependant plugins such as JobsReborn, ShopChest/ChestShop, Quests, etc, will not hook into our custom economy. BOOOOO...... so here is what i suggest. An add-on called, hmm.... let's say Sk-Vault / Sk-Vault-Eco / SkEco? or if we wanna get crazy, SKault? No, don't do that, thats terrible.

    I don't know java at all or I would write the dang thing myself. But here is what I was thinking. Write the add-on so when it loads, it tells vault "Hey, I'm an economy plugin" and vault would be able to recognize it as the economy plugin. Then maybe in your Skript you could use events like:
    Code (Skript):
    1. on vault pay:
    2.     add event-value to {MyCustomEco::%event-player%}
    3.  
    4. on vault charge:
    5.     remove event-value from {MyCustomEco::%event-player%}
    And then obviously in your skripts where you already have things like
    Code (Skript):
    1. add 10 to player's balance
    It is already linked into vault, so it would forward that amount to your custom economy skript


    Just a thought.
    I would love to see this become a thing. Im actually quite surprised this hasn't happened yet.
    Im going to tag some of you guys in here that I think are great add-on devs, and active in the community.
    Dont be offended if I didn't tag you, these are just the people I know well enough / talk to the most.
    @Donut
    @Pikachu
    @LimeGlass
    @Snow-Pyon
     
    #1 ShaneBee, Jun 24, 2018
    Last edited: Jun 26, 2018
  2. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,336
    Likes Received:
    176
    Medals:
    im no vault expert but from what i understand the economy plugin registers an economy class (which implements vault's economy interface) that defines what calls to vault api will return. I think your event idea would work assuming calling an event happens immediately and there is no delay (which i believe is true or how else would events be cancelled)

    getting balance example
    Code (Text):
    1. //skvault economy class
    2. @Override
    3. public double getBalance(String playerName) {
    4.     variable = call "vault request balance event" with event value player's name
    5.     return variable.getBalance()
    6. }
    7.  
    8. //in skript
    9. on vault request balance:
    10.     set return balance to {balances::%event-%player%}
    depositing example
    Code (Text):
    1. //skvault economy class
    2. @Override
    3. public EconomyResponse depositPlayer(String playerName, double amount) {
    4.     variable = call "vault request deposit event" with event values player's name and amount
    5.     return new EconomyResponse(variable.getBalance(), variable.wasSuccesfull(), idk, the, actual, parameters)
    6. }
    7.  
    8. //in skript
    9. on vault request deposit:
    10.    add event-number to {balances::%event-player%}
    11.    set economy response balance to {balances::%event-player%}
    12.    set economy response was successful to true
    seems like itd be pretty straightforward, idk if someone has a better idea. i wouldnt mind making this if no one else wants to
     
    ShaneBee likes this.
  3. Snow-Pyon

    Snow-Pyon Well-Known Member

    Joined:
    Jan 25, 2017
    Messages:
    1,235
    Likes Received:
    176
    Medals:
    It is going to be in vanilla Skript sooner or later so I wouldn't bother on putting it in an addon to be honest.
     
    Uzumaki likes this.
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Thats odd, since I put it in the issues section on bensku's skript GitHub, and majority of the replies were
    "it's a bit hard conceptually but i could see it"
    "Would be a great feature to add, would be pretty difficult though. Idk if bensku would be up for this being in Skript, and even so, it’d be low priority and wouldn’t be added for quite some time."
    "a system like that would cause more issues than it fixes"

    Seems like no one really wanted to work on it and have it added to Skript. I mean, if Donut wants to make it that would be super cool, and if it is later added to Skript, then that would be cool too. But it sucks just having to wait around for "sooner or later" .... when we all know it probably will be later than sooner.

    I'd love to see an add-on down soon, and then later if it IS added to Skript, I can convert my code over to that.
     
  5. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,336
    Likes Received:
    176
    Medals:
    ill make the addon if it gets added it gets added
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Awesome.
    Thanks donut. I really appreciate it and I’m sure plenty of others will as well.
     
  7. LimeGlass

    VIP Supporter ++ Regular Diner Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    623
    Likes Received:
    439
    Medals:
    The Vault hook into Skript acts as your economy. It's up to the user to modify the balances.

    The reason people create custom economys is because the latest Vault doesn't hook with Skript (until recently with Bensku's edit), not because they want to but because they're forced to. This means that all the Vault syntaxes like balances and chat prefixes won't be registered, thus making users take an alternative route. Already talked about this many times in the past and even Mirre brought this up.

    I see no reason for a Vault add-on other than maybe permissions. Skript already supports a hook so that you can create your own economy.
     
    #7 LimeGlass, Jun 25, 2018
    Last edited: Jun 25, 2018
  8. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,336
    Likes Received:
    176
    Medals:
    he's talking about registering the economy with vault so when a plugin does vault.getEconomy.getBalance(player) (whatever the methods are) it uses their economy system they made
     
  9. LimeGlass

    VIP Supporter ++ Regular Diner Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    623
    Likes Received:
    439
    Medals:
    That's what it does, does it not?
     
  10. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,336
    Likes Received:
    176
    Medals:
    skripts vault hook lets you get the balance of players from the registered economy plugin. he wants the registered economy plugin to be his skript
     
  11. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Thanks Donut for making SkVault... really appreciate it!
     
  12. ocip

    ocip Member

    Joined:
    Oct 31, 2021
    Messages:
    3
    Likes Received:
    0
    I just wanna know how to download it
     

Share This Page

Loading...