Solved [Simple] Replace myname with player name

Discussion in 'Plugin Help/Development/Requests' started by PhillyCheezsteak, Apr 16, 2015.

Thread Status:
Not open for further replies.
  1. Hello, I am hoping this is simple.

    If a player types in "myname" in any command, it will replace it with their name/the person who executed the command.

    (without the quotes)

    If you are able to make this, I would greatly appreciate it :D

    I am using Spigot 1.8.3

    If I type
    /title myname title "Derp"

    I would have a title on my screen that says "Derp"
  2. Offline


    @PhillyCheezsteak Created, link in signature. You aren't limited to replacing myname with the senders name, but can customize it as much as you want.
  3. @nverdier Thank You!!!! This plugin can help out so many people! Thank you again!
  4. Offline


    @PhillyCheezsteak No problem! Glad it can!

    Oh, and please mark this thread as filled (Thread Tools > Edit Title > Select "Filled" from the dropdown list on the left.
  5. @nverdier I actually found out a huge bug with this plugin sadly. Pretend I attach this command to a server sign
    /broadcast myname was here.
    it will say PhillyCheezsteak was here.

    Now if Bob (example) clicks the sign it will say
    PhillyCheezsteak was here, instead of Bob was here.

    I was wondering if you can please fix this?
  6. Offline


    @PhillyCheezsteak Well if you leave 'myname' in the command on the sign, it won't work at all because what I do is only fired when a player runs the command.
  7. @nverdier
    Here is the issue though

    I have this command bounded to one of my citizens
    /tm msg myname TestTitle

    When I right click the npc, it will execute the command, but this is the new command bounded to the npc

    /tm msg PhillyCheezsteak TestTitle

    What I want is for the command to still be the original command, but it will keep filling in the name for the sender, instead of keeping the original sender.
  8. Offline


    @PhillyCheezsteak Well when the NPC runs the command (through console?), my plugin can't touch the contents of it.
  9. @nverdier It is running the command through the player. So if you right click the NPC, it runs the command as the player, with full permissions.
  10. Offline


    @PhillyCheezsteak You could remove the replacement in the config, add the command to the NPC, and then add it back.
  11. @nverdier
    That idea would not work for me sadly. Would there be a way for myname to work without keeping the original sender? I just basically want it to work like a fill-in for the current sender.

    I also have to go to work, so if I do not respond right away, I am sorry xD
  12. Offline


    @PhillyCheezsteak All you have to do is add it to the NPC with 'myname' in the actual command, so it doesn't replace it with the original sender, and then for each person who clicks on the NPC after that, it uses their name, right?
    1) Remove the entry from the list in the config.
    2) Add the command to the NPC.
    3) Add the entry back to the config.
  13. @nverdier EDIT: I found out that you were right. When I was adding the command, the command, it actually was replacing myname with PhillyCheezsteak. So I used the config to add the command there and it worked. Sorry for the trouble xD I am not sure why this did not click for me earlier lol
    Last edited: Apr 16, 2015
Thread Status:
Not open for further replies.

Share This Page