Commit Graph

53 Commits

Author SHA1 Message Date
tastybento aaa1504dc6 WIP multipaper 2024-04-07 17:05:21 -07:00
BONNe 6bf12d5e20
Fixes EXP reset for players onJoin and onLeave (#2286)
The total experience does not reset player collected exp. This fixes that, as it will set level to 0 and progress in towards next level to 0
2024-01-30 19:32:13 -08:00
tastybento a4bef159be
2 0 0 multi island (#2185)
* Multi world WIP - stashing

* Initial work on supporting multiple islands per player

The default allowed number is 5 for now, but will be set to 1 by
default.

Lots more work to do on this!

* More work on multi island. Fixed tests so clean compile.

* Remove unused imports

* Updated island go and homes command to multi island

Updated tests.

* Do not reload addons anymore.

* Add island name when entering or leaving own island

* Remove unused import

* Adds island names to /island go command.

* Enables more homes to be set if player has more than one island

* Switch to using a set for islands and explicit primary boolean in Island

* WIP

* Fix bugs with the go command.

* Be able to delete multiple islands, e.g. when joining a team

This is not fully tested.

* Do not remove all islands when a player does reset.

Players can reset just the island they are on.

* More fixes for go command

* Fix tests

* Fix @NonNull annotation

* Fix home syntax listing reference for IslandDeleteHome

* Fixed deletehome for multiple islands.

* Fix /island command teleport to current island default home.

* Remove deprecated code.

* Fix tag for concurrent island setting in config.yml

* Improve error when trying to make additional islands over limit

* Update config.yml

* Correctly assign invites for islands.

* Switch to canExecute API in prep for multi-island handling

* Prevent players from obtaining more concurrent islands by owner transfer

* Handle leaving and disbanding of teams

* Fix tests

* Fix minor bugs or code smells.

* Restore the quarantine code from deprecation.

This code can stay. It checks if islands can load, and if not puts them
in a trash. It does no harm.

* Remove unneeded eq()'s

* Fix tests
2023-09-16 15:55:52 -07:00
tastybento 62a3a8d6fa Fixed NPE when getting UUID for unknown name.
Added test methods for PlayersManager
2023-07-22 12:00:10 -07:00
tastybento 2c283ae3a9
Javadoc and other cleanup from code analysis (#2099) 2023-02-26 17:48:37 -08:00
tastybento a604d5cf82
Add [owner] in command placeholders #2080 (#2081) 2023-01-31 07:13:01 -08:00
tastybento 4e8ca6d22c Fix for kicking offline players
https://github.com/BentoBoxWorld/BentoBox/issues/1950
2022-03-18 13:59:41 +00:00
Huynh Tien dffe8a811e
fix an exception when cleaning an offline player (#1898) 2022-01-01 17:39:25 -08:00
tastybento 7616f6aa2a Address potential NPE's 2021-11-12 13:19:19 -08:00
tastybento d780bbd4c0
1.18.0 (#1860)
* Mark all home-related methods in PlayersManager as deprecated.

* Fix bug where maxHomes was shown as null

* Version 1.18.0

API changes may break compatibility with Addons.

* Remove usage of deprecated methods except for migration code.

* Prevent NPE. Check isPlayer instead of getWorld() == null

* Fix nullability issue and added to @Deprecated annotations

* Added deprecation notices to home methods in Players
2021-09-26 13:35:18 -07:00
tastybento 9dc4ebc2d1
Make variables final if they can be. (#1843)
* Make variables final if they can be.

* Do not use final so that test can pass.

For testing, we use a trick to set this variable, but it won't work if
it is final. Right now, I'd like to keep the test.
2021-08-29 18:17:21 -07:00
tastybento 2c7f54fe10 Use orElseGet instead of orElse
orElse is a trap because it evaluates even if the Optional is empty.
orElseGet is the correct way.
2021-01-08 20:05:23 -08:00
tastybento d774124d89 Fixed/removed tests
These are no longer relevant as this function is now in the
PlayersManager and tested there.
2020-12-24 21:56:02 -08:00
tastybento c7d7871f94 Player clean up
Moved per removal to PlayersManager

Added cleanup to IslandResetCommand

Added test class for clean up method.
2020-12-24 15:30:52 -08:00
tastybento 372f149f3d Remove code duplication between kick and leave command 2020-12-24 14:24:42 -08:00
Gabriele C b74eeb95d8
Prevent save task overlaps (#1588) 2020-11-27 10:21:39 -08:00
Gabriele C 232d9097cf
Limit island/player saves per tick (#1578)
* limit island/player saves per tick

* Whoops

* 20 players/islands per tick should be enough

20 players/islands * 20 tick * 60 seconds * 5 minutes (default interval) = 120000 saved entries :)
2020-11-27 10:12:10 -08:00
tastybento ba903bdaca
Stops async db saving on shutdown. Adds JSON backup. (#1558)
* Stops async db saving on shutdown. Adds JSON backup.

* Fixes test failures and added Util class tests.
2020-11-01 13:58:29 -08:00
tastybento f7f36179d3 Switch removeIf check
May help with https://github.com/BentoBoxWorld/BentoBox/issues/1550

I cannot understand why an CME is happening with removeIf. It should not
be possible.
2020-10-26 17:11:52 -07:00
tastybento 1e4056e33a Clears player cache by name and UUID
Previously only UUID was checked, but joining with a name and different
UUID is possible. This clears out the cache so commands that look up
names like ban do not use the old UUID.

https://github.com/BentoBoxWorld/BentoBox/issues/1468
2020-07-25 14:37:45 -07:00
tastybento f0564b7c78 Puts a null check on player UUID
It's possible for fake players to have null UUIDs apparently. So this
check avoids an NPE.
2020-05-01 20:48:04 -07:00
tastybento fe58159db3
Adds saveObjectAsync with a CompletableFuture return for databases (#1308)
Deprecates the saveObject() method
2020-04-26 01:00:49 +02:00
tastybento 6361bb9a4e Removed chevron from javadoc 2020-01-10 16:50:24 -08:00
Florian CUNY 704c249b49 Fixed some code smells (Sonarcloud) 2019-12-30 14:54:11 +01:00
tastybento d65e0d4665 Adds to JavaDoc 2019-11-16 18:17:55 -08:00
Florian CUNY e5646c72cd Removed unneeded #isKnown() check in onJoin listener
Since the player is added to the player cache right before the check, the code is always executed.
2019-11-09 11:41:48 +01:00
tastybento d27ea949d0 Fixes potential error in asyncSaveAll of players
https://github.com/BentoBoxWorld/BentoBox/issues/982
2019-10-11 08:39:45 -07:00
tastybento 2db926f640 Spreads out backup database saving to avoid lag
https://github.com/BentoBoxWorld/BentoBox/issues/976
2019-10-07 16:16:26 -07:00
tastybento 18c374bfa9 Add null protection for player death requests. 2019-09-25 13:46:34 -07:00
tastybento 2f78957d31 Implements Basic/Advanced/Expert settings panels (#888)
* Implements Basic/Advanced/Expert settings panels

Better alternative to https://github.com/BentoBoxWorld/BentoBox/pull/887

* Remove StatusIcon class - not used.

* Fixes glow of active tab.

* Moved FlagMode to Flag.Mode

* Display the LOCK flag no matter what the tab is

* Made the "mode" being saved for the player instead of per-tab
This means that a player will have its "mode" saved when he comes back later in the Settings Panel while also making the navigation more fluent - he won't need to set PROTECTION and SETTING to the same mode everytime.

Also renamed Flag.Mode#getNextFlag() to #getNext()
Added PlayersManager#setFlagsDisplayMode(UUID, Flag.Mode), #getFlagsDisplayMode(UUID)

* Play a sound when click on the mode button

* Added a description to the "mode" item

* Modified the mode for some flags
2019-08-12 23:54:05 +02:00
tastybento 3f3ac57f1e Cleans up code smells. 2019-07-11 13:55:17 -07:00
tastybento b1f66eb31b Fixes bugs and code smells from Sonarcloud. 2019-07-04 16:54:05 -07:00
tastybento ccdfccdf09 Removes a reset from player if they leave an island
https://github.com/BentoBoxWorld/BentoBox/issues/738
2019-06-07 21:33:29 -07:00
Florian CUNY 08b490c631 Added nullability annotations to PlayersManager#getName(UUID) 2019-05-26 21:58:24 +02:00
Florian CUNY d1a3a8285f Added PlayersManager#getResetsLeft(World, UUID) 2019-04-08 10:49:22 +02:00
tastybento 0cf0742c07 Remove code duplication. 2019-02-10 20:09:39 -08:00
tastybento 8334de8cba Fixes island pasting issue when pasting clipboard every tick.
https://github.com/BentoBoxWorld/BentoBox/issues/535

due to race conditions with task timers and incorrectly shared field
variables, islands would not paste completely if pasted every tick.
Now pasting is handled in its own class with a new instance created with
each paste.
2019-02-10 15:36:37 -08:00
Florian CUNY 7cbb0d6a87 Added PlayersManager#getPlayers()
#392
2019-01-20 09:01:38 +01:00
tastybento 501c3257ed Island delete enhancements
Island deletion is done a few chunks at a time per tick. Current speed
is 5 chunks per tick per world (e.g., 15 chunks per tick if nether and
end islands are used).

Chunks are deleted based on the all-time maximum protection range of the
island. This is because the protection range can grow bigger or smaller
over the island's lifetime. To ensure all possible chunks are erased,
the largest every protection range is remembered and used.

Very large protection ranges will take a long time to fully delete.

Info on islands that are being deleted is stored in the database. If the
server shuts down mid-deletion, deletion will restart when the server
restarts.

While an island is being deleted, new islands cannot occupy that spot
and the spot cannot be reserved by the admin.

In addition, async approaches to island saving and player saving were
removed. Async will be implemented another way.

Now, instead of saving the full island or player database, individual
database entries are saved instead to be more efficient.
2019-01-12 17:12:30 -08:00
Florian CUNY a17d946349 Fixed PlayersManager#setResets(World, UUID, int) Javadoc. 2018-12-29 10:47:33 +01:00
Florian CUNY 3102195156 Fixed a bunch of code smells (again) 2018-10-20 10:59:19 +02:00
Florian CUNY 97222808ac Fixed players considered "unknown" until they create an island 2018-09-02 08:50:40 +02:00
tastybento 9847235df1 Fixes MySQL exists and delete functions. 2018-08-18 09:53:21 -07:00
tastybento 67d40462bc Code clean up.
Removed commodore for now.
Simplified some return statements.
2018-08-14 08:24:28 -07:00
tastybento bcb44c4cce Fixed PlayerManager tests. 2018-08-12 04:14:07 +09:00
tastybento 7e7001e99b Fixes UUID lookup
https://github.com/BentoBoxWorld/bentobox/issues/232
2018-08-12 02:47:38 +09:00
Florian CUNY 5fa8f3997f BREAKING: Renamed a few API classes to a more generic name
`BBConfig` to `Config`.
`BBDatabase` to `Database`.
`BBDbSetup` to `DatabaseSetup`.

Sorry @tastybento, hope it won't bother you too much :/
2018-08-06 15:19:06 +02:00
tastybento ba557a1068 API Breaker: renamed BSB classes to be just BB
Hopefully, this is the last API breaker. I renamed the classes that
started with BSB to be just BB (bentobox). I now have to fix all the
add-ons I just broke...
2018-08-05 20:08:03 -07:00
tastybento 765268aa25 Code cleanup using Intellij 2018-08-04 21:50:10 -07:00
tastybento 783caf985f Added generic cooldown methods to CompositeCommand
This API enables any command to have a cool down and to have that cool
down called by another command. For example, the Kick command sets the
cool down on the Invite command. It is possible for commands to set cool
downs on themselves too.
Currently, cool downs are not stored persistently in the database so
they disappear if the server is reloaded. This should be okay for now.
2018-08-04 18:45:13 -07:00