Commit Graph

47 Commits

Author SHA1 Message Date
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
tastybento 2713f58ac5 Fix to fire Island events after an island is created.
Events were firing too early before the island had been fully pasted
async.
2019-01-03 10:24:50 -08:00
tastybento 2528442d6b Rewrote using state approach to be easier to understand.
Backwards compatible with current schems. New schems required to avoid
torch popping etc. Look for updates to AcidIsland and BSB.
2018-12-31 11:24:24 -08:00
tastybento c4a5eb2c88 WIP pastes but attachments fall when split across paste boundaries 2018-12-30 18:09:56 -08:00
tastybento 0adc2e3078 Uses current API to enable multiple schems.
This will load all schems in an add-on's schem folder if it exists and
associate them with this world set (overworld, nether and end). Schems
can be named anything, but the partner nether or end worlds must be
pre-fixed with "nether-" or "end-" in the filename.
Additional schems can be added by the admin into the schem folder, or
they can be stored in the jar file of the add-on. Both are supported.

No changes are required to current add-ons. I.e., there is no API
breakage here, but I would like to rename the SchemsManager method
loadIslands(World world) to be loadSchems(World world) in the future.

Related issues/PR:
https://github.com/BentoBoxWorld/BentoBox/issues/104
https://github.com/BentoBoxWorld/BentoBox/issues/207
https://github.com/BentoBoxWorld/BentoBox/issues/378
https://github.com/BentoBoxWorld/BentoBox/pull/408
2018-12-23 19:31:00 -08:00
Florian CUNY 343ee51647 Preventively save the player to the database when creating a new island
Related to 68873e033f
2018-11-11 10:46:43 +01:00
tastybento 68873e033f Added defensive code to handle island adding to grid.
When an island cannot be added to the grid, it should show some helpful
console error.

Related to https://github.com/BentoBoxWorld/bentobox/issues/326
2018-11-10 10:04:37 -08:00
tastybento b9c2756094 Added protection from falling damage when new island made
Also sets player's velocity in all directions to zero.
2018-08-25 11:29:24 -07:00
Florian CUNY 3473fb48e6 Renamed 'world.bentobox.bbox' to 'world.bentobox.bentobox' 2018-07-31 18:03:32 +02:00