Commit Graph

74 Commits

Author SHA1 Message Date
tastybento 2b19d43c85 Remove restrictions on having multiple islands for team members.
Added API to enable checking for teams on islands easier.
2024-03-29 19:38:44 -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 df45fca562 Refactor - merge List creation and addAll into one 2023-07-08 08:36:29 -07:00
tastybento a7ffb79f1d
Merge branch 'develop' into bbox_perms_command 2023-06-24 10:15:34 -07:00
tastybento c0beba7467 Formatting 2023-06-19 09:38:00 -07:00
tastybento e9067cfb28 Add bbox admin perms command and adjust perms for commands
Made some admin commands have their own perm so that they can be
controlled  individually by permissions.
2023-06-18 13:55:21 -07:00
tastybento 1262a08a22 Removed deprecated method isPlayer(User) 2023-01-01 08:43:31 -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
BONNe 44201afa1f Fixes an issue with missing parent permission check before command execution.
Implement a new method that recursively checks if player has access permission to all commands in whole hierarchy.

Fixes #2010
2022-08-03 19:00:42 +03:00
BONNe 9643f617b6 Implement a command that allows to reset island name.
Fixes #1879
2022-07-06 23:30:51 +03:00
BONNe da98bbcf38
Extend ranked commands (#1928)
* Add CompositeCommand#defaultCommandRank variable.

This variable stores default rank for a command. This adds more flexibility to the Island#commandRanks object. This change allows specifying default rank for each command.

* Add more commands for users to configure on their islands.

Owners now can specify who can use:
- sethome command
- renamehome command
- deletehome command
- setname command
- resetname command
2022-01-28 18:41:20 -08:00
tastybento 29fa03976c Fix some code smells. 2021-09-19 18:29:19 -07:00
tastybento 53f02ae686
Npe squashing (#1857)
* Fix hanging [uuid] in info.

* NPE checking

* Make getProtectionCenter nonNull

* More NPE fixes.

* Fix test

* Make getPlayer() and getOfflinePlayer() nonNull returns

This requires addons to not use null checks and instead us the isPlayer
or isOfflinePlayer methods.

* NPE blockers

* Deprecate CompositeCommand isPlayer method.

* Fix test
2021-09-18 17:59:32 -07:00
tastybento 8eb45e817c Code smell reduction 2021-09-18 08:15:15 -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 0341515fc8
Package info files for better JavaDocs (#1839)
* Added package info files for better JavaDocs
2021-08-29 13:28:16 -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
BONNe dc829786d3
Fixes a bug with Commands not being able to find subcommand if defined label contains capital letter. (#1724) 2021-03-27 18:19:44 -07:00
tastybento 7d6cce6563 Minor Java doc addition to clarify getAddon() 2021-03-07 10:09:18 -08:00
Florian CUNY b8d67a653c Fixed some code smells (Sonarcloud)
Put some fields as "final"
Made all abstract classes' constructors "protected" (them being public serves no purpose since they cannot be instantiated outside of child classes)
Did some minor code prettifying
2021-01-16 11:27:12 +01: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 a1a3913fe7 Refactor to use computerIfAbsent instead of putIfAbsent 2020-06-28 09:16:05 -07:00
tastybento b1dcec2160
Adds API to enable commands to be hidden from help and tab (#1301)
Implements #1300.

Adds CompositeCommand#setHidden(boolean).
2020-04-23 20:54:45 +02:00
BONNe 4206435d65 Easier addon getter by their name (#939)
* Easier addon getter by their name

A small improvement to get a certain addon from its name.
This allows getting addon main class without the necessity to cast if afterwards (as the cast is done in `getAddonByName()` method).

* Use cast on CompositeCommand#getAddons()

This will allow getting correct addon class without casting in code.
Casting will be done in CompositeCommand#getAddons() method.
2019-09-14 21:12:18 +02:00
tastybento 3f3ac57f1e Cleans up code smells. 2019-07-11 13:55:17 -07:00
tastybento 15b602f331 Added CompositeCommand#call(...) (#772)
* Implements new call API for commands

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

* pom.xml should not use tabs

* Improved javadoc

* refixed the since tag in javadoc
2019-06-18 14:33:03 +02:00
Florian CUNY 3e6fe52f95 Fixed CompositeCommand not handling correctly null permission prefixes
Added nullability annotations
2019-06-12 13:25:10 +02:00
tastybento 7b2e8a657e Rewrite of cooldowns to use island ID instead of player ID
Adds cooldown to island leave command.

Tries to mitigate cooldown bypassing by players who change island owner
or use subowner or members to issue invites instead of owner. Now the
cooldown is based on the island ID itself.

Original API's are kept for compatibility with addons that use
cooldowns.

Relates to https://github.com/BentoBoxWorld/BentoBox/issues/727
2019-06-05 22:55:32 -07:00
tastybento fc160d8c5f Aligns permissions and fixes permission bugs
https://github.com/BentoBoxWorld/BSkyBlock/issues/120
2019-05-07 13:14:25 -07:00
tastybento 2d94e4447a Enables game mode addons to run as the only world (#661)
* Enables game mode addons to run as the only world.

Requires game mode addons to do the following in their onLoad:

1. Register commands
2. Be able to provide the chunk generator object because it will be used
to generate the worlds
3. Be able to provide the WorldSettings because the world name (string)
is required

* Sets world in CompositeCommand after onEnable

* Added Javadoc to Addon#onEnable and Addon#onLoad to better explain where to do what.
2019-05-04 22:56:55 +02:00
Florian CUNY 865a1d0caa Added BentoBoxCommand#canExecute(User, String, List<String>)
#530
2019-02-10 22:32:33 +01:00
tastybento 3ccd19bf9c Fix locales to show correctly based on GameMode and locations
Fixes console translations too.

https://github.com/BentoBoxWorld/BentoBox/issues/519
2019-02-04 23:02:07 -08:00
Florian CUNY 5609a19765 Fixed tab-completion suggesting help more than once
Fixes #416
2019-02-02 14:04:53 +01:00
Florian CUNY fb34c54165 Minor code cleanup in CompositeCommand 2019-02-02 12:01:48 +01:00
tastybento 86c13fa60e Remove console debug. Improved comments and JavaDoc. 2018-12-24 21:10:49 -08:00
tastybento e5c69e42a6 Fixes bugs with CompositeCommand world setting.
Removes debug from previous commit.

Relates to https://github.com/BentoBoxWorld/BentoBox/pull/415
2018-12-24 20:49:43 -08:00
tastybento 17c087469b WIP - attempt at implementing GameModeAddon API
https://github.com/BentoBoxWorld/BentoBox/pull/415
2018-12-24 20:18:33 -08: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 b6230f2bdf ⚠️ removed CompositeCommand#setPermissionPrefix(String)
The permissionPrefix is now inherited from the addon's.
2018-10-27 16:42:29 +02:00
tastybento 3ebbcd87e8 Reworked POM to fix shading in of BStats. 2018-08-16 19:00:01 -07:00
tastybento b80928184e Fixed code smells. 2018-08-16 15:52:23 -07:00
tastybento 22121ad4f9 Fixed bug with sub command getAddon() inheritance. 2018-08-15 20:50:02 -07:00
Florian CUNY 539d2a0516 Fixed some code smells 2018-08-15 09:43:28 +02:00
tastybento 653e94e0b7 Made sub-class of CompositeCommand called ConfirmableCommand
This class inherits CompositeCommand and adds the confirming system.

It could be renamed Confirmable, like Bukkit has Cancellable for Events.
2018-08-14 11:43:21 +02:00
Florian CUNY 9d04aa376b Cleanup in CompositeCommand
Removed onlyConsole
Removed "showHelp" implementation
Removed deprecated setParameters
2018-08-13 21:03:24 +02:00
tastybento ec3e956d76 Enforced onlyConsole setting.
Removed extraneous test code method
2018-08-12 20:09:04 -07:00
tastybento 67dc4eedb3 Merge remote-tracking branch 'origin/develop' into command_ranks 2018-08-12 13:46:01 -07:00