Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
3.6 kB
2
Indexable
Never
# eco.sk // DexRNG

options:
    prefix: <##EEABFF>&lDexRNG &8»
    prefixNoDash: <##EEABFF>&lDexRNG

on load:
    load yaml "plugins/Skript/scripts/yml/eco.yml" as "economy"

    # permissionMessage Initialization
    set {permissionMessage} to "{@prefix} &7You do not have permission to use this command"
    set {permissionMessage} to {permissionMessage} without quotation marks

import:
    java.lang.String
    java.lang.Long

effect (add|give) [value] %objects% to [the] %player%'s balance:
    trigger:
        add expr-1 to {balance::%uuid of expr-2%}

effect (remove|take) [value] %objects% from [the] %player%'s balance:
    trigger:
        remove expr-1 from {balance::%uuid of expr-2%}

effect (reset|drain) [the] %player%'s balance:
    trigger:
        set {balance::%uuid of expr-1%} to 0

effect pay all [online] player's %objects%:
    trigger:
        loop all players:
            add expr-1 to loop-player's balance

expression %string% without quotation marks:
    get:
        set {_m} to expr-1
        replace all """" in {_m} with ""
        return {_m}

expression balance format[ted] %number%:
    get:
        set {_n} to expr-1
        if mod({_n}, 1) is 0:
            return String.format("%%,d", new Long({_n}))
        else:
            return String.format("%%,.2f", {_n})

# Economy
# /eco(nomy) (add|remove|reset) (integer|player) [integer]
# /pay (*|player) (integer)
# /bal(ance)top [page|player]
# /bal(ance) [player]

command economy <text> <text> [<number>]:
    permission: eco
    permission message: {permissionMessage}
    aliases: eco
    usage: {@prefix} &7/economy (add|remove|reset) (integer|player) [integer]
    trigger:
        if arg-1 is "add":
            if arg-2 and arg-3 is set:
                set {_target} to arg-2 parsed as offline player
                add value arg-3 to the {_target}'s balance
                send "{@prefix} &7You added &f$%arg-3% &7to &f%{_target}%" to player
                send "{@prefix} &f%player% &7added &f$%arg-3% &7to your account." to {_target}
            else:
                send "{@prefix} &7Your args are wrong." to player

        else if arg-1 is "remove":
            if arg-2 and arg-3 is set:
                set {_target} to arg-2 parsed as offline player
                remove value arg-3 from the {_target}'s balance
                send "{@prefix} &7You removed &f$%arg-3% &7to &f%{_target}%" to player
                send "{@prefix} &f%player% &7removed &f$%arg-3% &7from your account." to {_target}
            else:
                send "{@prefix} &7Your args are wrong." to player

        else if arg-1 is "reset":
            if arg-2 and arg-3 is set:
                set {_target} to arg-2 parsed as offline player
                drain the {_target}'s balance
                send "{@prefix} &7You drains &f%{_target}%" to player
                send "{@prefix} &f%player% &7drained &f$%arg-3% &7your account." to {_target}
            else:
                send "{@prefix} &7Your args are wrong." to player

        else:
            send "{@prefix} &7/economy (add|remove|reset) (integer|player) [integer]" to player

command pay <text> <number>:
    aliases: p
    usage: {@prefix} &7/pay (*|player) (integer)
    trigger:
        if arg-1 is "*":
            if {balance::%uuid of player%} >= arg-2
                loop all players:
                    set {_target} to loop-player
                    add value arg-2 to {_target}'s balance
                    send "{@prefix} &7You were paid &f$%arg-2% &7by &f%player%&7."
                calculate the payment of arg-2 by player and send title
Leave a Comment