Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (commandname.equalsIgnoreCase("skill")) {
- if (args.length == 2) {
- String skill = args[0];
- skill = skill.toLowerCase();
- int mod = 0;
- PlayerSkillMods modifier = this.getDatabase().find(PlayerSkillMods.class).where().ieq("playerName",player.getName()).ieq("skillName", skill).findUnique();
- if (args[1] == null) {
- mod = 0;
- }
- else {
- try
- {
- mod = Integer.parseInt(args[1]);
- }
- catch (NumberFormatException e)
- {
- player.sendMessage(ChatColor.RED.toString() + "Invalid Modifier Value!");
- return true;
- }
- }
- if (modifier == null) {
- modifier = new PlayerSkillMods();
- modifier.setPlayerName(player.getName());
- modifier.setSkillName(skill);
- }
- modifier.setSkillMod(mod);
- this.getDatabase().save(modifier);
- player.sendMessage(ChatColor.BLUE.toString() + "You have set skill " + ChatColor.RED.toString() + skill + ChatColor.BLUE.toString() + " to " + ChatColor.YELLOW.toString() + mod);
- }
- }
Add Comment
Please, Sign In to add comment