Commit Graph

69 Commits

Author SHA1 Message Date
tastybento 6599e3de80 Sort player's islands by age so they are always in the same order. 2024-03-21 19:20:31 -07: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 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 9bd0104a3d Put island deletion under one class manager
The goal is to make BentoBox less of a monster class and have fewer
dependent classes.
2023-07-01 12:49:18 -07:00
tastybento 2672ee5d1b Handle Boats and other Materials for 1.20. Uses Tags a lot.
May break compatibility with older server versions.
2023-06-10 21:31:39 -07:00
tastybento 2c283ae3a9
Javadoc and other cleanup from code analysis (#2099) 2023-02-26 17:48:37 -08:00
tastybento d50208c0e1
Add and fix tests for end gateway and portal. (#2044) 2022-10-31 17:59:04 -07:00
Huynh Tien ce1d8e5117
Rework the chunk deletion (#1897)
* delete island one by one

* register before IslandDeletionManager

* optimize imports

* setting

* just some indents

* config

* run synchronously

* a bit reformat before recoding

* proper delete chunks

* comment

* combine the task call

* expose the NMS Handler

* don't have to try-catch this

* we know that this is final

* expose copy chunk data so that it can be overridden

* Don't have to use Vector

* set block from minimum height

* remove NMS and use fallback if not set

* only get the height once

* fix test
2022-01-01 17:38:27 -08:00
tastybento b5d9d2e52e API: Require getWorldSettings to be a game mode world 2021-10-03 20:33:50 -07: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 87bdee0946 Return island protection center instead of island logical center
IslandsManager.getIslandLocation(world, uuid) is used to find the
starting point for the island home if a safe home for players cannot be
found. It returns the island center location but should return the
center of the island protection because that can now be in a different
location.
2021-03-17 15:18:55 -07:00
tastybento 6849c2a8bd Delete backup database during tests. 2021-03-07 11:34:30 -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 93417d6a6c Test cleanup 2021-02-28 08:10:18 -08:00
tastybento 010a56bc7b Fixed broken tests in IslandsManager 2021-02-28 07:54:13 -08:00
tastybento dfd4df4e05
Adds maxMembers to the Island object for persistent storage (#1691)
* Adds maxMembers to the Island object for persistent storage

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

* Expanded approach to include coop and trusted ranks.

* Checks for max members/coops/trusts on accept based on island setting.

* Write island max member/coop/trusted if owner joins server

This updates the island's settings based on the owner's permissions.
2021-02-27 11:19:02 -08:00
tastybento 97ac70cea3 Handle null users when getting island. Added test case.
A recent change to placeholders meant that it is possible for users to
be null. See https://github.com/BentoBoxWorld/BentoBox/issues/1654
2021-02-16 17:15:07 -08:00
tastybento 1eee225def Added test case for getSafeHomeLocationNoIsland() for player with no
island.

https://github.com/BentoBoxWorld/BentoBox/pull/1651
2021-01-20 16:01:06 -08:00
Florian CUNY c60833a054 Fixed code smells in tests (SonarCloud) 2021-01-16 14:27:01 +01:00
tastybento 86af7b568c Fix test for clearArea 2021-01-04 22:53:11 -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 450c459350 Doors are not safe ground blocks.
https://github.com/BentoBoxWorld/BentoBox/issues/1517
2020-09-06 16:16:06 -07:00
tastybento b87533fffb
Introducing (limited) 1.16.1 support (#1416)
* 1.16.1 changes

* Fixed failing tests in PhysicalInteractionListener
HOWEVER, the code somehow no longer protects the pressure plates... I'm investigating that.

* Implemented future-proof buttons, doors, fence gates, trapdoors protection

* Protected REDSTONE_WIREs under "REDSTONE" flag
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1421

* Fixed bug with pressure plates

* Fixed params order in assertEquals in PhysicalInteractionListenerTest

* Fixed EnderChestListenerTest errors

* Fixed most errors in BlockInteractionListenerTest

* Added 1.16.1 to ServerCompatibility

* Fixed BlockInteractionListenerTest

* Fixed backwards compatibility in BlockInteractionListener
Also made use of existing Tags (ANVIL, BEDS, SHULKER_BOXES)

* Fixed BlockInteractionListenerTest (again)

* Fixed backwards compatibility in PhysicalInteractionListener

Co-authored-by: Florian CUNY <poslovitch@bentobox.world>
2020-06-26 22:09:33 +02:00
tastybento 0fec5aec51 Added insufficient rank error and fixed tests.
The no permission error was being added, but thats wrong because it's
not lack of permission but lack of rank that is the issue. This adds a
new error and shows it in the various commands.
2020-06-06 17:01:09 -07:00
Florian CUNY 46ba40b70d Fixed IslandsManager#getSafeHomeLocation throwing NPE if world is not an island world
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1306
The method now properly returns null if the world is not an island world.
2020-04-25 14:40:47 +02: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 ab89e4835e Fixes island center startx/z correction.
https://github.com/BentoBoxWorld/BentoBox/issues/1169
2020-02-04 12:20:31 -08:00
tastybento 3f1d6d16ff Added Mockito.framework().clearInlineMocks() to all test classes per
https://github.com/mockito/mockito/wiki/What%27s-new-in-Mockito-2

This is just e defensive measure and may not have an affect on any
particular class.
2019-12-06 08:29:29 -08:00
tastybento 032b5c2988
Allows a space to be placed after a color code in locale files. (#1045)
Space will be stripped if it exists. This makes GitLocalize able to
machine translate much better.

Changes to the English locale file was made. Other languages do not have
to add spaces. Note that adding or removing spaces from files is easy
with regex.

https://github.com/BentoBoxWorld/BentoBox/issues/1044
2019-11-30 16:17:38 -08: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 02e8243bd0 Fixed admin register of spawn island.
https://github.com/BentoBoxWorld/BentoBox/issues/991
2019-10-18 19:32:54 -05:00
tastybento 87168a5ea9 Compile against Spigot 1.14.4 (#919)
Fixes #914.

* Shifts to compile with 1.14.4 API.

Note that this will make some events incompatible with 1.13.2 because of
a class not found error.

* WIP

* Fixed deprecated APIs and ItemStackAdapter test case

* Fixes enderchest test bug.

* Updated server version compatibilities in ServerCompatibility
2019-08-29 21:18:45 +02:00
tastybento b9215d62b8 Added IslandDeletionManager test class 2019-08-15 12:53:20 -07:00
tastybento 44cbd81320 Moved to Mockito 2 and PowerMock 2019-08-04 21:44:46 -07:00
tastybento e99f84f7c7 Prevents named mobs from being cleared on teleport.
Adds a setting in BentoBox config to set the clear radius.
Adds defensive code to avoid clearing mobs in non game worlds.

https://github.com/BentoBoxWorld/BentoBox/issues/847
https://github.com/BentoBoxWorld/BentoBox/issues/819
2019-07-18 21:58:16 -07:00
tastybento 574fbc182f Added world protection settings to config
https://github.com/BentoBoxWorld/BentoBox/issues/840

This adds (or fixes) the ability for admins to set the default setting
of a protection flag. The flags go in the world flags section of a game
mode's config.yml.
2019-07-13 15:25:10 -07:00
tastybento edd7bbf97a A lot of database work.
Database closing was occuring too early. In priort releases it was
hidden because the connection would be automatically made again. When
this was removed, it exposed this error.
Now the single database connection will not be closed until all
registered database objects have finished with their async queues.

Further, the database connecter was being made once for each database
type. This was a waste of resources and it also meant that static fields
were being used. Now, only one database connecter object is made and
there are no static fields.

https://github.com/BentoBoxWorld/BentoBox/issues/813
2019-07-05 20:11:06 -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 9b0575246c Reworked island team coop command and test. 2019-06-01 13:22:28 -07:00
tastybento c7f2eb5f2a Fixes drop into block after island reset issue.
https://github.com/BentoBoxWorld/BentoBox/issues/705
2019-05-29 17:13:22 -07:00
tastybento f5338bfaac Fix tests 2019-05-26 17:35:19 -07:00
tastybento a00dedbdc4 Fixed tests.
Relates to https://github.com/BentoBoxWorld/BentoBox/pull/692
2019-05-23 20:09:35 -07:00
Florian CUNY 3f83a89215 Added placeholders replacement in BentoBox's own messages
It is now possible to use external placeholders into BentoBox's messages.
2019-05-11 16:11:57 +02:00
tastybento 180b88544a Database transition (#662)
- JSON is now the default database type
- JSON database files are now pretty-printed
- It is now possible to migrate from a database type to another through the use of a command and specific transition database types
- It is recommended to move from YAML to JSON.

= Commits breakdown =

* Proposal to make JSON the default database and retire YAML.

* Make JSON file format easier to read.

* Fix tests.

* Adds a hybrid Yaml2Json database type.

This database always tries to use JSON if it is available. If a YAML
file is found, it will be loaded and replaced with a JSON file.

* Move to generic database transition code

* Better comments

* Adds transitional database options so admins can choose.

Adds Yaml2MySQL option and changes config.yml to add instructions.

* Enables full database migration between databases.

Adds /bbox migrate command.

Adds a number of transition databases. DB starts transition  when the
server boots up and will migrate organically. The admin can force an
immediate update using the bbox migrate command.

This operation requires an API breaking change: Addons that use the
Config API must now implement ConfigObject in their config class instead
of DataObject. This is to differentiate YAML config classes from YAML
database classes. If a class is already implements WorldSettings
(GameModeAddons), then no change is required because WorldSettings
implements ConfigObject now. If an old addon is used that does not
implement ConfigObject, BentoBox will not load.

* Added null check to YAML deletion

* Removed the 2YAML transition dbs because YAML is deprecated.

YAML does not support some data structures so conversion could corrupt
data.

* Fixed some javadoc and added missing DatabaseType#JSON2MARIADB

* Renamed package database/transitiondb to database/transition
2019-05-08 21:15:22 +02:00
tastybento 4472817b07 Removed tests. 2019-04-28 07:32:42 -07: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 8f24e59a21 Fixes IslandsManager test cases and pufferfish removal
The clear area method should not remove pufferfish as per
https://github.com/BentoBoxWorld/BentoBox/pull/595
2019-03-09 16:54:54 -08:00
tastybento 160ef002e4 Fixes island coords that are not on the grid.
https://github.com/BentoBoxWorld/BentoBox/issues/549
2019-02-20 21:42:43 -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