Guest User

Untitled

a guest
Jan 12th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. if (commandname.equalsIgnoreCase("skill")) {
  2.  
  3. if (args.length == 2) {
  4.  
  5. String skill = args[0];
  6. skill = skill.toLowerCase();
  7. int mod = 0;
  8. PlayerSkillMods modifier = this.getDatabase().find(PlayerSkillMods.class).where().ieq("playerName",player.getName()).ieq("skillName", skill).findUnique();
  9.  
  10.  
  11.  
  12. if (args[1] == null) {
  13. mod = 0;
  14. }
  15.  
  16. else {
  17.  
  18. try
  19. {
  20. mod = Integer.parseInt(args[1]);
  21. }
  22. catch (NumberFormatException e)
  23. {
  24. player.sendMessage(ChatColor.RED.toString() + "Invalid Modifier Value!");
  25. return true;
  26. }
  27. }
  28.  
  29. if (modifier == null) {
  30. modifier = new PlayerSkillMods();
  31. modifier.setPlayerName(player.getName());
  32. modifier.setSkillName(skill);
  33. }
  34. modifier.setSkillMod(mod);
  35. this.getDatabase().save(modifier);
  36.  
  37.  
  38. player.sendMessage(ChatColor.BLUE.toString() + "You have set skill " + ChatColor.RED.toString() + skill + ChatColor.BLUE.toString() + " to " + ChatColor.YELLOW.toString() + mod);
  39.  
  40. }
  41. }
Add Comment
Please, Sign In to add comment