Giter VIP home page Giter VIP logo

Comments (28)

Xujiayao avatar Xujiayao commented on June 14, 2024 3

Yes, I agree. I'm going to study how to implement these features. MCDC 2.0.0 is coming 😂

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024 2

Sure... You can either just let the user Decide while configuring the servers, by adding IsMaster=true/false. If he is the master he will also change such stuff.

Another approach ist to let each server listen and write shortly afterwards.

Example: server starts:
isStatus == ❌ Server offline? -> yes therefore he is now the Master and stores it in a variable
changes server to online, and status to:
✅ 0/6969 players online

then a sub server starts:
isStatus == ❌ Server offline? -> false, therefore not the master
hence there are no players on, he ignores the counter.

Player Joins:

get Status:
in case there was an main server issue/crash check isStatus == ❌ Server offline? -> takes over the Mein server role

in case ✅ #/6969 players online -> get the # by splitting cutting from the string "✅ " and "/6969 players online"
-> # is toInt(beforePlayerCount)
-> beforePlayerCount = newplayercount+1
-> set status to ✅ "newplayercount"/6969 players online

That is not a perfect solution, but it might work. The advantage: no additional varialbes needed.
Problem: when 2 servers edit it at the same time (unlikely, except when hopping from one to another server, but then you might be able to sort it out via a 2 sek delay) the event might occur to display the wrong player count.

But i would prefer to have a wrong player count over having none.

When Leaving a server its the same like joining, just removing one and checking if it goes into negative, it shouls just change to 0 -> correcting errors automatically when noone plays any more

if you can't understand my thoughts i am happy to draw it out for better understanding

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024 1

ohhh nice! even better than i thought!

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024 1

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

Perhaps on shutdown it would be nice to change the status to

❌ Server offline | Last updated: 22.03.2022 9:22

Of course the local timestamp might be difficult for everyone, but Relative time stamps might help:

https://hammertime.djdavid98.art/en-GB
❌ Server offline | Last updated: <t:1647937380:f>
image

note: you could also use realive time then from discord. <t:1647937380:R>
image

When using Relative time From Discord you have the Huge advatage of formatting, even thou you have less options what you can do.

✅ 7/6969 players online | 102 unique players ever joined | Server started<t:1647937380:R>.

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

This is a good suggestion, but my server is a multi server of SMP+CMP. In this case, two MCDCs cannot use channel topic at the same time. 🤔

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

This is a good suggestion, but my server is a multi server of SMP+CMP. In this case, two MCDCs cannot use channel topic at the same time. 🤔

Technically you could go make a sum of both servers to get the players, and for the uptime use both.

image
Furthermore you could just create a menu which can be accessed via a /status in discord, and let that plugin pop up.

That were the assets i used:
https://share.discohook.app/go/57kn8p8i
The Coloring depending on server state would be a great touch.

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

or just decide on one server to take the priority on status then... which would be easier

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

OK. Also I would like to ask your opinion on applying embedded message to every broadcast messages of MCDC? Because the implementation of that is much more complicated than normal messages.

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

Embedding everyting is kinda unescessary due to the webhook Styling being already quite nice.

image
of course you could go overkill on enverything, but it is totally fine.

