Guest User

Untitled

a guest
Sep 13th, 2020
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. package flameduder.dudercookie;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandExecutor;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9.  
  10. public class EconomyCommands implements CommandExecutor {
  11.  
  12. private DuderCookie plugin = DuderCookie.getInstance;
  13.  
  14. @Override
  15. public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
  16.  
  17. if (sender instanceof Player) {
  18. Player player = (Player) sender;
  19.  
  20. if (command.getName().equalsIgnoreCase("econo")) {
  21.  
  22. if(!plugin.playerBank.containsKey(player.getUniqueId())){
  23. plugin.playerBank.put(player.getUniqueId(), 0.0);
  24. }
  25. //DEPOSIT COMMAND
  26. if (args[0].equalsIgnoreCase("deposit")) {
  27. if (args.length == 3) {
  28. try {
  29. Player target = Bukkit.getPlayer(args[1]);
  30. int depositAmount = Integer.parseInt(args[2]);
  31.  
  32. plugin.economyImplementer.depositPlayer(target, depositAmount);
  33. player.sendMessage(ChatColor.GRAY + "You have deposited §a$" + depositAmount + "§7 into §a" + target.getName() + "'s §7account");
  34.  
  35. } catch (Exception e) {
  36. e.printStackTrace();
  37. }
  38. }
  39. return true;
  40. }
  41.  
  42. //BALANCE COMMAND
  43. if (args[0].equalsIgnoreCase("balance")) {
  44. if (args.length == 2) {
  45. try {
  46. Player target = Bukkit.getPlayer(args[1]);
  47. int balance = (int) plugin.economyImplementer.getBalance(target);
  48. player.sendMessage(ChatColor.GREEN + target.getName() + " §7has §a$" + balance + "§7 in their account");
  49.  
  50. } catch (Exception e) {
  51. e.printStackTrace();
  52. }
  53. }
  54. return true;
  55. }
  56. }
  57. }
  58. return true;
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment