package org.poopki.duckdns.user_db; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class AccountEventHandler implements CommandExecutor { AccountArray m_AccountArray; public AccountEventHandler(AccountArray AA){ m_AccountArray = AA; } @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { Player p = (Player) sender; if (args.length != 0) { switch (args[0]) { case "계좌설정": { if (p.isOp()) { if (args[1] != null) { Player op = Bukkit.getPlayer(args[1]); p.sendMessage("계좌 UUID: " + op.getUniqueId()); if (op != null) { m_AccountArray.setAccountInfo(op.getUniqueId(), Integer.parseInt(args[2])); } else { p.sendMessage("잘못된 계좌입니다."); } } } else { p.sendMessage("OP만 실행 가능한 명령어"); } } case "잔액": { p.sendMessage("잔액: " + m_AccountArray.getAccountInfo(p.getUniqueId()) + "원"); } case "이체": { if (args[1] != null) { Player op = Bukkit.getPlayer(args[1]); if (op != null) { m_AccountArray.transfer(p.getUniqueId(), op.getUniqueId(), Integer.parseInt(args[2])); } else { p.sendMessage("잘못된 계좌입니다."); } } else { p.sendMessage("대상이 지정되지 않음"); } } default: { p.sendMessage("잘못된 명령어"); } } } return false; } }