Commit Graph

58 Commits

Author SHA1 Message Date
tastybento 9b8540a8ed 2.4.0 2024-04-19 21:43:30 -07:00
tastybento 8b15888968 Handle island deletion better 2024-04-10 23:00:20 -07:00
tastybento aaa1504dc6 WIP multipaper 2024-04-07 17:05:21 -07:00
tastybento 78f84de3cb Use Bukkit pasting if user is too close to new island.
This prevents players experiencing invisible blocks at the expense of
lag.
2024-02-23 23:04:47 -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 22f398fe53 Fix deletion of islands when chunks are not deleted. Fixes #2241 2023-12-03 19:50:51 -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 6d09a5a359 Fixes #2219. Island homes were set incorrectly with a new island. 2023-11-04 10:29:28 -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 056cff4b6f
Code clean up from Sonar Cloud analysis (#2068)
* Code clean up from Sonar Cloud analysis

* Fix tests

* Remove code smell

* Rename "island" which hides the field declared at line 25.

* Removed code smells.

* Rename variable record to rec

Renamed "record" variable to not match a restricted identifier.
Restricted Identifiers should not be used as identifiers. "record" is
using in Java 16.

* Added private constructor to prevent instantiation of static class

Changed variable name to rec instead of restricted "record".

* Remove Blueprint code smells.

* Use a record for database settings constructor

Code smell: Methods should not have too many parameters. I'm not sure
what methods are using this class though.

* Update MyWorlds version

The POM for MyWorlds is invalid and causes a warning, but this still
persists with this version.

* Extracted nested try block into a separate method.

Makes it clear when reading the code what might be caught

* Extracted nested try block into a separate method.

* Fixed JavaDoc /** instead of just /*

* Extracted nested try block into a separate method.

* Refactored to not assign loop counter from within the loop body.

* Better delete option. With results.

That said, this is legacy code to handle an issue that occurred a long
time ago and this whole set of code can probably be removed.

* Catch Exceptions not Throwable

* Log error with BentoBox logError

* Use computeIfAbsent

Using these instead leads to cleaner and more readable code.

* User can no longer be null

* Added the missing @Deprecated annotation and @since ref

* Added @since reference

* Merge if statements

* Use BentoBox error logging.

* Added JavaDoc @since

* Remove deprecated class and move used class

* Remove deprecated WoodType and use Type.

* Remove unused import

* Extracted nested try block into a separate method.

* Comment empty default statement

* Clean up logic; avoid switch

* Use Java instead of Guava

* private constructor to hide the implicit public one.

* Private constructor to hide the implicit public one.

Merged if statement.

* Add comment

* if merge

* Make variable constant

* Remove unused imports

* Remove deprecated and unused method

* Remove unused import

* Typo

* Remove instanceof and cast

* Remove superfluous null check

* Put constant at bottom of file because @BONNe likes it there.

* Simplify particle validation code
2022-12-31 16:41:17 -08:00
tastybento 18983e5570
Code cleanup (#2065)
* Cast operands to (double)

* Code clean up from static analysis

* Revert the GitHubAPI version change because it didn't work.
2022-12-29 10:01:25 -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 2701eb92d7 Do not use orElse as it ignores the reservation.
https://github.com/BentoBoxWorld/BentoBox/issues/1636
2021-01-08 20:06:21 -08:00
tastybento be40bd2c54 Fixes new island event casting bug 2020-12-27 11:43:37 -08:00
tastybento 999d196e8e
Event fix with deprecation (#1623)
* Break out events and add individual handlers

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

* Corrected AddonEvents to have proper static handlers

* Made constructors protected.

Abstract classes should not have public constructors. Constructors of
abstract classes can only be called in constructors of their subclasses.
So there is no point in making them public. The protected modifier
should be enough.
2020-12-27 10:35:49 -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 aec2e115eb Removes tamed animal ownership on new island
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1450
2020-12-24 10:15:14 -08:00
tastybento 065ddfb93f Simplified newIsland method in preparation for additional user cleaning 2020-12-24 09:35:43 -08:00
tastybento f09ea1ffef Adds PreCreateEvent for API 2020-10-12 14:07:47 -07:00
tastybento bdbfd33a34
Fixed code smells (#1444)
* Code smell changes

* Fixes issues raised in reviews.
2020-07-09 09:03:01 +02:00
tastybento 38db699801
Uses async location loading for home teleporting (#1381)
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1241

Co-authored-by: Florian CUNY <poslovitch@bentobox.world>
2020-06-02 10:22:35 +02:00
Florian CUNY 91ccf51a54 Added option to keep old islands when resetting
Implements https://github.com/BentoBoxWorld/BentoBox/issues/1188
2020-04-20 17:20:12 +02:00
Draww 1e71d67a9b
Added #getOldIsland() in island reset-related events (#1179)
* Reaching Old Island information in Island reset events

* Added javadocs since tags

* added javadoc since tags for new field/method in builder

Co-authored-by: Florian CUNY <poslovitch@bentobox.world>
2020-02-19 22:36:05 +01:00
tastybento 9f65537ab8 Load chunks before pasting islands. Runs async.
1.15.2 can take a looooong time to load a chunk, sometimes up to 10
seconds.

https://github.com/BentoBoxWorld/BentoBox/issues/1180
2020-02-10 20:14:43 -08:00
Florian CUNY a807918105 Fixed NewIsland.Builder#reason() logic (thanks to the unit tests) 2019-12-23 15:19:28 +01:00
Florian CUNY 48f898aa2c Added WorldSetting#isTeleportPlayerToIslandUponIslandCreation()
Implements https://github.com/BentoBoxWorld/BentoBox/issues/1032
2019-12-23 15:01:32 +01:00
Florian CUNY a796e3ae22 Forced reasons in NewIsland's Builder to be either CREATE or RESET 2019-12-23 14:32:33 +01:00
tastybento 27c1b6505c Uses and catches specific IOException for new islands
Relates to c3442c29ba
2019-12-16 17:24:48 -08:00
tastybento c3442c29ba Reworked how new island spots are found.
Fixed bug where max attempts check was not working, which could cause a
timeout crash.

https://github.com/BentoBoxWorld/BentoBox/issues/1057
2019-12-15 14:41:59 -08:00
Leonardo Chaia 2484421d92 Allows customizing where islands are created (#984)
Implements https://github.com/BentoBoxWorld/BentoBox/issues/983.

* Allows customizing where islands are created

NewIsland receives a new interface which determines the location
where the next island will be created

A default implementation is provided which mirrors the previous behavior

* Adds autors to DefaultNewIslandLocationStrategy

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

* Improves Javadocs

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>
2019-10-13 16:11:59 +02:00
Florian CUNY 1ae3171340 Removed deprecated methods/classes
PremadeEvent, NewIsland.Builder#world()
2019-08-13 11:14:53 +02:00
tastybento 54f44cf30f Range permission was not used when making new island
https://github.com/BentoBoxWorld/BentoBox/issues/664

Added test class for NewIsland class
2019-08-10 15:11:46 -07:00
tastybento 6926ecbb9e Implements an island reservation system using the admin register command (#850)
* Implements an island reservation system using the admin register command

Admin flies to an empty spot and registers the player there. This
creates a bedrock block to mark the spot but it sets the island as
reserved for the target player. The next time a player issues the island
command (or island create) they get the selection of islands and it is
pasted at that location.

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

* Update src/main/java/world/bentobox/bentobox/database/objects/Island.java

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

* Update src/main/java/world/bentobox/bentobox/database/objects/Island.java

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

* Update src/main/java/world/bentobox/bentobox/database/objects/Island.java

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

* Update src/main/java/world/bentobox/bentobox/database/objects/Island.java

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>
2019-07-22 00:36:14 +02:00
tastybento 3f3ac57f1e Cleans up code smells. 2019-07-11 13:55:17 -07:00
tastybento b6fcf511a6 API addition - adds reset deaths on new island (#817)
* API addition - adds reset deaths on new island

BentoBox currently tracks deaths in the worlds but the current API only
allows them to be reset when a player joins a team. This setting enables
deaths to be reset when a player starts a new island or resets an
island.

WARN: This should be the only additional WorldSetting we need for deaths.

* Update src/main/java/world/bentobox/bentobox/api/configuration/WorldSettings.java

* Update src/main/java/world/bentobox/bentobox/managers/IslandWorldManager.java

* Update src/main/java/world/bentobox/bentobox/managers/island/NewIsland.java

* Update src/main/java/world/bentobox/bentobox/managers/IslandWorldManager.java
2019-07-07 07:59:49 +02:00
tastybento b1f66eb31b Fixes bugs and code smells from Sonarcloud. 2019-07-04 16:54:05 -07:00
Florian CUNY d9d4805ea8 Added ability to edit the BlueprintBundle in IslandCreate/ResetEvent
https://github.com/BentoBoxWorld/BentoBox/issues/635
2019-07-04 14:31:21 +02:00
tastybento 4efdada98e Checks 4 corners of island to avoid overlapping issues
Relates to https://github.com/BentoBoxWorld/BSkyBlock/issues/149
2019-06-28 18:28:57 -07:00
tastybento 3f217e30ad Adds involved player UUID to IslandDeleteEvent
https://github.com/BentoBoxWorld/BentoBox/issues/790
2019-06-26 19:03:56 -07:00
tastybento 700043fe40 Implemeted Blueprint bundles and blueprints (#672)
* A prototype for Blueprint bundles and blueprints

This stores blueprints inside bundles. Each bundle can have up to 3
blueprints defines by the World.Environment.

This is not a finished manager. It just handles all the saving and
loading side of things. I thought this would help you so you can then
concentrate on the UI.

* WIP: Copy blocks to Blueprint done.

* WIP Pasting done.

* WIP: Added BlueprintsManager to ultimately replace SchemsManager.

* Moved blueprint suffix and changed to .blu

* Fixed unit test.

* Now tested and working.

Integrated with new island and resetting island.

If there are no blueprint bundles or blueprints then a default bedrock
set will be made and put in the game mode addon's blueprints folder.

Still to do: enable schems to be loaded and pasted for legacy support.
Add blueprints and a bundle to GameModeAddons like BSkyBlock.

* Renamed most of the classes

* Cleaned up clipboard and paster.

* Further cleanup on blueprint clipboard and paster.

* Merged blueprint classes into one package.

* Put Blueprint data objects in their own package.

Isolated schems classes for later removal.

* Renamed admin command classes and changed locale files.

* More clean up to remove schems

* Schem to blueprints converter done.

Converts schems to blueprint bundles and sets up a default set. Tested
the happy-path. Need to do more testing on edge cases.

* Added basic UI for development. Fixed bug with schem conversion.

* Adds permissions into the blueprints.

Fixes tests, cleans up some naming

* Added IslandCreationPanel and created BlueprintManagementPanel

* Fixed JSONDatabaseHandler's constructor being public

* Made the Blueprints button in ManagementPanel open the Blueprint management panel

* Fixed tests and ignored one (NPE)
2019-05-15 20:16:41 +02:00
tastybento 7990378355 Adds island expel command.
Requires GameModeAddons to use it.

https://github.com/BentoBoxWorld/BentoBox/issues/524
2019-03-21 20:41:30 -07:00
tastybento f515bb6205 Fixes bug where island location was shifting due to home calculation
https://github.com/BentoBoxWorld/BentoBox/issues/549

Using the add method on the location was actually changing the
fundamental island location and shifting all subsequent islands off by
0.5 every time.
2019-02-20 11:18:42 -08:00
tastybento 3ca0c440e4 Sets initial home location in middle of block 2019-02-12 20:03:02 -08:00
Florian CUNY f2078aae3f Fixed additions where at least one operand was not casted as double 2019-02-02 10:47:59 +01:00
tastybento 95b40841ba Adds all worlds to map in IWM
Fixes Multiverse world registration
2019-01-19 11:22:26 -08:00
Florian CUNY 755433e108 Added islands created count metrics
Made BStats class public
Added BentoBox#getMetrics()
2019-01-18 15:12:06 +01:00
tastybento 2fa60d0e2d Added option to not paste a schem when creating a new island 2019-01-15 11:46:09 -08: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