Commit Graph

42 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 977c82015b Rewrite. Tested with players. 2024-03-14 20:59:20 -07:00
tastybento f1001b1d05 Do not allow invite clicks if they have been removed from the panel 2024-01-11 18:13:43 -08:00
tastybento 0e0c502e1d
Team gui (#2251)
* WIP - add GUI for teams.

* WIP teams GUI

* Moe WIP on team GUI

* Modified file to avoid an NPE.

* Minor refactor to prevent int to Integer warning.

* Use latest dependencies for tests to pass.

* Move to singleton pattern for RanksManager,

* Team GUI WIP

* Added support for kick, setowner, and leave.

* Added support for accepting and rejecting an invite.

* Fixed bugs with text and operations.

* WIP for team invites.

* Adds inviting to the GUI.

* Fix tests

* Fixed minor bugs reported by SonarCloud

* Up Minecraft version and paper to 1.20.4 in POM

* Added features based on Discord feedback.

1. added some lore to the invite button to explain the players shown are
from the game world
2. removed the team state in chat
3. added a search to the invite panel

* Added back button.

Refactored some code and templates.

* Fixed bugs with teams and uncoop untrust etc of Ops.

* Return to name search GUI if name not found.

* Added return to GUI for player search

* Use Path.of
2024-01-08 20:50:26 +09: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 a0b349ec27 Complexity reduction 2023-07-15 16:27:31 -07:00
tastybento a6bb78c80f Refactor to reduce complexity 2023-07-10 22:25:30 -07:00
tastybento ca604f893c
Relates to #2104. Adds user.displayName() as a placeholder option (#2108)
* Relates to #2104. Adds user.displayName() as a placeholder option

* Fix test
2023-03-18 10:27:50 -07:00
tastybento 45f2dca414 Fixes max team size checks.
Fixes #2034
2023-02-12 12:08:38 -08:00
Huynh Tien 3e0368fbab
fix null on invitedPlayer (#1972) 2022-04-28 15:39:39 +03: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 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
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 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 dd3622cd23 Rank check was in the wrong place so the no-arg command could be blocked 2020-11-14 11:10:33 -08:00
tastybento ea4ef1e21a Adjusts tabComplete for a number of commands.
Enforces the need to type at least one letter for whole-server tab
completes.
2020-08-31 22:03:51 -07:00
tastybento c1ede3c66a Prevent invites to vanished players
https://github.com/BentoBoxWorld/BentoBox/issues/972
2020-08-31 20:59:11 -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 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
tastybento b29da53f43 Revert "Made BentoBoxCommand#setup() default (#1258)"
This reverts commit 7de842e284.
2020-04-07 13:38:44 -07:00
Florian CUNY 7de842e284
Made BentoBoxCommand#setup() default (#1258)
* Made BentoBoxCommand#setup() "default" and deprecated it

* Undeprecated BentoBoxCommand#setup() and changed its javadoc

* Put back setup in IslandGoCommand and IslandSethomeCommand

* Removed setup in AdminPurgeStatusCommand
2020-04-04 20:40:14 +02:00
tastybento 6e81af47b4 Adds explicit permissions to team commands (#1146)
https://github.com/BentoBoxWorld/BentoBox/issues/1144

Also fixes a bug where the untrust was using the coop perm.

Co-authored-by: Florian CUNY <poslovitch@bentobox.world>
2020-01-25 09:12:12 +01:00
Florian CUNY 3b0f023fac Fixed subcommands not inheriting permissions from parent commands (mostly admin commands) 2020-01-24 21:18:33 +01:00
tastybento aa5c253e03
Fix for double calling of events (#1111)
* Fixes tests for AdminSetrankCommand

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

* Fixes double calling of events.

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

* Makes AddonEvent static

https://github.com/BentoBoxWorld/BentoBox/pull/1111
2020-01-07 10:15:12 -08:00
tastybento bee960d823 Fixes invites.
https://github.com/BentoBoxWorld/BentoBox/issues/988

Adds test classes for IslandTeam command and redoes
IslandTeamInviteCommand test class.
2019-10-17 20:43:01 -07:00
tastybento 6f96f47ae5 Adds invites to trust and coop (#971)
Implements https://github.com/BentoBoxWorld/BentoBox/issues/800

* WIP

* Generic invites for team, coop and trusting.

Needs play testing.

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

* Fixed tests and added handling in trust and coop commands

* Completes invite, trust and coops command and tests.

* Minor documentation/settings improvements

* Renamed InviteType to Invite.Type

* Fixed compilation error
2019-10-13 09:28:49 +02:00
tastybento 65aee40533 Code smell cleanup 2019-07-27 17:19:04 -07:00
tastybento 060c602009
Makes command ranks a protection setting (#823) 2019-07-08 20:02:58 -07: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 f60a39a543 Fires team and island events. Adds new events.
A lot of the commands were not firing events. These events are now
needed by addons.

Added new JOINED, REGISTERED, UNREGISTERED reasons for events.

Switched to using Bukkit.getServer() instead of plugin.getServer() in a
number of classes because the former can be mocked but the latter cannot
be because it's marked as a final method in JavaPlugin.
2019-02-02 20:40:44 -08:00
Florian CUNY 3ef784b14b Fixed max team size permission not working
Fixes #114.
2018-12-09 14:52:38 +01:00
Florian CUNY 37cb96f586 Fixed [label] text variable being replaced by "invite" in the invite notification
Fixes #315
2018-10-28 17:03:42 +01:00
Florian CUNY 95bfab916e Replaced Util#getPermValue(Player, String, int) with User#getPermissionValue(String, int) 2018-10-20 11:32:42 +02:00
Florian CUNY 02be048192 Removed "general.errors.unknown-player-name" : added a "[name]" textvariable in "general.errors.unknown-player"
Closes #263
2018-09-15 10:39:16 +02:00
Florian CUNY 24d783be24 Cleanup in Settings
Removed purge-related settings.
Renamed all database-related settings and methods to replace `db` with `database`.
Moved confirmationTime to `island.confirmation.time`.
Renamed inviteWait, banWait and resetWait to inviteCooldown, banCooldown, resetCooldown. Also moved them under `island.cooldown.x`.
Removed kickWait and leaveWait, using confirmationTime instead.
Moved `island.require-confirmation.<command>` to `island.confirmation.commands.<command>`.
Updated tests.
Updated getters and setters using code automation. Sadly, this wiped out all the Javadoc.
2018-08-31 11:06:37 +02:00
tastybento c1a6a233a9 Added team coop, uncoop, trust and untrust commands. 2018-08-12 16:43:47 -07:00
tastybento d44889e7b0 Added command rank settings and extra ranks. 2018-08-11 21:08:04 -07:00
tastybento 67ab937b97 Revert "Removed useless #setDescription() and #setParameters() in commands"
This reverts commit 0e8e9dde67.
2018-08-10 13:47:58 +09:00
Florian CUNY 0e8e9dde67 Removed useless #setDescription() and #setParameters() in commands 2018-08-09 11:56:05 +02:00
tastybento 765268aa25 Code cleanup using Intellij 2018-08-04 21:50:10 -07:00
tastybento 783caf985f Added generic cooldown methods to CompositeCommand
This API enables any command to have a cool down and to have that cool
down called by another command. For example, the Kick command sets the
cool down on the Invite command. It is possible for commands to set cool
downs on themselves too.
Currently, cool downs are not stored persistently in the database so
they disappear if the server is reloaded. This should be okay for now.
2018-08-04 18:45:13 -07:00
tastybento 3c74ef0694 Moved admin and island commands into API package 2018-08-02 19:26:46 -07:00