BenCodez / VotingPlugin

Plugin on SpigotMC
Other
83 stars 68 forks source link

OnceInADay feature to fix behaviour bug #1246

Closed LogGits closed 2 years ago

LogGits commented 2 years ago

Is your feature request related to a problem? Please describe. We give rewards out for voting on all sites but on of our vote links (topg) allows 12hr voting periods. The problem is AllSites will keep rewarding the player for every vote after all have been voted on. This means a player is able to get 2 rewards a day (if they vote on the topg after 12 hrs). We need all sites to only ever trigger once in a day.

Describe the solution you'd like I need AllSites reward to include something like "Ignore duplicates" or "trigger once a day" or some toggle inside AllSites that disables this behaviour.

Describe alternatives you've considered So many i want to die tbh. We tried WaitUntilVoteDelay but that causes desync with the website and the plugin causing loss of vote streaks players and improper reward sending.

Frustrated but loving the plugin keep up the great work 🙂 👍

Version paper 1.18.2 build 318, VotingPlugin 6.9

BenCodez commented 2 years ago

From the config.yml:

# If true, allsites will have an extra check to prevent duplicate allsites from being given
ExtraAllSitesCheck: false
LogGits commented 2 years ago

Just for context I have always had that enabled apparently. I think i had to revert back to votesite delays because it wasn't working. Anyway i remove votesite delay so we can test again. Just need to check a few issues with you.

1) Offline voting doesn't seem to trigger the AllSites rewards when the player rejoins, is that usual? It triggers cumulative and EverySiteReward, any ideas?

AllSites: 
  ActionBar:
    Message: '&6Thank you for voting. Use the Vote Key at /warp crates'
    Delay: 30
  Commands:
    - cr give to %player% Vote 1
    - cmi broadcast %player% voted on all sites...

2) Cumulative voting setup like this gives a diamond for votes 3 and 4 (resulting in 2 diamonds) instead of just vote 3 (1 diamond) (is it possible to make it only give 1 diamond on vote 3 not give them a diamond for vote 4):

Cumulative:
  # Number of votes required
  # Allows multiple cumulative rewards
  # Number be be around ' (E.g. '1')
  # Can have multiple listed here
  '3':
    Enabled: true
    # Wether or not votes must be made in same day/week
    # Useful if you want to require a certain number of voting sites to be voted on
    # for a daily/weekly reward instead of all of them
    VotesInSameDay: true
    VotesInSameWeek: false
    Rewards: 
      Items:
        Diamond:
          Material: 'DIAMOND'
          Amount: 1

3) We have files in Rewards folder and inside Directly Defined, are these all necessary if not which can i remove?

BenCodez commented 2 years ago
  1. Are you up to date? If you are try the latest dev build
  2. Try with the following options for totals?

    Wether or not votes must be made in same day/week

    Useful if you want to require a certain number of voting sites to be voted on

    for a daily/weekly reward instead of all of them

    Valid options

    AllTime

    Monthly

    Weekly

    Daily

    TotalToUse: AllTime

LogGits commented 2 years ago

I noticed an issue with cumulative that it's actually running every X time even if it's set to daily. Say there are 6 votesites and i use a cumulative reward for 3 votes, the result is 2 cumulative rewards (votes 3 and 6). Is there a way to make it only trigger once the player has reached 3 and not every 3 votes? (Using TotalToUse: Daily)

I updated to latest and removed my whole configuration and reconfigured it. Duplicate for all sites nolonger seem to happen which is good however i'm having the above issue with cumulative.

BenCodez commented 2 years ago

That's just how the cumulative works, could set it to 4. I can see about making milestones being able to use the daily total or something.

LogGits commented 2 years ago

Ah ok. Yeah it mite be better to do a daily milestone if that's the case. Something that works like "player voted x times in 1 day reward once". Or maybe a recurring attribute for cumulative that defaults to true but when set to false it provides this functionality

BenCodez commented 2 years ago

https://bencodez.com/job/VotingPlugin/

https://github.com/BenCodez/VotingPlugin/commit/51c6c4066bd6a799fdc5528d737ffa8d4f4b7944

This work? Just blacklist 6

LogGits commented 2 years ago

Interestingly enough I'm pretty sure the TotalToUse: Daily fixed the issue with randomly getting extra cumulative votes (my old config didn't have it so I'm assuming it just defaulted to AllTime)

Ideally we could handle this via a cumulative boolean called Recurring: true which defaults to true (to maintain existing functionality), however when false it would only reward once the number hits the cumulative amount for the first time in the defined TotalToUse. With regard to the idea of blacklist adds an extra unnecessary level of work to maintain the numbering (e.g. imagine 3 votes on AllTime) for the ability to just reward for hitting X votes in Y timeframe.

BenCodez commented 2 years ago

https://github.com/BenCodez/VotingPlugin/commit/f443f77dfedadd4b78e43447a751929513f38eed

Added that.

I can see the blacklist useful for some servers the do every 20 votes and every 50 and don't want the 20's to overlap (only for monthly totals, all time is kinda pointless) Might remove it later on.

LogGits commented 2 years ago

Legendary, thanks a tonne 🙂