Simple Discord Webhook Leave/Join Notification

Simple Discord Webhook Leave/Join Notification

397 Downloads

Uses player name on join, uses player nickname on exit

possibly-not opened this issue ยท 2 comments

commented

Hi there! This plugin works great, exactly what I needed! However, on my server we use Essentials to nickname players. When joining the server it says their actual player name, but on exit it uses their nickname.

I was wondering if a change in the config would work. It currently uses %s but I couldn't find a list of character codes for this.

commented

Sorry for the delay, for some reason I didn't get an email about this issue.

Thanks for the feedback! It's really exciting to know that someone's using the plugin!

Can you give me some more information about Essentials? Maybe a link to the specific plugin and/or documentation for how it stores nicknames, as I'm not personally familiar with it.

Come to think of it, since I don't want to take a dependency / couple this plugin to any other plugin, what do you think about this "Notification nickname" feature that's separate from Essentials?

Commands that can be run by all players:
/setnotifynickname "Zach" # sets the current player's notify nickname to "Zach"
/deletenotifynickname # removes the current player's notify nickname
/deletenotifynickname <player name> # removes the targeted user's notify nickname. only executable by ops. necessary allow a way for bad actors / "nickname squatters" to be removed, or deleting offensive nicknames.

In addition, I'll add another configuration setting to enable/disable the feature for non-ops. This would give server admins a way to prevent "untrusted" players from griefing notifications with offensive nicknames.

In the config file

plugins/
    PlayerNotificationPlugin/
        config.yml

I'd add "nicknames"

notifiers:
  -
    type: "webhook"
    url: "WEBHOOK-URL-GOES-HERE"
    leaveFormat: "%s left!"
    joinFormat: "%s joined!"
notifynickname:
  allowPlayerSelfServiceNickNames: false 
  nicknames:
    -
      playername: <player name>
      playernickname: <nickname>

Nicknames would have a required format of:

  1. <= 32 characters
  2. No "special characters" like backtick ` or $ or \ or "
commented

I was wondering if a change in the config would work. It currently uses %s but I couldn't find a list of character codes for this.

To answer this specific question, on both player join and player leave, this plugin uses the Spigot "DisplayName", so I'm unsure exactly why it uses the playername on enter, and nickname on leave.

https://github.com/zdwolfe/minecraft-player-notification-plugin/blob/master/src/main/java/io/github/zdwolfe/mc/playernotification/event/PlayerLeaveListener.java#L21

https://github.com/zdwolfe/minecraft-player-notification-plugin/blob/master/src/main/java/io/github/zdwolfe/mc/playernotification/event/PlayerJoinListener.java#L21