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

Added ability to append The number of players online to server username #55

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TheZackCodec
Copy link

@TheZackCodec TheZackCodec commented May 24, 2020

Tested on 2 x 24/7 servers

  • 1.15.2 Vanilla
  • FTB-Beyond 1.11.0

Does not conflict with pull request #54

Details

  • Added ability to append the number of users currently in the server to the server username.
    image

  • Online player count is still tracked and show correctly on other server notifications when SHOW_PLAYER_CONN_STAT is set to false as long as PLAYERCOUNT_IN_SERVERNAME is enabled. This is used for the circumstances where player count is desired to be part of the server username but join and leave notifications are not.

  • Added escape-string-regexp library to help sanitize variables. Used in the function that selects correct Avatar URL. This also improves the original way of detecting whether the username was the server name because as long as the username has "ServerName - Server" somewhere in it, it picks the server Avatar URL. Allowing future items to be appended on the server username without affecting detection.

@destruc7i0n
Copy link
Owner

How about using the server queries for the player count? There are libs for it available, and even a web based API: https://mcapi.us

@TheZackCodec
Copy link
Author

TheZackCodec commented May 25, 2020

@destruc7i0n
Fine you got me, I was a little lazy here. I wanted something more internal. A bunch of the APIs do not like more than one query ever minute and most cache for 5-10 minutes and I didn't want stale data. but let me look more into the server queries and i'll making a data-structure to grab that.

At least check out my regex improvements in #54 while I actually implement something more production ready. I have a few other features i want to implement and honestly getting server queries working would make our lives easier

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

Successfully merging this pull request may close these issues.

2 participants