Console Commands

Discussion in 'Plugin Development' started by HariHD, Feb 15, 2014.

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

    HariHD

    Hey, I was trying to make a command that can be executed by the console and a player but when I tried executing it on the console it came up with errors.

    Error Pastebin: http://pastebin.com/eQWJX2WA

    This is the code:
    Code:java
    1. if(args[0].equals("grant")) {
    2. String name = args[2];
    3. int curbal = getCustomConfig().getInt(name + ".tokens");
    4. int add = Integer.parseInt(args[1]);
    5. int finbal = curbal + add;
    6. this.getCustomConfig().createSection(name).set("tokens", finbal);
    7. this.saveCustomConfig();
    8. if(sender instanceof Player) {
    9. p.sendMessage("Succesfully granted " + name + " " + add + " Tokens!");
    10. }
    11. else {
    12. getLogger().info("Succesfully granted " + name + " " + add + " Tokens!");
    13. }
    14. }

    Thanks for your time,
    Hari
     
  2. Offline

    Necrodoom

    Locked. Unofficial builds are not supported here.
    Arcoz this applies to you too.
     
Thread Status:
Not open for further replies.

Share This Page