Commit Graph

46 Commits

Author SHA1 Message Date
tastybento f049fc6941 Added SafeSpotTepeortTest 2021-12-20 09:46:04 -08:00
Huynh Tien 333c9a8272 load chunks passively 2021-12-20 19:37:50 +07:00
Huynh Tien 168de622ea limit how far the y-coordinate will be expanded 2021-12-19 20:40:01 +07:00
Huynh Tien f91ed4705a this should be better 2021-12-16 17:18:09 +07:00
Huynh Tien 6f01310f92 better safe spot finder 2021-12-16 08:58:41 +07:00
tastybento 930433b64b Clear the going home flag for edge cases
There were a few potential times when the flag may not have been
cleared. These were mostly teleport failure scenarios. Hopefully, this
is all of them.

https://github.com/BentoBoxWorld/BentoBox/issues/1864
2021-10-16 20:44:18 -07: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 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 044a0c5c0d Fix JavaDoc 2021-05-31 16:01:21 -07:00
tastybento 609322d582 Remove debug. 2021-03-27 17:05:13 -07:00
tastybento 4b9b6774ea Teleport based on protection center and world height. 2021-03-27 16:57:15 -07:00
tastybento a03aa51fb4 Fix NPE with admin teleport command. 2021-03-06 08:14:31 -08:00
tastybento b6a69d0c90
Switch to island homes from player homes. (#1689)
* Switch to island homes from player homes.

Stores home locations and max homes in the Island object. Adds commands
required to manage home names, specifically rename and delete. I did not
add list as there is tab complete on island go, but it may be required.
2021-03-01 10:42:08 -08:00
tastybento 1d9ce7241e
Decouple island location from island center. (#1659)
* Decouple island location from island center.

This enables the protection area to move anywhere within the island
boundaries

* Paste island at island location.

* Move visitors to the island location

* Added island location placeholders

* Use island location instead of island center

* Fix tests

* Allow radius 1 islands.

* Correct admin range set limit

* Debug in progress

* Fix island deletion.

The speed option was doing nothing except causing repeated actions on
the same chunks.

* Soft depend for WorldGeneratorApi for Boxed game mode

* Changed to "protectionCenter".

Added logic to expand the deletion area based on moving the island
protection location and range instead of just deleting everything. This
will keep deletion time to a minimum for BSkyBlock, etc.

* Fix tests.
2021-02-13 10:19:53 -08: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 caed56f16e Load initial tp location async
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1584
2020-11-26 17:25:17 -08:00
Florian CUNY 73ab103098 Fixed some code smells 2020-06-02 14:22:46 +02:00
Florian CUNY f4e3eda98c Removed deprecated (as of 1.6.0) SafeSpotTeleport.Builder.overrideGamemode() 2020-06-02 10:25:40 +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
tastybento 3b50b01eef SafeSpotTeleport was setting home location async
This could cause a race condition setting home to null.

If home was null during a new island creation, then the new island tasks
would not be run because SafeSpotTeleport was not given the runnable.

May be related to:
https://github.com/BentoBoxWorld/BSkyBlock/issues/312
2020-05-02 14:11:37 -07:00
tastybento eee8709636 Combined safe spot checking into one place.
We had two sets of checking with different criteria. This consolidates
them.

Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1296
2020-04-22 18:25:10 -07:00
tastybento f0c50a5211 Remove debug 2020-04-09 22:10:28 -07:00
tastybento 63e6f244bd Remove incorrect JavaDoc and forced use of SafeSpotTeleport builder 2020-04-04 08:20:32 -07:00
tastybento 25d43c4f9f Removes velocity on teleporting
https://github.com/BentoBoxWorld/BentoBox/issues/1248
2020-03-28 09:42:55 -07:00
tastybento c9b0c74d08
Paper lib (#1026)
* Remove unused imports

* Implements PaperLib within bentobox

* Added PaperLib methods to Util for addons to call

* Uses PaperLib for island deletion

* Point to https://github.com/BentoBoxWorld/MVdWPlaceholderAPI in POM
2019-11-13 15:10:33 -08:00
tastybento 8dabdf46fe Simplify code in SafeSpotTeleport 2019-11-08 17:12:26 -08:00
tastybento 75ec023249 Creates a spot for a player to teleport to if there is none available.
https://github.com/BentoBoxWorld/BentoBox/issues/963
2019-10-03 13:01:14 -07:00
tastybento 86da94182c Reduces safe spot search radius and checks a few more chunks per tick
https://github.com/BentoBoxWorld/BentoBox/issues/952
2019-09-20 15:16:09 -07:00
tastybento a0d61006e0 Improved SafeSpotTeleport to limit chunks scanned per tick
Related to https://github.com/BentoBoxWorld/SkyGrid/issues/24
2019-08-26 19:19:45 -07: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
Florian CUNY 6759a8acc9 We're no longer switching the player to SPECTATOR mode when teleporting
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/786
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/578
2019-07-03 10:36:50 +02:00
tastybento 9e36865a9f Fixed some code smells (#698)
* WIP code clean up and code smell removal

* Tried to fix a few more code smells
2019-05-26 22:14:24 +02:00
tastybento 1207a05d3f Added basic 1.14 """"""support"""""".
Addons are NOT compatible with 1.14.
Both 1.14 and 1.14.1 are now considered "NOT_SUPPORTED"
2019-05-14 11:03:57 +02:00
tastybento 650e370ffe Rewrote chunk deletion (#648)
As of 1.14, chunk regeneration is no longer supported. This PR implements a not-chunk-based deletion that supports both 1.13 and 1.14 and which also allows us to get rid of the "multiple of 16" rule for island distances. This PR however does not remove the "multiple of 16" rule and a commit should be made thereafter.
This PR is also a pre-requisite to #640.

* Makes GameModes responsible for regenerating chunks.

* Deletes chunks manually to solve 1.14 chunk regen removal

* Fixes round up to 16 for island distance bug.

* Clean up - removing imports and stack traces

* Revert "Fixes round up to 16 for island distance bug."

This reverts commit 54f1ce0940.

* Adds island edge protection for deletion. Needs full testing.

* Completed testing. Works correctly.
2019-05-01 16:25:35 +02:00
Florian CUNY 1d119ddea1 Removed "warp not safe" message, replaced with the (renamed) "no-safe-location-found" 2019-04-11 10:37:14 +02:00
tastybento 278eb37033 Fixes bug where player will not exit SPECTATOR mode
If the proposed location was immediately safe, the player was not being
put back to the default game mode.
2019-02-21 10:41:59 -08:00
Florian CUNY f0543bc85c Fixed SafeSpotTeleport being way too spammy
https://github.com/BentoBoxWorld/BentoBox/issues/306#issuecomment-462190682
2019-02-11 00:47:26 +01: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 5f49e2b17b Runs /spawn command for player if no safe teleport spot
https://github.com/BentoBoxWorld/BentoBox/issues/479
2019-01-24 08:30:43 -08:00
tastybento a7365ef805 Fixes chunk deletion bug and corrects chunk calculations elsewhere.
https://github.com/BentoBoxWorld/bentobox/issues/405

Adds test class for DeleteIslandChunks class.
2018-12-19 22:15:38 -08:00
tastybento 14b7a3aa82 Fixed teleporting to an island by using a member's name
https://github.com/BentoBoxWorld/bentobox/issues/300
2018-10-07 18:15:18 -07:00
Florian CUNY 58de346dc9 Various changes to SafeSpotTeleport
* Replaced SafeTeleportBuilder by SafeSpotTeleport.Builder
* Added "overrideGamemode" parameter
* AdminTeleportCommand no longer overrides the player's gamemode when teleporting (fixes #262 )
2018-09-15 12:38:51 +02:00
Florian CUNY e6418f0957 Finished updating source code to 1.13 API
Test units still need to be updated.
2018-08-01 11:03:03 +02:00
Florian CUNY b600dacbdd Continued 1.13 support 2018-08-01 10:18:37 +02:00
Florian CUNY 3473fb48e6 Renamed 'world.bentobox.bbox' to 'world.bentobox.bentobox' 2018-07-31 18:03:32 +02:00