* 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
Enable Tab object to reference parent TabbedPanel in the builder. It is
late assigned after building. This enables tabs to get the parent, and
therefore get the Island object.
default methods were used to support backward compatibility.
Spigot JavaPlugin#saveResources either replaces or complains that replacement is disabled. So it is necessary to check if file does not exists before saving it.
Fixes#2259
* Fixes ItemParser.
Implements new Potion and Skull parsing.
Fixes custom model data parsing.
Implements ItemFactory#createItemStack parsing that parses item using `/give` syntax.
Solves some issues mentioned in #2198
* Fixes failing BentoBoxLocaleTest
In runTime ItemFactory#createItemStack from invalid text would throw IllegalArgumentException.
JAR files does not store files inside it with filesystem separator. Only spot where it makes sense to transform "/" into file separator is in output file saving.
* Customizable Island Creation Panel
This implements customizable Island Creation Panel. By default, panel is generated in `/plugins/bentobox/panels` folder, however, if GameModeAddon has a specific panel defined in their folder, then that panel is taken.
* Create UnitTests for new panels
* Add island creation panel saving on loading
* Remove old IslandCreationPanel and move to the new one.
* Fixes some issues with locale and panel
---------
Co-authored-by: tastybento <tastybento@users.noreply.github.com>
* Customizable Language Selection Panel
This implements customizable Language Selection Panel. By default, panel is generated in `/plugins/bentobox/panels` folder, however, if GameModeAddon has a specific panel defined in their folder, then that panel is taken.
* Migrate LanguagePanelTest to customizable panel.
* Remove original LanguagePanel
* Save language_panel.yml on server starting.
* Fixes some bugs in LanguagePanel.
* Adds an ItemAdder hook to delete any blocks when island is deleted.
Also includes a flag for explosions.
* Make the error reporting method non-abstract.
This is not a mandatory method for many hooks.
* Delete this class as it is not used any more and just duplicate.
* Added test class.
* Minor issues resolved.
The obsidian platform was not generating constantly in the same spot. It was moving depending on the entrance point (from the sides).
This code changes it, as it will move through relative blocks.
Also, this change will sync portal and platform center points, which was not done previously.
Fixes#2239
The addition of a null check in the Enchantment Bukkit code causes a lot
of test failures. While we work out how to mock that particular area,
this code avoids running Enchantment code when under test.
There was a bug in the code that prevented to finding of a portal location if the player entered from the side.
It can happen only if the portal frame is removed, but as in vanilla it is possible, then it needs to be addressed.
The fix itself is simple: instead of checking just up from the starting location, the code will check all blocks in 10x10x10 square from the starting location and find the "closest" portal location.
This will fix#2237
There was a bug that used old code (environment switching) for teleportation out of dimension.
The issue should be fixed with calling just calling teleportation with portal environment.
* 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.
* Put ranks in the database. Prework for #1798
* Prevent coop and trust commands from being registered
if those ranks don't exist.
* Add /bbox rank command for ranks management
* Rename RanksObject to Ranks
* Strip / on commands if it exists. Fixes#2221
* Fix test failure
There was incorrect teleportation type detection, as target world were set to NORMAL. This prevented to detect that portal in opposite side exists, and should be linked to the correct position.
* Fixes a bug that removed old owner from island
These changes fix a bug that was introduced by clearing the island cache from the old owner for 2.0 verison.
This will set the previous owner as sub-owner on the island.
* Fixes rank on event fired.
Changes from Visitor to Sub owner rank
* Update IslandsManager.java
Removes line that removes player from cache.
They should remain in the cache.
---------
Co-authored-by: tastybento <tastybento@users.noreply.github.com>
Potions are no longer extended or upgraded using the deprecated
PotionData. They have explict names, like "long_night_vision" or
similar. So these tests don't work any more.
The world was not being used for the getOwner return so if a player had
an island in any world then it was returned. This caused an NPE if the
island was then requested by getIsland because it would not be there.
* 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
It used to work, but now doesn't. I've tried updating various plugins
and trying different things, but it seems that the mocking is not
working correctly. I don't know why.
* Fixes incorrect element displays in pages 1+.
The issue was introduced by #585f720f6f4a7e9480af5065469c92e23e5a987e which reduced complexity too much.
Fixes#2177
* Reformat and reduce complexity properly.
* Rework logic for getting number of same button types in the panel
* Add more comments.
* Add proper deprecated annotation.
The SimpleWorldRegenerator generated world new chunks that were not generated before.
It is not necessary, as regeneration should happen only on used chunks.
* Implements NMS for pasting and supports older versions of server
* Remove trial code that shouldn't have been committed.
* Remove trial code that shouldn't have been committed.
* Remove 1.19.3 support.
* Use 1.19.4 in POM
This solves the issue in customizable GUI's where variables are defined directly into the panel button name and description instead of providing the link to the locale.
Not all users want to specify all text into a locale, and they would not get parsed variables just because of that.
This change fixes it and it does not give any bad situations even if the reference is just missing text in the locale, as there will be nothing for parsing.
* Remove 1.18.2 from supported version list.
1.18.2 support was removed with changes in commit 056cff4b6f
Also, mark 1.19, 1.19.1 and 1.19.2 as incompatible. It happens because of GSon library changes that prevents bentobox compiled with Spigot 1.19.3 to run on older versions.
* Fixes GSON crashes introduced by migrating to 1.19.3 api.
Mostly replacing instanceof check and cast with e.g. 'instanceof Player
player'
Replaced some "switch" statements by "if" statements to increase
readability.
Used the primitive boolean check to avoid potential NPEs.
Reordered field modifiers to comply with the Java Language
Specification. Mainly @NonNull position.
* Code clean up from Sonar Cloud analysis
* Fix tests
* Remove code smell
* Rename "island" which hides the field declared at line 25.
* Removed code smells.
* Rename variable record to rec
Renamed "record" variable to not match a restricted identifier.
Restricted Identifiers should not be used as identifiers. "record" is
using in Java 16.
* Added private constructor to prevent instantiation of static class
Changed variable name to rec instead of restricted "record".
* Remove Blueprint code smells.
* Use a record for database settings constructor
Code smell: Methods should not have too many parameters. I'm not sure
what methods are using this class though.
* Update MyWorlds version
The POM for MyWorlds is invalid and causes a warning, but this still
persists with this version.
* Extracted nested try block into a separate method.
Makes it clear when reading the code what might be caught
* Extracted nested try block into a separate method.
* Fixed JavaDoc /** instead of just /*
* Extracted nested try block into a separate method.
* Refactored to not assign loop counter from within the loop body.
* Better delete option. With results.
That said, this is legacy code to handle an issue that occurred a long
time ago and this whole set of code can probably be removed.
* Catch Exceptions not Throwable
* Log error with BentoBox logError
* Use computeIfAbsent
Using these instead leads to cleaner and more readable code.
* User can no longer be null
* Added the missing @Deprecated annotation and @since ref
* Added @since reference
* Merge if statements
* Use BentoBox error logging.
* Added JavaDoc @since
* Remove deprecated class and move used class
* Remove deprecated WoodType and use Type.
* Remove unused import
* Extracted nested try block into a separate method.
* Comment empty default statement
* Clean up logic; avoid switch
* Use Java instead of Guava
* private constructor to hide the implicit public one.
* Private constructor to hide the implicit public one.
Merged if statement.
* Add comment
* if merge
* Make variable constant
* Remove unused imports
* Remove deprecated and unused method
* Remove unused import
* Typo
* Remove instanceof and cast
* Remove superfluous null check
* Put constant at bottom of file because @BONNe likes it there.
* Simplify particle validation code
* Fixes#2046. Handles null players for placeholders.
* Remove unused import
* Fixes#2049 for adjacent island spaces
This also deletes blocks in the event rather than setting them to AIR as
was done previously.
Addresses #2058
We already have a option to protect against hostile mobs when logging in
or teleporting, but not respawn. This adds protection to that. Admin can
turn off the option if they want it more hard core.
In theory, this should not be required, but it seems that a player's
world might be null in some edge cases. Alternatively, the Util.getWorld
function can return a null if the player was in a nether or end but that
does not have a corresponding overworld.
Addresses #2057
Superflat was not working properly. It was always clearing just 1 (first) chunk because it referenced the chunk from the first event that created the clearing task.
The issue should be fixed.
In 1.19 worlds it was fixed that super-flat worlds are generated at min-height, instead at 0.
This change keeps the previous super-flat chunk generation until 1.18 is dropped.
The end portals and gateways teleports players to a different dimension upon player touches it. So teleportation should consider these positions as unsafe, otherwise player will be teleported to the different dimension instantly.
Fixes#2040
This change switches from plain JDBC driver implementation to a HikariCP Pool implementation.
Pool Implementation is complete for PostgreSQL and SQLite, while MariaDB and MySQL implementation still uses JDBC drivers, however with HikariCP pools.
Also, I added extra properties for SQL databases, where users could specify their own datasource properties.
Teleportation via portals for entities was in a mixed state. It was not fully implemented and not fully prevented. Especially when portal linking was enabled.
Now I implemented world settings flag: ENTITY_PORTAL_TELEPORT.
Enabling this flag will allow entities to use portals to switch dimensions.
Fixes#2023 and #966
When players will exit the end-gate, they will be teleported to proper island, instead of world spawn point.
The only way how players can be teleported to the spawn is if they do not have islands.
I reworked the classes and some teleportation operations. Now teleportation should find the closest available spot, instead of always being the highest block at original Y location. Part of #1994.
Also, I fixed an issue that portals stopped working if some conflicting options were enabled. Now portals will not work only if nether is disabled in config.
* Fixes issue when blueprint clipboard was stuck after saving.
The issue was that Map#putIfAbsent still creates a new task, even if object is already in map. The usage requires to use Map#computeIfAbsent.
* Rework blueprint and blueprint bundle names.
There was an issue with using non-english characters in blueprint names. It was not possible, as all chars for names were converted to lower cased english letters. It included display names.
I reworked it a bit and now it should be possible to set non-english names for bundles and blueprints.
Fixes#1954
* Adds ProtectionBoundingBox for environment
Since minecraft introduced different island heights for different dimensions, protection bounding box were returned wrong area for nether and end dimensions.
This change adds a new method that allows to get proper protection bounding box for requested dimension.
Due to the fact, that nether and end islands can be disabled, then this method may return null.
Fixes#2014
* Adds BoundingBox for environment
Since minecraft introduced different island heights for different dimensions, bounding box were returned wrong area for nether and end dimensions.
This change adds a new method that allows to get proper bounding box for requested dimension.
Due to the fact, that nether and end islands can be disabled, then this method may return null.
Part of #2014
* Fixes Island#onIsland check for non-island worlds
Island#onIsland method was missing checks if island mode is enabled for requested dimension. It returned false positive situations in cases when island generation were disabled in nether or the end worlds.
* Fixes Island#inIslandSpace check for non-island worlds
Island#inIslandSpace method was missing checks if island mode is enabled for requested dimension. It returned false positive situations in cases when island generation were disabled in nether or the end worlds.
* Adds some helper methods in Island object.
- Island#getNetherWorld - returns the nether world or null
- Island#getEndWorld - returns the end world or null
- Island#getWorld(Environment) - returns world of requested environment or null
- Island#isNetherIslandEnabled - returns if nether is generated and nether islands are enabled.
- Island#isEndIslandEnabled - returns if end is generated and end islands are enabled.
The commit was wrong. Protection range should not be decreased, as that would mean that max X and Z blocks are not included in island protection bounding box.
This change is the same as 3c65194dfb but was missed when it was fixed.
Relate to #473
* Check if unique name contains chars not supported in regex expression
Cannot start, contain, or end with special char, cannot contain any numbers.
Can only contain - for word separation
* Negation fix
* Implements option to define non-existing flags in WorldSettings.
This change adds 2 new methods in WorldSettings:
* WorldSettings#getDefaultIslandFlagNames
* WorldSettings#getDefaultIslandSettingNames
These methods replace getDefaultIslandFlags and getDefaultIslandSettings methods.
Default implementation just reads values from replaced methods.
Fixes#1830
* Implement conversion from flag id to actual flag object.
Replaces flag assignment to new island based on flag id's.
Fixes#1830
* Switch from Flag object to String object in Island class.
This switch allows to keep flags that are not present in current BentoBox installation. Otherwise, unknown flags may cause an issues.
Fixes#1830
* Implement FlagBooleanSerializer.
This serializer converts input map of String, Boolean to map of String, Integer.
This map is used to read island setting flags, and integer value is not classic boolean values. (0 for true and -1 for false).
Fixes#1830
* Move to new EngineHub maven repository
* Remove unused WorldEdit dependency
* Use Java 17 in GitHub Actions
* Also change maven-compiler-plugin and maven-javadoc-plugin versions to 17
* Implements new VISITOR_TRIGGER_RAID flag.
This world settings flag allows toggling if visitors can or cannot start a raid on an island they are visiting.
Relates to #1976
* Fixes abuse of Raid Mechanism and Mob Natural Spawn Rules.
Fixes to #1976
* Simplify raid abuse detection.
Spigot in 1.18 introduce new way how block particles should be displayed. However, BentoBox never fully implemented it.
To avoid such issues in-future, I added checks for each particle type that requires extra data object.
Fixes#1989
* Update to Spigot and Paper API 1.19 and Java 17
* Set minimal version to 1.18.
* Add breeding protection for Axolotl and Goats (1.18)
Add breeding protection for Frog and Allay (1.19)
* Clean up switch statement in BlockInteractionListener
* Add chest boat support to BreakBlocksListener.
Part of #1987
* Add powdered snow pickup with bucket protection.
* Add glow ink sac protection on signs.
Switch to SheepDyeWoolEvent as it now contains player variable.
* Clean up Hurting Listener
* Mark 1.16.5, 1.17 and 1.17.1 as incompatible.
Mark 1.18, 1.18.1 and 1.18.2 as supported.
Add 1.19 as compatible.
Part of 1987
* Add ChestBoat inventory protection.
Part of #1987
* Clean up LockAndBanListener
* Add MANGROVE_PRESSURE_PLATE protection.
Part of #1987
* Add Glow Item Frame protection to player interact event.
* Clean up MobSpawnListener
* Clean up ChestDamageListener
* Change from custom method to Tag.PRESSURE_PLATES to detect pressure plates.
Part of #1987
* Implement proper chest boat protection.
Part of #1987
* Move to 1.19 R1 world regenerator.
Part of #1987
* Add allay to the animal entity list.
Part of #1987
* Add axolotl and other fish scooping protection.
Part of #1987
* Fixes Bucket and Glass Bottle filling.
Buckets and bottles were not working since cauldron splitting by type. This change fixes that.
It also protects from filling bottles with water from water sources or waterlogged blocks.
* Remove 1.17.1 compatibility check for biome adapter.
Add cheezee 1.19.1 compatibility version.
* Fixes chest boat interactions.
Part of #1987
* Implement Allay protection.
New flag ALLAY is required to interact with allays.
Part of #1987
* Prevent visitors for being targeted by entities if ENTITY_ATTACK is enabled.
* Implement Sculk Sensor and Shrieker activation protection setting.
Part of #1987
* Add music discs to the LangUtilsHook
Part of #1987
* Fixes failing unit-tests.
* more abstract on Paster
* comment and stuff
* How about Impl
* ok, PasteHandler
* PasteUtil
* don't check other BlockState if there is one matched
* world as an argument
* forgot the impl
* createBlockData from BlueprintBlock
* fix remaining conflicts
Co-authored-by: tastybento <tastybento@users.noreply.github.com>
* more abstract on delete chunks
* update NMS to 1.18.2
* at most abstract, requires only the island and the world
* it's weird that we can't use whenComplete
* rename to WorldRegenerator
* Version 1.20.1
* Added name of the addon causing the issue.
https://github.com/BentoBoxWorld/BentoBox/issues/1944
* Use world min-height for island bounding box.
* Fixes a bug when fallback could not use reusable
There was an issue in PanelItemTemplate that prevented fallback buttons to be "reusable" things.
The issue was that reusable items were not passed to the panel item reader.
* Adjusted test to try to avoid errors
* Fix for random test failures.
* Added 1.18.2 support
* Address unnecessary PVP reports on each teleport (#1948)
If a player is teleporting on the same island in the same dimension, it keeps spamming that PVP is enabled in dimension.
It should be enough with sending messages when the player teleports to the island.
Fixes#1885
* Fixes bug with Safe Spot Teleport (#1951)
There was a bug that prevented finding a safe spot if all valid blocks were in height with the `startY` location.
Reported via discord.
* Fix Exception error reported by IDE
I am not sure why Eclipse is saying this is an error.
* Fix for kicking offline players
https://github.com/BentoBoxWorld/BentoBox/issues/1950
* Add an option in SafeSpotTeleport to cancel if fail (#1952)
There was no option to cancel teleportation if SafeSpotTeleport could not find a valid spot. This option could be used to avoid creating "backup" blocks in situations when teleportation is avoidable, f.e. visiting an island.
* Replace peplaceAll with replace
It does the same thing if the first argument is not a regex.
* Use constants for common strings
* Use constants for common strings
* Go back to replaceAll
This is required.
* Clearer paster (#1953)
* WIP - make easier to understand.
* Small refactor of paster to make it easier to understand
* Fix tabs to spaces. Sorry - new editor!
* Fix tabs to spaces
* Fix tab to spaces
* Improve team kick command (#1957)
The kick command has an unnecessary owner check. As command should be configurable by island owners, then limiting it to an owner is wrong.
Add a code that allows kicking only lower-ranked players.
Add message that shows who kicked from the island.
Add message that shows that rank does not allow to kick.
* Solve crashes with Addon#allLoaded call (#1959)
If some addon has code in Addon#allLoaded that crashes the call, then it did not disable addon as well as did not call allLoaded for every other addon that was left in the list.
This should be solved by adding an extra try-catch.
* using java 16 syntax (#1958)
* Fixes kick command (#1960)
PR #1957 broke kick command and noone could kick players from teams.
This should fix it.
* Fixes a bug with blueprint height (#1961)
Blueprint clipboard was preventing setting Y below 0 or above 255.
The code was not adjusted to 1.18 changes.
Reported via discord.
* Fixes Lava Duplication Glitch (#1964)
Due to the fact, that Obsidian Scooping uses one tick delay to remove obsidian, a player with a bucket in hand and offhand duplicated lava.
To avoid that, added an extra check that ignores the interact event if a player holds a bucket in both hands, and interacted hand is offhand.
Fixes#1963
* Fixes failures in obsidian cooping listener. (#1965)
Failures happened after implementing #1964
Co-authored-by: BONNe <bonne@bonne.id.lv>
Co-authored-by: Invvk <70810073+Invvk@users.noreply.github.com>
Due to the fact, that Obsidian Scooping uses one tick delay to remove obsidian, a player with a bucket in hand and offhand duplicated lava.
To avoid that, added an extra check that ignores the interact event if a player holds a bucket in both hands, and interacted hand is offhand.
Fixes#1963
If some addon has code in Addon#allLoaded that crashes the call, then it did not disable addon as well as did not call allLoaded for every other addon that was left in the list.
This should be solved by adding an extra try-catch.
The kick command has an unnecessary owner check. As command should be configurable by island owners, then limiting it to an owner is wrong.
Add a code that allows kicking only lower-ranked players.
Add message that shows who kicked from the island.
Add message that shows that rank does not allow to kick.
* WIP - make easier to understand.
* Small refactor of paster to make it easier to understand
* Fix tabs to spaces. Sorry - new editor!
* Fix tabs to spaces
* Fix tab to spaces
There was no option to cancel teleportation if SafeSpotTeleport could not find a valid spot. This option could be used to avoid creating "backup" blocks in situations when teleportation is avoidable, f.e. visiting an island.
If a player is teleporting on the same island in the same dimension, it keeps spamming that PVP is enabled in dimension.
It should be enough with sending messages when the player teleports to the island.
Fixes#1885
There was an issue in PanelItemTemplate that prevented fallback buttons to be "reusable" things.
The issue was that reusable items were not passed to the panel item reader.
This change implements a new way how to define actions via a custom panel template.
Previously there were 2 options how to define an action:
- by click-type
- as an array list
This adds the third type: by action type. It means that now developers could code that action is the main key for defining what happens when button is clicked:
```
actions:
visit:
click-type: LEFT
tooltip: Tooltip text for left click action
```