Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add PurePerms player's group as placeholder? #6

Open
dvodany opened this issue Mar 17, 2021 · 0 comments
Open

How to add PurePerms player's group as placeholder? #6

dvodany opened this issue Mar 17, 2021 · 0 comments

Comments

@dvodany
Copy link

dvodany commented Mar 17, 2021

Hi,
For many hours I tried to find a solution to make my PurePerms rank appear in the chat, but I can't. I don't know what to do with it and that's why I'm contacting you because I'm just a beginner in php. I hope you understood my question, if you need to specify anything, ask me. If I ask on the wrong page, I apologize in advance.

Code:

(use CortexPE \ HRKChat \ event \ PlaceholderResolveEvent; is more in the other code which if you want I can send too. I wrote the whole code in the GroupJoin plugin, I hope it doesn't matter)
/**
* @param PlaceholderResolveEvent $ev
*
* @priority LOWEST
*/

 public function onPlaceholderResolve(PlaceholderResolveEvent $ev, Player $player): void {
  	
  	if($ev->getPlaceholderName() === "PureChat.players.Rank") {

  			$ev->setValue((string)$ev->getUserDataMgr()->getGroup($player)->getName());
  	}
  }     

HRKChat config.yml:

chatFormat:

1: " &3[&6{{myPlugin.player.latency}}&3]§r §7[Member]§r &7{{hrk.displayName}} {{PurePerms.players.Rank}} &8> &7{{msg}}"
2: " &3[&6{{myPlugin.player.latency}}&3]§r §l§6[§l§4Admin§l§6]§r &7{{hrk.displayName}} {{PurePerms.players.Rank}} &8>
&7{{msg}}"
3: " &3[&6{{myPlugin.player.latency}}&3]§r {{PurePerms.players.Rank}} &7{{hrk.displayName}} test &8> &7{{msg}}"

And this was shown in the console:

[Server] dvodany has joined to server!
[21:06:08] [Server thread/INFO]: The admin dvodany joined the server.
[21:06:10] [Server thread/ERROR]: [HRKChat] Unresolved placeholder 'PurePerms.players.Rank'
[21:06:10] [Server thread/INFO]: [21] [Admin] dvodany NULL > Test

From left to right:
Ping
Rank
Name
PurePerms rank
Message

I am sorry for my bad English.

@dvodany dvodany changed the title How to add PurePerms placeholder? How to add PurePerms as placeholder? Mar 17, 2021
@dvodany dvodany changed the title How to add PurePerms as placeholder? How to add PurePerms players group as placeholder? Mar 17, 2021
@dvodany dvodany changed the title How to add PurePerms players group as placeholder? How to add PurePerms player's group as placeholder? Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant