Just wondering if there is a way to make it so that a player is able to claim a reward every 24 hours of in game playtime. I know that it is possible to set temporary permissions using luck perms so that after a day the player no longer has the claimed tag and is able to claim the reward again, but is there a way to make it so that the temporary permission timer only goes down while the player is actively online?
#Reclaimable Playtime rewards
1 messages · Page 1 of 1 (latest)
you can get a cooldown list of player
good choice of many cooldown
ty
/mcd add player test 2m
If i use this, the timer goes down while the player is offline. How would I make it so that the time only decreases while the player is actively on the server?
You could try like counter luckperms permissions but I’m unsure if it would also count down offline
how would i do that?
Give the players a permission that would expire in X amount of time,
yeah i alr tried that and it does down while offline
Ah okay
ye it counts offline too
nvm u mentioned it :/
idk if u figured it out but you can to negate the permission with /lp user %player_name% permission settemp <permission> false 24h
and in the menu item u ll have it as an item with priority 1 which would check for the has permission and y can make one with priority 2 that says the cooldown
I dont think that would solve the issue though unfortunately. Even with that, the timer goes down while offline, and I am trying to make it so that you would need to be on the server for 24 hours before you can claim the reward, then after you claim it, you would need another 24 hours in game to claim it again. I know how to set that all up, I just need to find a command that only counts down the timer while the player is online, and freezes it when they are offline
You could use the player playtime
Not really, that wouldnt account for the player not redeeming it instantly. If the player redeems it like an hour after it unlocking then the playtime will have increased, so technically the cooldown would only be 23 hours in that instance
I think
Let me create a quick plugin that can do this, I’ll just make it so that there’s a placeholder that returns if they are in a cool down state and make it so that you can do /alwaysonline add <player_name> <time>
you could track the player's playtime when the claim the reward and store it
then compare the current playtime to the stored playtime
%statistic_ticks_played%
%statistic_seconds_played%
%statistic_minutes_played%
%statistic_hours_played%
%statistic_days_played%
%statistic_time_played%
statistic provides some placeholders, but if you also use "Playtime" the plugin, that could work too, but requires a javascript to format the output to a number (it comes out as "5d 23h 13m 5s")
I have this javascript if needed
Yeah i have been using the statistic extension for this so far, and i feel like this would work well, but as this is my first project i dont really know how to store numbers yet. Could you give an example as to how I could do this?
I would use deluxemenus meta
[meta] set REWARD-1-PLAYTIME INTEGER %statistic_minutes_played%
minutes played should be accurate enough, no need for seconds, but doesn't really matter
if you did hours then they could theoretically skip 59 minutes
but would balance out to still be one a day
%deluxemenus_meta_REWARD-1-PLAYTIME_INTEGER_0% will return the value you have set, if none is set it will return 0
I always say this update log is the best documentation of how meta works in deluxemenus https://www.spigotmc.org/resources/deluxemenus.11734/update?update=333346
click_requirement:
requirement:
24hours:
type: '>='
input: '%math_0:_{statistic_minutes_played}-1440%'
output: '%deluxemenus_meta_REWARD-1-PLAYTIME_INTEGER_0%'
something like that should work for the click requirement
needs statistic and math expansions
If you wanted to show how many minutes till they can claim you could use this
lore:
- 'Time to claim: %math_0:_{deluxemenus_meta_REWARD-1-PLAYTIME_INTEGER_0}+1440-{statistic_minutes_played}% minutes'
I have these both already, so ill try that out in a minute. Thank you very much for the help