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

Add multiplier and UpdateRealTimePlayedTask #727

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

Add multiplier and UpdateRealTimePlayedTask #727

wants to merge 11 commits into from

Conversation

HectorJuarezL
Copy link

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.

@Staartvin
Copy link
Owner

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?

@HectorJuarezL
Copy link
Author

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.

@HectorJuarezL
Copy link
Author

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.
Another thing that I added, is a multiplier so people can get more time. It could be used if there is something special like an anniversary or a special day. This only works if the variable "use real time" in settings file is equals to true.
The multiplier command is "/ar multiplier [value]"

@HectorJuarezL HectorJuarezL changed the title Update UpdateTimePlayedTask.java Add multiplier and UpdateRealTimePlayedTask May 21, 2020
@Staartvin
Copy link
Owner

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)?

Copy link
Owner

@Staartvin Staartvin left a 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!

@Staartvin Staartvin changed the base branch from master to development May 21, 2020 14:31
@Staartvin Staartvin changed the base branch from development to master May 21, 2020 14:32
return true;
}

if(plugin.getSettingsConfig().multiplierCommandIsEnabled()){
Copy link
Author

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);
Copy link
Author

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) {
Copy link
Author

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

Copy link
Author

@HectorJuarezL HectorJuarezL left a 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.

@HectorJuarezL
Copy link
Author

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)?

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.

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.

None yet

2 participants