Cant get the player name?!

Discussion in 'Plugin Development' started by bkleinman1, Sep 12, 2013.

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

    bkleinman1

    I'm trying to get a player name out of the onCommand and into a new class, i have tried loads of different things, none seem to be working. i'm out of things to try.

    please do not reply saying "You should really learn java before coding plugins." because i already know basic to intermediate level of java.
     
  2. bkleinman1 Provide us some code please so we can tell you what exactly to do.
     
    PimpDuck likes this.
  3. Offline

    PimpDuck

    What he said ^ We need to see what we're working with to help you.
     
  4. Offline

    bkleinman1

    PimpDuck
    well. i have a onCommand, and inside it does
    Code:java
    1. Player player = (Player) sender;
    to get the player that did the command. then in another class, i have this
    Code:java
    1. File destFolder = new File("C:\\Users\\barney\\Desktop\\New folder\\server" + //this is were i need the players name to be);
     
  5. Offline

    viper_monster

    bkleinman1, for example, if you want the command to be like this: /test <player>;
    you would use:
    Code:java
    1. Player t = Bukkit.getPlayer(args[0]);
     
  6. Offline

    PimpDuck

    bkleinman1 So you want the players name to store to a file?
     
  7. Offline

    bkleinman1

    @PimpDuck no i just need to access it in another class, but i cant seem to get it out of the onCommand for some reason.
     
  8. bkleinman1 Just create a public method in that other class that takes a string as arg and that string would be the name then. Just access that method from within the onCommand method and your done. If you don't understand this then sorry but then you will have to learn more java...
     
    PimpDuck likes this.
  9. Offline

    bkleinman1

    I understood, thanks for the help, i found it was working i just had an error in my onCommand that i didnt see :p
     
Thread Status:
Not open for further replies.

Share This Page