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

Feature/auto whitelist #16

Merged
merged 105 commits into from
Apr 17, 2023
Merged

Feature/auto whitelist #16

merged 105 commits into from
Apr 17, 2023

Conversation

voidpointer0x00
Copy link
Owner

@voidpointer0x00 voidpointer0x00 commented Mar 26, 2023

This PR will introduce automatic whitelisting when a player joins the game. The feature is better explained through the configuration.

# When both whitelist and auto-whitelist are enabled, the plugin will automatically
# add a joining player of selected group to the whitelist for the specified duration.
#
# A single player can only get automatically whitelisted "max-repeats" times.
# So if it's set to 2, after the first period they will be able to get extra time.
# * It won't work the second time IF they do not meet current strategy requirements.
#
# Strategies select a group of players who will be automatically whitelisted
# upon joining the server.
auto-whitelist:
enabled: true
# Any value in range (-∞;0] will be treated as permanent whitelisting,
# WHICH SHOULD NOT BE USED (because then what's the point in using a whitelist?)
#
# Any value that can not be parsed will result in disabling the automatic
# whitelisting feature until the configuration is fixed and reloaded.
duration: 7d
# A value of zero will disable the auto whitelisting.
# Any negative number will disable this property and players will be able to
# infinitely join the server and get whitelisted every time.
max-repeats: 1
# all — simply every joining player if the number that they've been "freely" whitelisted
# have yet to exceed the limiting "max-repeats" property.
#
# newcomers — only those players who have never player on this server before.
# This strategy makes use of Bukkit's #hasPlayerBefore() method that checks
# whether the server has any data on the given player. This will always
# be true if you disable the property «players.disable-saving» in spigot.yml
strategy: all

Aside from that, I decided that serial storage will no longer be supported by the plugin :) It was introduced in early days of development just as a very quick and simple way to setup the storage for testing purposes and was later replaced with much more useful JSON storage.

  • /auto-whitelist on/off
  • /auto-whitelist is-on
  • /auto-whitelist reset (player)
  • /auto-whitelist set (player) (int)
  • /auto-whitelist info (player)
  • /auto-whitelist get-limit
  • /auto-whitelist set-limit
  • /auto-whitelist get-strategy
  • /auto-whitelist set-strategy
  • /auto-whitelist get-duration
  • /auto-whitelist set-duration
  • Update import/export features

@github-advanced-security
Copy link

You have successfully added a new CodeQL configuration .github/workflows/codeql-analysis.yml:analyze/language:java. As part of the setup process, we have scanned this repository and found no existing alerts. In the future, you will see all code scanning alerts on the repository Security tab.

@voidpointer0x00 voidpointer0x00 added the type: feature request New feature or request label Mar 26, 2023
Automatic addition must be executed before the "disallow" listener, so it
needs to be at a lower priority. Leaving LOWEST, NORMAL and HIGHEST
priorities allows other listeners to make changes to the system.
Backwards-compatibility: use older method for parsing JsonReader
`whitelist` table's schema was changed, the plugin will run automatic
migration if old db structure is detected. This means that plugin
will still work just fine, BUT anyone who used the old db schema in
their projects will have to change it to keep compatibility.
Fix: update `timesAutoWhitelisted` field after auto-whitelist
@voidpointer0x00 voidpointer0x00 self-assigned this Apr 3, 2023
@voidpointer0x00
Copy link
Owner Author

In commit d7d0f93 permissions for /whitelist on|off were changed from voidwhitelist.whitelist.enable and voidwhitelist.whitelist.disable to voidwhitelist.whitelist.on and voidwhitelist.whitelist.off.

This commit renames configuration property `max-repeats` to `limit`, updates
documentation and adds a respective config migration.
Implement `set` and `info` commands

Implement `set` and `info` commands
Refactoring: create public StrategyPredicate enum instead of factory
FileNotFoundException by experience usually indicates that Mojang has no data
on the given player, meaning there is no such registered nickname.
Copy link
Owner Author

@voidpointer0x00 voidpointer0x00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ready, tested all the new features — works just fine. Just gotta change version and it's ready to release :)

@voidpointer0x00 voidpointer0x00 merged commit 4977a15 into dev-j8 Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant