Commit Graph

18 Commits

Author SHA1 Message Date
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 8eb45e817c Code smell reduction 2021-09-18 08:15:15 -07:00
tastybento 23857501f5
Static code analysis (#1844)
* StringBuffer (Java 5) may be declared as StringBuilder

* Replace map with flatMap

* Use instanceof naming

* No need to specify paramter types.

* Remove verbose code

* Fix JavaDoc issues

* Make internal class a record.

* Remove unused import.

* Make internal class a record.

* Made internal class a record.

* Removed unused import

* Fix typos

* Fix typo in test.
2021-08-29 18:17:38 -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 0e10563ae6 Explicitly use UTF-8 when scanning file for YAML comments
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1372
2020-05-27 16:32:20 -07:00
tastybento fe58159db3
Adds saveObjectAsync with a CompletableFuture return for databases (#1308)
Deprecates the saveObject() method
2020-04-26 01:00:49 +02:00
tastybento ad33d7fc9d Added a stack trace for this error handling. 2019-09-20 11:57:41 -07:00
tastybento edd7bbf97a A lot of database work.
Database closing was occuring too early. In priort releases it was
hidden because the connection would be automatically made again. When
this was removed, it exposed this error.
Now the single database connection will not be closed until all
registered database objects have finished with their async queues.

Further, the database connecter was being made once for each database
type. This was a waste of resources and it also meant that static fields
were being used. Now, only one database connecter object is made and
there are no static fields.

https://github.com/BentoBoxWorld/BentoBox/issues/813
2019-07-05 20:11:06 -07:00
tastybento b1f66eb31b Fixes bugs and code smells from Sonarcloud. 2019-07-04 16:54:05 -07:00
Florian CUNY 5dcec3ee1b Improved some documentation and added some nullability annotations in database code 2019-06-22 09:43:32 +02:00
tastybento bce17ce467 Added admin trash command to handle damaged island db (#546)
* WIP - adds admin commands to handle damaged island db

Trash, purge, etc.

DO NOT MERGE YET

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

* Prefixes the island uniqueId with the game mode name.

This enables manual removal of old game mode island files from the
database by admins if required.

* Adds Admin trash and empty trash commands

* Adds various commands for trash management

* Remove unused imports

* Forgot the javadoc in IslandsManager
2019-02-17 13:32:05 +01:00
Florian CUNY 93deee7c13 Fixed code smells 2019-02-06 16:06:03 +01:00
Florian CUNY 2a66598d2f Fixed bugs/vulnerabilities in YamlDatabaseConnector#removeStringFromFile(File) 2019-01-27 09:43:14 +01:00
tastybento db932dd836 Fix for LogEntry serialization.
https://github.com/BentoBoxWorld/BentoBox/issues/486

Includes an autofixer for corrupted files and test for the adapter.

LogEntry was changed to just store strings instead of arbitrary types.
Unless the log serializer were to store hints as to what type of data
was being stored, it is impossible to deseralize. To make it all
simpler, we just store strings. If the UUIDs need to be converted back
to players are some point, that can be done based on the type of the log
stored.
2019-01-26 15:32:52 -08:00
tastybento 7854187448 Added async saving to YAML and MYSQL
Both seem to work fine, but probably need more real-world testing.
2019-01-12 18:18:22 -08:00
Florian CUNY 5b97d16a2d Made each DatabaseConnectors's constructors package-private 2018-10-29 20:55:18 +01:00
Florian CUNY bf506a49b2 Fixed some code smells 2018-10-28 17:15:13 +01:00
Florian CUNY e8ba1805a5 Renamed FLATFILE databasetype to YAML 2018-10-28 16:51:38 +01:00