-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add multiplier and UpdateRealTimePlayedTask #727
base: master
Are you sure you want to change the base?
Conversation
Seems like a good addition, but I'm unsure whether the TPS will stay below 20 for more than a few seconds, let alone a few minutes. Will this change anything significantly? |
The server where I used to play has TPS issues (because of the amount of people at home during contingence) and during half day it has like 10 TPS, so the time added is fewer than people's playing time. I've told admin about the problem and the solution but they don't know how to change the code so I did it by myself and shared the new compiled plugin with him but he doesn't trust in me. As you said, in a good server TPS wouldn't be below 20 for a long time, but in a server with low requirements for the players they have, it does happen. The math operation plus the current time call could be a charge for some servers than doesn't even have TPC issues, so a good idea could be adding a new updateTimePlayedTask class and set a new variable for choosing the way of adding time in the setttings file, so in the class "taskManager" there would be a condition for running the old update task or the update task I propposed. Having a condition that evaluates every time the updateTimePlayedTask is called could be a charge por the server, that's why I think create a new class is and better. |
Hi, I made some changes so server owners can choose if they want to compute the time elapsed or not between every update of updade played time task, as I said in the last comment. |
I like the configurable option (although I would recall it to 'use more accurate timings', because real timing is a bit confusing. Moreover, I don't like the idea of having two separate tasks for each timing. I would rather just have it in one single task and add time based on whether the admin wants realistic vs. static timings. Also, I don't understand the multiplier command. What does it do? Is it meant for admins to give players more time 'per check'? So instead of getting 1 min for each minute played, they get X times 1 min per 1 minute player (X being the multiplier)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments on the pull-request page. Nice work so far!
return true; | ||
} | ||
|
||
if(plugin.getSettingsConfig().multiplierCommandIsEnabled()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks if the command is enable
@@ -26,6 +26,8 @@ public UpdateTimePlayedTask(Autorank instance, UUID uuid) { | |||
public void run() { | |||
|
|||
Player player = plugin.getServer().getPlayer(uuid); | |||
long lastPlayTimeUpdate=plugin.getTaskManager().getLastPlayTimeUpdate(uuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before the value is overwritten, it is saved in this variable
|
||
int value = AutorankTools.readTimeInput(args, 1); | ||
|
||
if (value >= 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multiplier value can't be less than 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the changes requested and added the multiplier option in the settings file.
The multiplier works like you said, if it's set to "2" it will add the interval time multiplied by 2, and if the "more accurate timing" setting is true, it will add the elapsed time multiplied by 2. |
Hello, when the ticks per second decrease in a server, the time added is wrong because instead of adding 5 minutes every 5 minutes, it adds 5 minutes every 10-15 minutes. As I said, it is only if the server has lag issues that is another problem but a solution I found for the correct adding of minutes is to store the time between every run of the task UpdateTimePlayedTask and then add the difference
I think this is one of the problems with time that other people have.