NathanCollaert / RewardsLite

A lightweight, advanced and very customizable plugin that gives rewards to players at specific playtimes.
MIT License
15 stars 12 forks source link

Upon creating new reward while the server has been running for weeks previous playtime not count #13

Closed Rikk010 closed 4 years ago

Rikk010 commented 4 years ago

The playtime that was counted by the plugin itself(/playtime returns 1 day) but in the /reward menu i need to still need to get 2 days(which should be 1 day since i already played for a day) config: `#Should the plugin check for updates? UpdateChecker: true

Allow the plugin to collect anonymous data from your server for a better understanding who and how people are using this plugin.

There is really no reason to opt-out, but here it is!

bStats: true

After how much playtime should the player data be autosaved?

In minutes, minimum is 1.

AutoSave: 5

How long should the plugin save the playerdata in cache after logout?

This will save performance for RAM.

In minutes, minimum is 0.

TimeKeepDataInCache: 5

Should the plugin also count playtime from before it was installed?

It will not give rewards for this playtime.

CountAllPlaytime: false

Should claiming rewards be disabled in any worlds?

Rewards that require claiming will be put into pending state until in allowed world.

DisableGettingRewardsInWorlds:

- world

#- world_nether
#- world_the_end

(*) are required fields for a reward.

Rewards:

Reward names should be unique.

chatperm:
    #This name will be displayed for the reward in the rewards GUI.
    #This name does not need be unique.
    #Color codes may be used https://wiki.ess3.net/mc/.
    #Default = reward name
    DisplayName: "&6ChatPermissie"

    #This item will be displayed for the reward in the rewards GUI.
    #All possible materials that have an inventory item in game can be used for this (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html ).
    #Default = chest
    DisplayItem: "anvil"

    #The item in the reward GUI will have this description.
    #Color codes may be used https://wiki.ess3.net/mc/.
    #Each list item will be a new line.
    #Default = empty (no description)
    DisplayDescription:
        - "Na 20 minuten onvang je permissie tot de chat"
        - "Dit doen we om spammers te voorkomen"

    #(*)
    #How long should a player have to play on the server to be eligible for this reward?
    #In minutes, minimum is 1.
    #It is possible to give multiple times: 60,80,100. This will give the reward after 60 minutes, then after 80, then after 100 and never again afterwards (if not looping).
    PlaytimeNeeded: 20

    #Should afk playtime be counted towards this reward?
    #REQUIRES ESSENTIALSX TO BE INSTALLED ON YOUR SERVER!
    #Default = true
    CountAfkTime: false

    #How many open inventory spaces would the player need to claim this reward?
    #Default = 0
    SlotsNeeded: 0

    #Should the player be able te receive this reward every time he/she reaches the PlaytimeNeeded or just once?
    #False will only give it once.
    #Default = false
    Loop: false

    #Should the playtime in certain worlds not be counted towards the playtime for this reward?
    #Default = no disabled worlds
    DisabledWorlds:
        - "world_nether"
        - "world_the_end"

    #Should this reward only be given to players with the permission 'liteplaytimerewards.reward.<rewardname>' (permission has to be all lower case)?
    #Setting this to false will give the reward to everyone.
    #Default = false
    UsePermission: false

    #How should the notification and broadcast be displayed?
    #bossbar/actionbar/chat
    #Default = chat
    NotificationType: "bossbar"

    #What message should be send to the player upon receiving this reward?
    #Color codes may be used https://wiki.ess3.net/mc/ as well as \n for a new line.
    #Default = no notification
    #Placholders: %player%
    Notification: "&b&lDuncan's Creative &f&7>Je hebt nu toegang tot de chat!"

    #What message should be broadcasted upon player receiving this reward?
    #Color codes may be used https://wiki.ess3.net/mc/ as well as \n for a new line.
    #Default = no broadcast notification
    #Placholders: %player%
    BroadcastNotification: ""

    #(*)
    #What commands should be executed upon receiving this reward?
    #Placholders: %player%
    Commands:
        - "lp user %player% parent set chatdefault"
#Reward names should be unique.
playerhead:
    #This name will be displayed for the reward in the rewards GUI.
    #This name does not need be unique.
    #Color codes may be used https://wiki.ess3.net/mc/.
    #Default = reward name
    DisplayName: "&6Playerhead"

    #This item will be displayed for the reward in the rewards GUI.
    #All possible materials that have an inventory item in game can be used for this (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html ).
    #Default = chest
    DisplayItem: "anvil"

    #The item in the reward GUI will have this description.
    #Color codes may be used https://wiki.ess3.net/mc/.
    #Each list item will be a new line.
    #Default = empty (no description)
    DisplayDescription:
        - "Na 5 uur krijg je je eigen hoofd in de game!"
        - "Ook na 6 en 7 uur nog een keer"

    #(*)
    #How long should a player have to play on the server to be eligible for this reward?
    #In minutes, minimum is 1.
    #It is possible to give multiple times: 60,80,100. This will give the reward after 60 minutes, then after 80, then after 100 and never again afterwards (if not looping).
    PlaytimeNeeded: 300,360,420

    #Should afk playtime be counted towards this reward?
    #REQUIRES ESSENTIALSX TO BE INSTALLED ON YOUR SERVER!
    #Default = true
    CountAfkTime: false

    #How many open inventory spaces would the player need to claim this reward?
    #Default = 0
    SlotsNeeded: 1

    #Should the player be able te receive this reward every time he/she reaches the PlaytimeNeeded or just once?
    #False will only give it once.
    #Default = false
    Loop: false

    #Should the playtime in certain worlds not be counted towards the playtime for this reward?
    #Default = no disabled worlds
    DisabledWorlds:
        - "world_nether"
        - "world_the_end"

    #Should this reward only be given to players with the permission 'liteplaytimerewards.reward.<rewardname>' (permission has to be all lower case)?
    #Setting this to false will give the reward to everyone.
    #Default = false
    UsePermission: false

    #How should the notification and broadcast be displayed?
    #bossbar/actionbar/chat
    #Default = chat
    NotificationType: "bossbar"

    #What message should be send to the player upon receiving this reward?
    #Color codes may be used https://wiki.ess3.net/mc/ as well as \n for a new line.
    #Default = no notification
    #Placholders: %player%
    Notification: "&b&lDuncan's Creative &f&7>Je hebt nu je eigen head!"

    #What message should be broadcasted upon player receiving this reward?
    #Color codes may be used https://wiki.ess3.net/mc/ as well as \n for a new line.
    #Default = no broadcast notification
    #Placholders: %player%
    BroadcastNotification: ""

    #(*)
    #What commands should be executed upon receiving this reward?
    #Placholders: %player%
    Commands:
        - "minecraft:give %player% player_head{SkullOwner:\"%player%\"}"
claimblocks:
    #This name will be displayed for the reward in the rewards GUI.
    #This name does not need be unique.
    #Color codes may be used https://wiki.ess3.net/mc/.
    #Default = reward name
    DisplayName: "&6ClaimBlocks"

    #This item will be displayed for the reward in the rewards GUI.
    #All possible materials that have an inventory item in game can be used for this (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html ).
    #Default = chest
    DisplayItem: "gold_block"

    #The item in the reward GUI will have this description.
    #Color codes may be used https://wiki.ess3.net/mc/.
    #Each list item will be a new line.
    #Default = empty (no description)
    DisplayDescription:
        - "Elke 50 uur ontvang je 10k claimblokken"
        - "Met een max van 40k blokken oftewel 200 uur"

    #(*)
    #How long should a player have to play on the server to be eligible for this reward?
    #In minutes, minimum is 1.
    #It is possible to give multiple times: 60,80,100. This will give the reward after 60 minutes, then after 80, then after 100 and never again afterwards (if not looping).
    PlaytimeNeeded: 3000,6000,9000,12000

    #Should afk playtime be counted towards this reward?
    #REQUIRES ESSENTIALSX TO BE INSTALLED ON YOUR SERVER!
    #Default = true
    CountAfkTime: false

    #How many open inventory spaces would the player need to claim this reward?
    #Default = 0
    SlotsNeeded: 1

    #Should the player be able te receive this reward every time he/she reaches the PlaytimeNeeded or just once?
    #False will only give it once.
    #Default = false
    Loop: false

    #Should the playtime in certain worlds not be counted towards the playtime for this reward?
    #Default = no disabled worlds
    DisabledWorlds:
        - "world_nether"
        - "world_the_end"

    #Should this reward only be given to players with the permission 'liteplaytimerewards.reward.<rewardname>' (permission has to be all lower case)?
    #Setting this to false will give the reward to everyone.
    #Default = false
    UsePermission: false

    #How should the notification and broadcast be displayed?
    #bossbar/actionbar/chat
    #Default = chat
    NotificationType: "bossbar"

    #What message should be send to the player upon receiving this reward?
    #Color codes may be used https://wiki.ess3.net/mc/ as well as \n for a new line.
    #Default = no notification
    #Placholders: %player%
    Notification: "&b&lDuncan's Creative &f&7>Je hebt 10k meer claimblokken!"

    #What message should be broadcasted upon player receiving this reward?
    #Color codes may be used https://wiki.ess3.net/mc/ as well as \n for a new line.
    #Default = no broadcast notification
    #Placholders: %player%
    BroadcastNotification: ""

    #(*)
    #What commands should be executed upon receiving this reward?
    #Placholders: %player%
    Commands:
        - "adjustbonusclaimblocks %player% 10"`
