Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.sosoh.essentials.commands.economy;
- import org.spongepowered.api.entity.player.Player;
- import org.spongepowered.api.text.Texts;
- import org.spongepowered.api.text.format.TextColors;
- import org.spongepowered.api.util.command.CommandException;
- import org.spongepowered.api.util.command.CommandResult;
- import org.spongepowered.api.util.command.CommandSource;
- import org.spongepowered.api.util.command.args.CommandContext;
- import org.spongepowered.api.util.command.spec.CommandExecutor;
- import com.sosoh.essentials.Main;
- import com.sosoh.essentials.services.EconomyService;
- public class BalanceCommand implements CommandExecutor {
- public EconomyService economy = Main.access.economy;
- @Override
- public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
- if(src instanceof Player){
- Player player = (Player)src;
- int balance = economy.getBalance(player);
- player.sendMessage(Texts.builder("Your current balance is " + balance + economy.getSymbol()
- + " (" + economy.getName() + ")").build());
- }else{
- src.sendMessage(Texts.builder("This command can only be performed by a player.").color(TextColors.RED).build());
- }
- return CommandResult.success();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement