crwdns128799:0crwdne128799:0
crwdns128801:0crwdne128801:0
crwdns128803:0crwdne128803:0
crwdns128805:0:javadoc:crwdnd128805:0:javadoc:crwdne128805:0
Warning
crwdns128807:0:doc:crwdne128807:0
crwdns128809:0crwdne128809: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
crwdns128811:0:javadoc:crwdne128811:0
Note
crwdns128813:0:javadoc:crwdnd128813:0:javadoc:crwdnd128813:0:javadoc:crwdne128813:0
crwdns128815:0crwdne128815:0
crwdns128817:0crwdne128817:0
crwdns128819:0crwdne128819: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());
}
crwdns128821:0:javadoc:crwdne128821:0
crwdns128823:0crwdne128823:0
crwdns128825:0crwdne128825:0
crwdns128827:0crwdne128827:0
crwdns128829:0crwdne128829:0
crwdns128831:0:javadoc:crwdne128831:0
crwdns128833:0crwdne128833:0
crwdns128835:0crwdne128835:0