NathanCollaert commented 4 years ago

I think I see what happened. Can I assume that you installed the plugin, started your server, joined your server, stopped your server and then set the CountAllPlaytime to false? If this is correct then your playerdata file has saved the playtime from before the plugin was installed on the first time you joined (cause the setting is true by default) and thus telling you that you've already played for a day when doing /playtime. After that you've set the CountAllPlaytime to false and the reward menu will say you still need 2 hours of playtime because you have actually not played yet after the plugin was installed.

This is not a bug but rather a bad implementation on my part. I'll fix this in the next update. For now you can fix your /playtime by simply stopping your server, opening your userdata file and setting the playtime to 0 and starting your server again.

Rikk010 commented 4 years ago

I think I see what happened. Can I assume that you installed the plugin, started your server, joined your server, stopped your server and then set the CountAllPlaytime to false? If this is correct then your playerdata file has saved the playtime from before the plugin was installed on the first time you joined (cause the setting is true by default) and thus telling you that you've already played for a day when doing /playtime. After that you've set the CountAllPlaytime to false and the reward menu will say you still need 2 hours of playtime because you have actually not played yet after the plugin was installed.

This is not a bug but rather a bad implementation on my part. I'll fix this in the next update. For now you can fix your /playtime by simply stopping your server, opening your userdata file and setting the playtime to 0 and starting your server again.

That is not what i rtried to do let me explain it better

I installed the plugin 2 months ago and added a reward for 20 minutes playtime, works fine. At this time i have 1 day playtime according to /playtime

And i wanted to add a reward for 2 days of playing time for the active players. What i did was:

I just want it to count the playtime for the new reward

NathanCollaert commented 4 years ago

That changes everything, that's intentional. The playtime counted towards that reward will only start from whenever the reward was configured. Any playtime from before it was configured will not be counted towards that reward.

Rikk010 commented 4 years ago

No way to make an option for that? using a command /lpr bulkupdateplaytime [reward]

NathanCollaert commented 4 years ago

I could possibly add an option to each reward to add the current playtime of players from before the reward was configured to the playtime counted towards that reward.