(https://minecraft-archive.fandom.com/wiki/Achievements) - taking the pic of every achievement and putting it into an nice looking embed might look nice, but is a lot of work...

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

Technically you could go make a sum of both servers to get the players, and for the uptime use both.

Since bots cannot send private messages to each other (limit from Discord's side), I think it is difficult to communicate between servers without using an external server. 🤔

And because of that, the implementation of the entire multi server feature becomes complicated... 😢

Any suggestions or solutions you can think of to communicate between servers? 🤦‍♂️

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

Communicate and modify by reading count and status. I understand your idea, thank you!

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

Only unique players would be impossible using that approach. Then you need to define the master in the config of each server

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

For players online I can add and subtract the counter sequentially when a player join and leave the server.

For unique players, I might be able to use the count of stats files (uuid.json) in the world folder to count how many players and exclude duplicate uuids. In this case, as long as the server's onlineMode is on, the uuid can match and be excluded. 😆

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

image

Furthermore you could just create a menu which can be accessed via a /status in discord, and let that plugin pop up.

That were the assets i used: https://share.discohook.app/go/57kn8p8i The Coloring depending on server state would be a great touch.

Hello!

For this, I think it is unrealistic. Discord Bot does not seem to have a way to reply when the server (bot) is offline.

Moreover, I think the /info command of the latest version of MCDC can replace this /status command, only differing the lack of offline server status. Displaying status for offline servers will add complex code to MCDC's MultiServer feature. The existing way of distinguishing servers by bot nicknames for /info command messages will no longer work.

Btw, I added the display of max player count to the info command message in 281ff19 with reference to your demo image, as shown below.

image

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

The new MCDC MultiServer is very powerful. I believe it will be feasible and convenient to implement the function of automatically updating channel topics.

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

Server offline:

image

Server online with Multi Server disabled:

image

Server online with Multi Server enabled:

image

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

Updating the channel topic when a player joins or leaves is impossible to implement, as this would exceed the rate limit of Discord (Code 429).

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

429 responses are avoided by inspecting the rate limit headers documented above and by not making requests on exhausted buckets until after they have reset. 429 errors returned with X-RateLimit-Scope: shared are not counted against you.

Nor sure, but the rate limit of 10,000 requests per 10 minutes isn't enought? or just update it every minute 1-2 times?

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

{
"message": "You are being rate limited.",
"retry_after": 64.57,
"global": true
}

if it fails you might be able to schedule it in (retry_after) seconds...

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

It seems like the rate limit of changing the name/topic of a channel or creating/deleting a channel is different from the normal one?

In my testing, I set the interval to 5 minutes but it still returned the exceed message and failed to update randomly (sometimes success but sometimes fail). All Retry-Later are between 1 and 10 minutes, so I don't think schedule it again is a good option.

I had a look at the source code of DiscordSRV. They set the interval to at least 10 minutes.

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

"the allowed amount of requests to change the channel description is two requests in 10 minutes"

so every 5 minutes and 10 sekonds it is?

only issue is with stopping the server.... can you try changing 2 after a short time? because then you couls "save" it...

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

"the allowed amount of requests to change the channel description is two requests in 10 minutes"

Ah, that explains everything.

can you try changing 2 after a short time? because then you couls "save" it...

What does this mean?

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

After testing, I think it's best to set it to update every 10 minutes and no immediate update when players join and leave the server. Setting it to less than 10 minutes is more likely to encounter code 429 when restarting the server or using the /reload command.

Also, I found that JDA will automatically re-execute at the time of Retry-After after a failure. So encountering code 429 while the server is running is fine because JDA will automatically fix it after a while.

As for stopping the server, I added code that waits for the channel topic of "server offline" to set successfully. The server will wait until JDA has successfully set the channel topic before stopping the process. If you don't like it, stop the process immediately with Ctrl+C.

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

What does this mean?

If you just changed the channel topic and shutdown the server shortly after, check if the topic changes anyway... or if you cant do it due to rate limits.

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

After testing, I think it's best to set it to update every 10 minutes and no immediate update when players join and leave the server. Setting it to less than 10 minutes is more likely to encounter code 429 when restarting the server or using the /reload command.

Also, I found that JDA will automatically re-execute at the time of Retry-After after a failure. So encountering code 429 while the server is running is fine because JDA will automatically fix it after a while.

As for stopping the server, I added code that waits for the channel topic of "server offline" to set successfully. The server will wait until JDA has successfully set the channel topic before stopping the process. If you don't like it, stop the process immediately with Ctrl+C.

I have solved all rate limit related issues perfectly using the method mentioned in my last comment.

Are you currently using the MultiServer feature of MCDC?

from discord-mc-chat.

SaiCode-DEV avatar SaiCode-DEV commented on June 14, 2024

Are you currently using the MultiServer feature of MCDC?

nope... but i can stuff out if you want.

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 14, 2024

I will release 2.0.0-alpha.2 once this feature is complete for MultiServer use and I will not fix any enhancements for now.

from discord-mc-chat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.