use Console as CommandSender instead of Player

Discussion in 'Plugin Development' started by MinesnHD, Apr 18, 2014.

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

    MinesnHD

    I wrote a GunGame plugin where you can earn Tokens. And you should earn Tokens when you voted. And i use a CommandListener and the Listener is executing the Command that a Player gets TOkens in my Plugin :

    Code:java
    1.  
    2. if(cmd.getName().equalsIgnoreCase("vote")) {
    3. if(args.length == 1) {
    4. Player p2 = getServer().getPlayer(args[0]);
    5. int Tokens = getConfig().getInt("Spieler." + p.getName() + ".Tokens");
    6. Tokens++;
    7. Tokens++;
    8. Tokens++;
    9. Tokens++;
    10. Tokens++;
    11. getConfig().set("Spieler." + p.getName() + ".Tokens", Tokens);
    12.  
    13. }
    14. }
     
  2. Offline

    Innofly

    MinesnHD What is the problem?

    You should edit something instead of doing that:
    Code:java
    1. Tokens++;
    2. Tokens++;
    3. Tokens++;
    4. Tokens++;
    5. Tokens++;


    Do:
    Code:java
    1. Tokens+=5;


    You should probably update your plugin to uuid, it will live alot longer :)
     
  3. Offline

    MinesnHD

    How can i make thiess command executable from the console
     
  4. Offline

    Innofly

    MinesnHD When you run the command from the console do you have any errors?
     
Thread Status:
Not open for further replies.

Share This Page