Nick Players does not work :(

Discussion in 'Plugin Development' started by HexaCoreDesigns, Mar 16, 2015.

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

    HexaCoreDesigns

    Hello there, this is my first thread + I´m from germany so my english isnt the best.
    So i am trieng to create a nick plugin which gives a player a nother nick.
    here is my current code:
    Code:
            Player p = (Player) sender;
            if(cmd.getName().equalsIgnoreCase("nick")){
               
                    if (args.length == 1) {
                        String name = args[1];
                        p.setDisplayName(name);
                       
                        }
    
                return true;
            }
    and is does not work :(
    Please help.
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    HexaCoreDesigns

    @timtower first, thank you for your fast reply :) in which one should i put args[0] ?
    it would be nice if you could write the code snippet ;)
    because when i write that one whit that [0] in the string it just does not work in minecraft :(
     
  4. Offline

    timtower Administrator Administrator Moderator

  5. Offline

    HexaCoreDesigns

    in which one? Sry i coded in C# before that. I am new in Java. It would be very kind of you, if you could write the code snippet. thank you :)
     
  6. Offline

    timtower Administrator Administrator Moderator

  7. @HexaCoreDesigns
    see man, you have "String name = args[1];"
    The Array args[] starts at 0, so if the cmd is /cmd arg arg2, the args[1] is on really "arg2", so u need to use args[0] instead of args[1] or check if the args.length is more than 2.

    Edit by Timtower: removed thread hijack
     
  8. Offline

    HexaCoreDesigns

    THANK YOU <3 but how can i change the name in the online players list and the skin? isnt that possible :)
    sry if i am annoying.,..
     
  9. Offline

    timtower Administrator Administrator Moderator

Thread Status:
Not open for further replies.

Share This Page