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.