EloxFire

cmdCoins

Jun 22nd, 2016
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. package fr.eloxfire.SimplifiedCoins;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandExecutor;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8.  
  9. public class cmdCoins implements CommandExecutor {
  10.  
  11. private SQLConnection sql;
  12.  
  13. public cmdCoins(SQLConnection sql) {
  14. this.sql = sql;
  15. }
  16.  
  17. @Override
  18. public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
  19.  
  20. if(sender instanceof Player){
  21.  
  22. Player p = (Player)sender;
  23.  
  24. //money --) montre argent
  25. if(args.length == 0){
  26. int balance = sql.getBalance(p);
  27. p.sendMessage("§2Vous avez : §6" + balance +" §2Paradise-Coins");
  28. }
  29.  
  30. //money add "joueur" "value"
  31.  
  32. if(args.length >=1){
  33.  
  34. //MONEY ADD
  35. if(args[0].equalsIgnoreCase("add")){
  36.  
  37. if(args.length == 1 || args.length == 2){
  38. p.sendMessage("§7Tapez §4'/money add <joueur> <montant>");
  39. }
  40.  
  41. if(args.length == 3){
  42.  
  43. Player cible = Bukkit.getPlayer(args[2]);
  44. if(cible !=null){
  45.  
  46. int montant = Integer.valueOf(args[1]);
  47. sql.addMoney(cible, montant);
  48. cible.sendMessage("§2Vous avez ajouté : "+montant+" §2Paradise-Coins de la part de "+p.getName());
  49. cible.sendMessage("§2Vous avez envoyé : "+montant+" §2Paradise-Coins à " + cible.getName());
  50. }
  51. }
  52. }
  53.  
  54. //MONEY REMOVE
  55. if(args[0].equalsIgnoreCase("remove")){
  56.  
  57. if(args.length == 1 || args.length == 2){
  58. p.sendMessage("§7Tapez §4'/money remove <joueur> <montant>");
  59. }
  60.  
  61. if(args.length == 3){
  62.  
  63. Player cible = Bukkit.getPlayer(args[2]);
  64. if(cible !=null){
  65.  
  66. int montant = Integer.valueOf(args[1]);
  67. sql.removeMoney(cible, montant);
  68. cible.sendMessage("§2Vous avez ajouté : "+montant+" §2Paradise-Coins de la part de "+p.getName());
  69. cible.sendMessage("§2Vous avez envoyé : "+montant+" §2Paradise-Coins à " + cible.getName());
  70. }
  71. }
  72. }
  73. }
  74.  
  75. //money remove "joueur" "value"
  76.  
  77.  
  78.  
  79.  
  80. }
  81. return false;
  82. }
  83.  
  84. }
Add Comment
Please, Sign In to add comment