Commit Graph

29 Commits

Author SHA1 Message Date
tastybento 1215a43766 Add feature to limit blueprint availability. 2024-03-31 17:29:18 -07:00
tastybento 056cff4b6f
Code clean up from Sonar Cloud analysis (#2068)
* 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
2022-12-31 16:41:17 -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
tastybento 7277432c41 Preveent NPEs and other items. 2021-11-12 15:39:52 -08: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 b906f5561a
Hex pr 1820 (#1822) 2021-08-19 12:09:23 -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
apachezy 0f0d8b9ebc
Added LangUtils support. (#1693) 2021-03-12 20:04:34 -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 a07676ac05 Allow default blueprint bundle to have a friendly name change in the GUI
https://github.com/BentoBoxWorld/BentoBox/issues/1543
2020-10-09 14:51:21 -07:00
Florian CUNY 01df19c424 Slightly improved the Blueprint Bundle Editor panel
Added icons for world's dimensions, and made the "separator" glass panes have an empty name instead of a '-'.
2020-01-18 11:24:50 +01:00
Florian CUNY 44354175e4 Moved world dimensions names to 'general.worlds' in en-US 2020-01-18 11:21:11 +01:00
tastybento 25ad177aca Translate colors for blueprint descriptions.
https://github.com/BentoBoxWorld/BSkyBlock/issues/213
2019-11-02 17:09:47 -07:00
tastybento c2f2be61c3 Translate alternate colors codes for BBundle descriptions 2019-11-02 17:04:32 -07:00
tastybento d6248a3577 Fixes code smells. 2019-06-23 19:13:00 -07:00
tastybento acb7c1fc76 Merge branch 'develop' of https://github.com/BentoBoxWorld/BentoBox.git
into develop
2019-06-15 22:10:25 -07:00
tastybento f50e59eef1 Fixed right click not clearing blueprints in management panel
Fixed NPE if a bundle does not have an end or nether bp.
2019-06-15 22:09:17 -07:00
Florian CUNY 07be933a9d Fixed some code smells 2019-06-15 22:56:57 +02:00
tastybento 5a6b1862a0 Added Island Creation Panel Test.
Fixed bugs with slot management.
2019-06-02 16:49:20 -07:00
tastybento 40f0591f7a Enables blueprint bundle slot positioning in GUI
https://github.com/BentoBoxWorld/BentoBox/issues/708
2019-06-02 15:52:27 -07:00
tastybento 94e90257fa Adds renaming and icon setting to the Blueprint Management panel
https://github.com/BentoBoxWorld/BentoBox/issues/701
2019-05-26 22:03:09 -07:00
tastybento 5acae3ff30 Fix instruction localization. 2019-05-26 19:41:57 -07:00
tastybento 2a1ce5eafa Added Blueprint Bundle renaming 2019-05-26 19:40:13 -07:00
tastybento 0fd25f02cd Fixes pasting of blueprints with crops, etc.
https://github.com/BentoBoxWorld/BentoBox/issues/702

Also fixes pasting of entities in the ground when they are on blocks
like crops that are slightly less than an integer block high.
2019-05-26 16:07:50 -07:00
tastybento 9e36865a9f Fixed some code smells (#698)
* WIP code clean up and code smell removal

* Tried to fix a few more code smells
2019-05-26 22:14:24 +02:00
tastybento 184a5712ae Fixes bugs with Blueprint locale.
Ensures newly saved Blueprints appear in blueprint manager.
2019-05-24 19:42:51 -07:00
tastybento 6024423dad Blueprint manager localization - WIP 2019-05-22 12:16:38 -07:00
tastybento 4c16b0d779 Implement Blueprint Bundles GUI (#691)
* WIP Blueprint GUI

* Basic implementation. Still WIP.

Needs to enable description adding.

* Added description entry for blueprint bundle.

* Readded maven-javadoc-plugin
2019-05-20 08:18:24 +02:00
tastybento 700043fe40 Implemeted Blueprint bundles and blueprints (#672)
* A prototype for Blueprint bundles and blueprints

This stores blueprints inside bundles. Each bundle can have up to 3
blueprints defines by the World.Environment.

This is not a finished manager. It just handles all the saving and
loading side of things. I thought this would help you so you can then
concentrate on the UI.

* WIP: Copy blocks to Blueprint done.

* WIP Pasting done.

* WIP: Added BlueprintsManager to ultimately replace SchemsManager.

* Moved blueprint suffix and changed to .blu

* Fixed unit test.

* Now tested and working.

Integrated with new island and resetting island.

If there are no blueprint bundles or blueprints then a default bedrock
set will be made and put in the game mode addon's blueprints folder.

Still to do: enable schems to be loaded and pasted for legacy support.
Add blueprints and a bundle to GameModeAddons like BSkyBlock.

* Renamed most of the classes

* Cleaned up clipboard and paster.

* Further cleanup on blueprint clipboard and paster.

* Merged blueprint classes into one package.

* Put Blueprint data objects in their own package.

Isolated schems classes for later removal.

* Renamed admin command classes and changed locale files.

* More clean up to remove schems

* Schem to blueprints converter done.

Converts schems to blueprint bundles and sets up a default set. Tested
the happy-path. Need to do more testing on edge cases.

* Added basic UI for development. Fixed bug with schem conversion.

* Adds permissions into the blueprints.

Fixes tests, cleans up some naming

* Added IslandCreationPanel and created BlueprintManagementPanel

* Fixed JSONDatabaseHandler's constructor being public

* Made the Blueprints button in ManagementPanel open the Blueprint management panel

* Fixed tests and ignored one (NPE)
2019-05-15 20:16:41 +02:00