Commit Graph

40 Commits

Author SHA1 Message Date
tastybento 24c68a0d95 Rewrite of admin setowner command #2309 2024-03-03 16:07:49 -08:00
tastybento 631a15563d Remove deprecated methods from IslandsManager and IslandCache 2024-02-24 15:07:05 -08:00
tastybento f6e26aa5bd Fix admin register command to handle worlds correctly
The register command was failing if a player had more that one island,
even if the island was in a different game mode.
2023-12-19 04:51:10 -08:00
tastybento 12bf37d2c2
No tabs (#2243)
* Remove all tabs from source and replace with 4 spaces.
2023-12-04 20:55:40 -08:00
tastybento 63d092db93
Multi island api update (#2224)
* Fixes bug with island team joining and deletion. Include debug.

* Remove ambiguous API with mutli-island.

* Add back deprecated methods so developers can be wartned not to use them

* Added back in deprecated methods.

* Fix bugs and NPEs.

* Fix some code smells

* Remove debug logging.
2023-11-12 12:22:12 -08:00
tastybento 19d7e2fe0a Fix island resetting. #2223
Islands were being deleted in all worlds, and all islands were being
deleted from the player instead of just the one island.
2023-11-10 17:06:46 -08:00
tastybento 9f8a6bcded Remove players from the island and cache. 2023-10-11 21:43:30 -07:00
tastybento 6d2f79881b Fixes getOwner and getIslands to properly return islands in the world
The world was not being used for the getOwner return so if a player had
an island in any world then it was returned. This caused an NPE if the
island was then requested by getIsland because it would not be there.
2023-10-07 10:30:16 -07: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 7616f6aa2a Address potential NPE's 2021-11-12 13:19:19 -08:00
tastybento 23857501f5
Static code analysis (#1844)
* StringBuffer (Java 5) may be declared as StringBuilder

* Replace map with flatMap

* Use instanceof naming

* No need to specify paramter types.

* Remove verbose code

* Fix JavaDoc issues

* Make internal class a record.

* Remove unused import.

* Make internal class a record.

* Made internal class a record.

* Removed unused import

* Fix typos

* Fix typo in test.
2021-08-29 18:17:38 -07:00
tastybento acfc001cd6
Java upgrade (#1814)
* Version 1.17.3

* Use Map.of and List.of instead of Immutable collections

* Replace explicit type argument.

* Replace lamba with method reference

* Replace condition with Objects.requireNonNullElseGet

* Use String.repeat

* Use new switch expressions

* Use instanceof patten variables which are more compact

* Fuse toUnmodifiableList into stream and return it.

* Remove unnecessary toString() calls.

* Remove unnecessary public

* Extracted common part from if

* Simplify conditional expressions

* Remove unused IOExceptions

* Cast to long

* Use Map.putAll

* Use primitives

* Clarify what is null or not

* Addedd @Serial annotation introduced with Java 14.

* Use Optional.isEmpty instead of !isPresent

* Use flatMap then ifPresent

* Just use Arrays.stream

* Swap map and filter for null with Objects::nonNull

* Use expression lambda
2021-07-31 08:48:26 -07:00
tastybento 66a28b420a Fix new bundle creation error.
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1561
2020-11-07 18:58:24 -08:00
tastybento a7747b560b Add clean up for duplicate island ownership.
https://github.com/BentoBoxWorld/BentoBox/issues/1568
2020-11-07 16:08:54 -08:00
tastybento a1a3913fe7 Refactor to use computerIfAbsent instead of putIfAbsent 2020-06-28 09:16:05 -07:00
Florian CUNY 73ab103098 Fixed some code smells 2020-06-02 14:22:46 +02:00
tastybento a9a9a9adee Put a null check into IslandCache to avoid null key in map. 2020-01-14 17:00:54 -08:00
Florian CUNY 23c621544d Added Island#isOwned(), Island#isUnowned() and improved javadoc on Island#getOwner() 2019-12-07 13:51:38 +01: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 8a1d969103 Added ability to reset one island flag to default for all islands
https://github.com/BentoBoxWorld/BentoBox/issues/958
2019-09-29 14:35:15 -07:00
Florian CUNY edb6d11fc2 Added IslandsManager and IslandCache#getIslands(World) 2019-08-28 14:21:08 +02:00
Florian CUNY 4e86441f6f Added nullability annotations in IslandCache, IslandsManager and Util 2019-08-28 14:19:42 +02:00
tastybento f5ad5aa2c9 Improves API and JavaDocs for getMembers (#628)
* Improves API and JavaDocs for getMembers

https://github.com/BentoBoxWorld/BentoBox/issues/627

* Fixed indentation in Island
2019-04-10 15:40:54 +02:00
tastybento 75bbc13cf5 Improved islands async deletion from database (#605)
Addresses https://github.com/BentoBoxWorld/BentoBox/issues/591
2019-03-11 08:41:41 +01:00
Florian CUNY e115a1df4d Fixed code smells 2019-02-21 10:00:59 +01:00
tastybento bce17ce467 Added admin trash command to handle damaged island db (#546)
* WIP - adds admin commands to handle damaged island db

Trash, purge, etc.

DO NOT MERGE YET

https://github.com/BentoBoxWorld/BentoBox/issues/505

* Prefixes the island uniqueId with the game mode name.

This enables manual removal of old game mode island files from the
database by admins if required.

* Adds Admin trash and empty trash commands

* Adds various commands for trash management

* Remove unused imports

* Forgot the javadoc in IslandsManager
2019-02-17 13:32:05 +01:00
tastybento 063303ad0e Adds admin command to reset all island flags to default
Used when an admin wants to change the default flag settings for all
islands and reset every one in the world.
2019-02-16 22:31:46 -08:00
tastybento 179a71b548 Get island by its UUID API added
https://github.com/BentoBoxWorld/BentoBox/issues/341
2019-02-11 19:01:44 -08:00
tastybento dd3bd6d9e7 Fixes sethome in nether and end bug.
https://github.com/BentoBoxWorld/BentoBox/issues/538
2019-02-11 14:46:54 -08:00
tastybento f7f47e8f44 Defensive code around null worlds
When a world is not loaded it becomes null in Bukkit so that any
references to that world will be null. If an admin removes a game mode,
then the island data was instantly becoming useless and quarantined.
This change leaves the files as-is so that if the game mode is put back,
the world is still viable.

As for home locations that are stored in the Player object, they are
removed so they do not cause errors.
2019-02-07 19:18:46 -08:00
tastybento 804d0f9878 Quarantines duplicate islands so they don't load continuously
https://github.com/BentoBoxWorld/BentoBox/issues/505
2019-01-30 16:46:51 -08:00
Florian CUNY 1c3ccba3ae Fixed probable NPEs in IslandsManager and IslandCache 2019-01-27 09:31:35 +01:00
Florian CUNY 3f5736f555 Improved javadoc 2019-01-20 08:52:57 +01:00
Florian CUNY 4d9a65151f Fixed code smells & added some more NonNull/Nullable annotations 2019-01-18 12:10:47 +01:00
Florian CUNY d57f9544f3 Added NonNull/Nullable annotations to IslandsManager and IslandCache 2019-01-18 11:33:29 +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 260410a927 Added IslandsManager#getIslandCount(World) 2018-12-09 14:19:26 +01:00
Florian CUNY ae162153a4 Removed deprecated code and classes 2018-12-09 10:55:19 +01:00
Florian CUNY 0322ffe0ce Deprecated #getTeamLeader(...) methods
These have been deprecated in CompositeCommand, IslandCache and IslandsManager and they got replaced by #getOwner(...).
2018-11-18 11:12:54 +01:00
Florian CUNY 3473fb48e6 Renamed 'world.bentobox.bbox' to 'world.bentobox.bentobox' 2018-07-31 18:03:32 +02:00