Skip to content

provsalt/economy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Economy

The "pretty" straight forward api to create an economy for your server

To start of just use the New function

package main

import (
	"github.com/provsalt/economy"
	"github.com/provsalt/economy/provider"
)
func main() {
	e := economy.New(provider.NewSQLite("database/sqlite3.db"))
}

Balance

func main() {
    bal, ohno := e.Balance(player.UUID())
    if ohno != nil {
        panic(ohno) 
    }
    fmt.Println(bal)
}

Increase

ohno = e.Increase(player.UUID(), 500)
if ohno != nil {
	panic(ohno)
}

Decrease

ohno = e.Decrease(player.UUID(), 500)
if ohno != nil {
	panic(ohno)
}

Set

ohno = e.Set(player.UUID(), 500)
if ohno != nil {
	panic(ohno)
}

Close

ohno = e.Close()
if ohno != nil {
	panic(ohno)
}