Changing Exp Levels

Discussion in 'Plugin Development' started by TheYamsMan, Dec 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    TheYamsMan

    This is my code for a repair plugin I am making so far:
    Code:
    if(player.hasPermission("er.always.repair")){
                if(commandLabel.equalsIgnoreCase("alwaysrepair")){
                    if(args.length == 0){
                        if(config == false){
                            inhand.setDurability((short) 0);
                            config = true;
                            players.add(player.getName());
                            player.sendMessage(ChatColor.GREEN + "Always repair mode enabled. " + arexp + " experience taken.");
                            player.setExp(getxp - arexp);
                            player.sendMessage("New XP Level: " + player.getExp());
                            return true;
                        } else {
                            config = false;
                            players.remove(player.getName());
                            player.sendMessage(ChatColor.RED + "Always repair mode disabled.");
                            return true;
                        }
                    } else {
                        player.sendMessage(ChatColor.RED + "You don't need any arguments. Please send the message again with no arguments.");
                        return true;
                    }
                }
            } else {
                player.sendMessage(ChatColor.RED + "You don't have the power...");
                return true;
            }
            return false;
        }
    My issue is not that the command is not working, the entire class works fine. My issue is that the EXP levels are not changing. Am I using those wrong or what?

    EDIT: getxp is the amount of xp the player has at the time of the command. arexp is the amount of xp needed to perform the command, determined by a config.
     
  2. Offline

    DeadlyScone

  3. Offline

    TheYamsMan

    @DeadlyScone I really just can't follow that, there is not much explanation, so why do I need all the other code?
     
  4. Offline

    DeadlyScone

    Well, that method you would just call and then specify the player and the amount in experience.

    Whats not to understand? It handles everything for you.
     
Thread Status:
Not open for further replies.

Share This Page