crwdns117819:0crwdne117819:0

crwdns117821:0crwdne117821:0

crwdns117823:0crwdne117823:0

crwdns117825:0:javadoc:crwdnd117825:0:javadoc:crwdne117825:0

Warning

crwdns117827:0:doc:crwdne117827:0

crwdns117829:0crwdne117829: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

crwdns117831:0:javadoc:crwdne117831:0

Note

crwdns117833:0:javadoc:crwdnd117833:0:javadoc:crwdnd117833:0:javadoc:crwdne117833:0

crwdns117835:0crwdne117835:0

crwdns117837:0crwdne117837:0

crwdns117839:0crwdne117839: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());
}

crwdns117841:0:javadoc:crwdne117841:0

  • crwdns117843:0crwdne117843:0

  • crwdns117845:0crwdne117845:0

  • crwdns117847:0crwdne117847:0

crwdns117849:0crwdne117849:0

  • crwdns117851:0:javadoc:crwdne117851:0

  • crwdns117853:0crwdne117853:0

  • crwdns117855:0crwdne117855:0