Advertisement
Guest User

Untitled

a guest
May 28th, 2016
97
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  2. if(cmd.getName().equalsIgnoreCase("ribal")) {
  3. if (sender instanceof Player) {
  4. Player player = (Player) sender;
  5. if(player.hasPermission("risingempire.economy")) {
  6. if (args.length == 0) {
  7. sender.sendMessage(ChatColor.RED + "Helyes használat: /ribal <give|set> <összeg> <játékos>");
  8. }
  9. if (args.length == 1) {
  10. sender.sendMessage(ChatColor.RED + "Helyes használat: /ribal <give|set> <összeg> <játékos>");
  11. }
  12. if (args.length == 2) {
  13. sender.sendMessage(ChatColor.RED + "Helyes használat: /ribal <give|set> <összeg> <játékos>");
  14. }
  15. if (args.length == 3) {
  16. if (args[0] != null && args[1] != null) {
  17. Player targetplayer = player.getServer().getPlayer(args[2]); //Target player
  18. String penz = args[1]; //Balance S
  19.  
  20. try {
  21. Double value = Double.parseDouble(penz); //Balance D
  22. } catch(NumberFormatException ex) {
  23. player.sendMessage(ChatColor.RED + "A megadott összeg érvénytelen...");
  24. }
  25. Double cb = main.eco.getBalance(targetplayer); //Cureent balance
  26. if (args[0].equalsIgnoreCase("give")) {
  27. if(targetplayer.isOnline())
  28. main.eco.depositPlayer(targetplayer, value);
  29. }
  30.  
  31.  
  32. if (args[0].equalsIgnoreCase("set")) {
  33.  
  34. if(targetplayer.isOnline())
  35. main.eco.withdrawPlayer(targetplayer, cb);
  36. main.eco.depositPlayer(targetplayer, value);
  37. }
  38.  
  39. }
  40. }
  41. }
  42. }
  43. }
  44. return true;
  45. }
Advertisement
RAW Paste Data Copied
Advertisement