LuckPerms

LuckPerms

41.4k Downloads

[LP] playername is not a valid username/uuid.

MCMaricopaAZ opened this issue ยท 4 comments

commented

Hi Luck,
I have LP install and it is working great. :)

I'm coding a plugin and I'm trying to run the command "lp user playername promote playerranks" when a player clicks on a menu item. The command /ranks opens a menu and displays all the ranks that a player can buy with in-game money. If they have enough in-game cash, they can promote to the next rank.

The command works fine when I type it on the command line but when the command is called from within my method I get the error: [LP] playername is not a valid username/uuid.

@OverRide
public void onClickedInMenu(Player player, Menu menu, ClickType clickType) {
Player commander = Bukkit.getPlayer("MCMaricopaAZ"); //me
String command = "lp user "+ player.getDisplayName() +" promote playerranks " ;
Common.dispatchCommandAsPlayer(commander, command);
}

Any thoughts on this one?

B.Rgds,
Scott H

commented

Not quite sure, but what about using their UUID instead?

commented

I tried that too, but I think I got the same error. I will try again and let you know.

commented

BINGO! That worked!!

@Override
 public void onClickedInMenu(Player player, Menu menu, ClickType clickType) {
 Player commander = Bukkit.getPlayer("MCMaricopaAZ");		
 String command = "lp user "+ player.getUniqueId() +" promote playerranks " ;
 Common.dispatchCommandAsPlayer(commander, command);
	}

[13:52:58 INFO]: [ServerPlugin] Command lp user 652bf4fa-761c-3307-8fda-4c2ea1487944 promote playerranks
[13:52:58 INFO]: [LP] LOG > (MCMaricopaAZ) [U] (brookee2011)
[13:52:58 INFO]: [LP] LOG > promote playerranks

commented

Thank you!