Cleaned up code a little bit based on the IDE's suggestions
*I set the API version to 1.20 in the plugin.yml. Let me know if this breaks compatibility with older versions, because I am not sure whether this is a hard minimum or not.
Fixed small bug with tab autocompleter that didn't allow second arguments to be autocompleted (e.g. a player's name with /elo check)
Tweaked some of the code to prepare for API access
Only planning to allow reading and modification of player stats, so you could, for instance, make a plugin that does something when a player hits a certain rank, or gets their elo higher than a target, etc.
Fixed small performance bug
Entire list of players is no longer saved to config and then reloaded whenever a brand new player joins
Likely had very little performance impact, but fixed anyway
Elo is now referred to as "rating" in most places.
Score is "rating;" unit is "elo"
Maximum and minimum rating are no longer configurable.
Rating is now uncapped*, and the minimum is 1.
Base and maximum adjustments are configurable.
Default: 75 base, 500 maximum
Adjustments are still equal for both killer and victim.
Minimum adjustment is 0, which occurs when the ratio between killer and victim exceeds the base adjustment's value
Example: If base adjustment is 75, then a player with a 3750 rating will earn no adjustment for killing a player with a rating below 50, because 3750:50 = 75:1.
If a victim has 1 elo, then the adjustment for both players is 0 in any case.
Adjustment is hard-capped to 50% of the victim's rating.
There were issues where two low-rated players with a large ratio fought, causing an adjustment substantially larger than either player's rating.
Permissions slightly tweaked, so /elo is available without explicit permission.
Open to suggestions if it should not be available by default.
Commands are slightly tweaked.
Shorter arguments - check documentation
New arguments for base and maximum adjustments
Using /eloadmin initial, base, or max without another argument informs you of the current respective value.
Death/kill messages shortened for ease of reading.
Config now includes notes for what each value represents.
TagAPI needs ProtocolLib to work. Currently, ProtocolLib support for 1.19.x is not finalized, so there may be bugs.
If TagAPI is not detected, nametag functionality is disabled.
TagAPI only supports up to 1.19. Do not use it if you are on 1.19.1 or higher.
Added /eloa nametags
Toggles nametags; immediately updates
Still works if TagAPI is not present, though doesn't do anything except update the config
Removed /eloa version
I missed Spigot supporting /version PvPElo
Cleaned up code
Fewer redundant variable declarations; should free up some memory
Noticed a couple of logic errors that caused bigger errors
Adjusted formula
Now has minimum and maximum caps for adjustment amount
Minimum is 1, max is 10% of max elo
Resolved issue with absurdly high elo adjustment if the rating difference was too high
Minimum elo is now hard-coded to 1
This prevents divide-by-zero issues with the formula introduced in the last update
Plans:
Tab autocomplete for commands
Likely remove maximum elo
The trouble with current environment is that when a max-capped player kills another player, elo is lost from the pool (sum of all players' elo). The only way to generate elo would be to kill min-capped players, as they would lose nothing and the killer would gain 1 elo.
Potential changes:
Minimum elo 1, maximum at integer limit (over 2 billion)
No longer configurable
Minimum adjustment 0, which occurs when the rating differential is too high
Re-work formula based on integer limit to modify "base payout"