crwdns137381:0crwdne137381:0

crwdns137383:0crwdne137383:0

crwdns137385:0crwdne137385:0

crwdns137387:0:javadoc:crwdnd137387:0:javadoc:crwdne137387:0

Warning

crwdns137389:0:doc:crwdne137389:0

crwdns137391:0crwdne137391:0

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

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

crwdns137393:0crwdne137393:0

crwdns137395:0crwdne137395:0

crwdns137397:0crwdne137397: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.findOrCreateAccount(player.getUniqueId());
if (uOpt.isPresent()) {
  UniqueAccount acc = uOpt.get();
  BigDecimal balance = acc.balance(economyService.defaultCurrency());
}

crwdns137399:0:javadoc:crwdne137399:0

  • crwdns137401:0crwdne137401:0

  • crwdns137403:0crwdne137403:0

  • crwdns137405:0crwdne137405:0

crwdns137407:0crwdne137407:0

  • crwdns137409:0:javadoc:crwdne137409:0

  • crwdns137411:0crwdne137411:0

  • crwdns137413:0crwdne137413:0