[SOLVED] Skript Vault

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

ShaneBee

Supporter +
Addon Developer
Sep 7, 2017
2,248
241
73
Vancouver, Canada
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_language.skript:
on vault pay:
    add event-value to {MyCustomEco::%event-player%}

on vault charge:
    remove event-value from {MyCustomEco::%event-player%}

And then obviously in your skripts where you already have things like
code_language.skript:
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
 
Last edited:
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:
//skvault economy class
@Override
public double getBalance(String playerName) {
    variable = call "vault request balance event" with event value player's name
    return variable.getBalance()
}

//in skript
on vault request balance:
    set return balance to {balances::%event-%player%}

depositing example
Code:
//skvault economy class
@Override
public EconomyResponse depositPlayer(String playerName, double amount) {
    variable = call "vault request deposit event" with event values player's name and amount
    return new EconomyResponse(variable.getBalance(), variable.wasSuccesfull(), idk, the, actual, parameters)
}

//in skript
on vault request deposit:
   add event-number to {balances::%event-player%}
   set economy response balance to {balances::%event-player%}
   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
 
  • Like
Reactions: ShaneBee
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.

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.
 
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.
 
Last edited:
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
 
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