Giter Site home page Giter Site logo

wintone01 / rediseconomy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emibergo02/rediseconomy

0.0 0.0 0.0 404 KB

Economy plugin made with redis

Home Page: https://www.spigotmc.org/resources/rediseconomy%E2%9A%A1-unlimited-currencies-cross-server-open-source.105965/

Java 100.00%

rediseconomy's Introduction

RedisEconomy

Economy plugin made with redis

Maven

Add this repository to your pom.xml:

<repository>
  <id>jitpack.io</id>
  <url>https://jitpack.io</url>
</repository>  

Add the dependency and replace <version>...</version> with the latest release version:

<dependency>
  <groupId>com.github.Emibergo02</groupId>
  <artifactId>RedisEconomy</artifactId>
  <version>main-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>

Gradle

Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Add the dependency and replace master-SNAPSHOT with the latest release version:

dependencies {
  compileOnly 'com.github.Emibergo02:RedisEconomy:main-SNAPSHOT'
}

API usage

// Access Point
RedisEconomyAPI api = RedisEconomyAPI.getAPI();
if(api==null){
    Bukkit.getLogger().info("RedisEconomyAPI not found!");
}

//get a Currency
Currency currency = api.getCurrencyByName("vault"); //Same as api.getDefaultCurrency()
api.getCurrencyBySymbol("€");//Gets the currency by symbol

//Currency is a Vault Economy https://github.com/MilkBowl/VaultAPI/blob/master/src/main/java/net/milkbowl/vault/economy/Economy.java, 
//same methods and everything
currency.getBalance(offlinePlayer);
currency.withdrawPlayer(offlinePlayer, 100);

//Modify a player balance (default currency)
api.getDefaultCurrency().setPlayerBalance(player.getUniqueId(), 1000);

//Get all accounts from currency cache
api.getDefaultCurrency().getAccounts().forEach((uuid, account) -> {
    Bukkit.getLogger().info("Account: "+uuid+", Balance: "+account);
});

//Direct data from redis. (Not recommended)
api.getDefaultCurrency().getOrderedAccounts().thenAccept(accounts -> {
    accounts.forEach(account -> {
        Bukkit.getLogger().info("UUID: "+account.getElement()+", Balance: "+account.getScore());
    });
});
api.getDefaultCurrency().getAccountRedis(uuid).thenAccept(account -> {
    Bukkit.getLogger().info("Balance: "+ account);
});

rediseconomy's People

Contributors

emibergo02 avatar wintone01 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.