crwdns148025:0crwdne148025:0

crwdns148027:0crwdne148027:0

crwdns148029:0crwdne148029:0

crwdns148031:0:javadoc:crwdnd148031:0:javadoc:crwdne148031:0

Warning

crwdns148033:0:doc:crwdne148033:0

crwdns148035:0crwdne148035:0

import org.spongepowered.api.service.economy.EconomyService;
import org.spongepowered.api.Sponge;

Optional<EconomyService> serviceOpt = Sponge.getServiceManager().provide(EconomyService.class);
if (!serviceOpt.isPresent()) {
    // handle there not being an economy implementation
}
EconomyService economyService = serviceOpt.get();

Warning

crwdns148037:0:javadoc:crwdne148037:0

Note

crwdns148039:0:javadoc:crwdnd148039:0:javadoc:crwdnd148039:0:javadoc:crwdne148039:0

crwdns148041:0crwdne148041:0

crwdns148043:0crwdne148043:0

crwdns148045:0crwdne148045:0

import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.service.economy.EconomyService;
import org.spongepowered.api.service.economy.account.UniqueAccount;
import java.math.BigDecimal;
import java.util.Optional;

Optional<UniqueAccount> uOpt = economyService.getOrCreateAccount(player.getUniqueId());
if (uOpt.isPresent()) {
    UniqueAccount acc = uOpt.get();
    BigDecimal balance = acc.getBalance(economyService.getDefaultCurrency());
}

crwdns148047:0:javadoc:crwdne148047:0

  • crwdns148049:0crwdne148049:0

  • crwdns148051:0crwdne148051:0

  • crwdns148053:0crwdne148053:0

crwdns148055:0crwdne148055:0

  • crwdns148057:0:javadoc:crwdne148057:0

  • crwdns148059:0crwdne148059:0

  • crwdns148061:0crwdne148061:0