Guest User

Untitled

a guest
Jan 12th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 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. try
  10. {
  11. mod = Integer.parseInt(args[1]);
  12. if (args[1] == null) {
  13. mod = 0;
  14. }
  15. }
  16. catch (NumberFormatException e)
  17. {
  18. player.sendMessage(ChatColor.RED.toString() + "Invalid Modifier Value!");
  19. return true;
  20. }
  21. if (modifier == null) {
  22. modifier = new PlayerSkillMods();
  23. modifier.setPlayerName(player.getName());
  24. modifier.setSkillName(skill);
  25. }
  26. modifier.setSkillMod(mod);
  27. this.getDatabase().save(modifier);
  28.  
  29. }
  30. }
Add Comment
Please, Sign In to add comment