Commit Graph

140 Commits

Author SHA1 Message Date
Rsl1122 8870e034e1 All database transactions are now performed by a single thread.
- Added a Database Access Lock object
  - Access log lets OperationCriticalTransactions through
  - Transactions skip query access log check
  - executeTransaction returns a Future to allow easier synchronization
  - ServerInfo waits for the server to be registered. This could lead
    to issues if a new server is registering to old database. It should
    not be too big of an issue since no patches need to be applied
    on first enable of the database.
- Added database states: CLOSED <-> INITIALIZING -> OPEN -> CLOSED

These two changes allow restricting queries to the database until the
database has properly initialized (Schema is in correct format)

- Removed SQLDB as a Patch class variable

Tests use Guava direct thread executor on the database to reduce
concurrency issues during tests. Another option would be to wait for
each transaction.
2019-02-16 20:26:08 +02:00
Rsl1122 57695d6e43 Created SessionEndTransaction:
- Removed SaveOperations#session
- Removed DBSystem dependency from SessionCache, so SessionCache does
  not need to be called from async thread. (SessionCache does not save,
  responsibility now with the caller)
2019-02-16 14:29:19 +02:00
Rsl1122 029c1378f3 [#746] Made Server UUID generation random
- Refactored ServerInfo classes a bit in this commit, made them use
  Optional<Server> instead of Optional<Integer> (server id)
- Removed all uses of FetchOperations#getServerId
2019-02-16 14:28:59 +02:00
Rsl1122 f0f32f3ec4 Refactored ServerTable#saveCurrentServerInfo to a transaction 2019-02-16 14:28:58 +02:00
Rsl1122 af674919e7 Refactored TPSTable#insertTPS to a transaction:
- Removed TPSInsertProcessor
2019-02-16 14:28:27 +02:00
Rsl1122 95d14ed73f Rename DataCache to NicknameCache:
- Some errors were encountered with removal of DataCache,
  turns out if a dependency that has dagger modules that use some
  class, a compile error occurs.
  Thus the DataCache class was left in place until the uses are
  removed from the PluginBridge.
2019-02-16 14:28:23 +02:00
Rsl1122 5b3d687a60 Refactored PingTable#insertPing to a transaction 2019-02-16 14:28:20 +02:00
Rsl1122 feaf7849d2 Refactored UsersTable#registerUser to a transaction:
- Removed ProxyRegisterProcessor
- Optimized name updating to occur on login instead of chat events
  - This removes the need to store player names in the DataCache.
2019-02-16 14:28:14 +02:00
Rsl1122 cb22c0f80a Refactored GeoInfo storage into a Transaction:
- Refactored GeoInfoTable#saveGeoInfo into queries
- Removed IPUpdateProcessor
2019-02-16 14:28:07 +02:00
Rsl1122 062ab088b3 Refactored ServerTable#getBukkitServers to queries:
- New query for finding a single server in OptionalFetchQueries
- New query for all servers in LargeFetchQueries
- isProxy and isNotProxy methods to Server class
- Renamed ConnectionSystem bukkitServers to dataServers

This increases some boiler plate java code in some places, but reduces
it in others. This will help with saving Velocity with it's appropriate
name in the future.
2019-02-16 14:26:37 +02:00
Rsl1122 ef85cf942a Move DBType & Database related classes:
system.database.databases -> db
system.database.databases.sql -> db

- DBType
- Database
- SQLDB
- H2DB
- MySQLDB
- SpongeMySQLDB
- SQLiteDB
2019-02-16 14:26:18 +02:00
Rsl1122 beebc4ca01 [#891] Empty world name no longer in Bungee sessions 2019-01-19 13:02:56 +02:00
Rsl1122 8edc621761 Task for network to update configs in database on boot 2019-01-12 13:25:01 +02:00
Rsl1122 e5138d8ec7 [#874] Fixed config read case when key is empty 2019-01-08 17:28:20 +02:00
Rsl1122 a59e5d65ea Fixed "async task can't be called from server thread"
This exception occurred at least on Bukkit.
2019-01-08 11:18:10 +02:00
Rsl1122 e7b9147042 Removed uses of ThreadRunnableFactory in tests 2019-01-06 13:48:38 +02:00
Rsl1122 ff266893d1 More tests against issues found during manual testing
During testing it was found that:
- MySQL patches are still failing if they failed before (test_sessions
  has foreign keys)
- Time.Thresholds.AFK_threshold was empty on fresh install (Leading to
  NPE that was prevented)
2019-01-04 17:09:28 +02:00
Rsl1122 dd904b84fc Updated missing or outdated license headers 2019-01-03 13:12:19 +02:00
Rsl1122 1773dd6b97 Fixed BungeeSystemTest on systems with mysql installed 2019-01-02 16:55:37 +02:00
Rsl1122 0d587f527e Fixed BungeeSystemTest#testEnableNoMySQL:
- Moved the condition to the correct place this time
2018-12-27 19:13:53 +02:00
Rsl1122 26c706a411 Fixed BungeeSystemTest#testEnableNoMySQL
Test was failing because travis runs MySQL on 3306 port with root user,
these were default Plan settings. Fixed by removing message expectation
on travis
2018-12-27 19:05:56 +02:00
Rsl1122 4641c7a4fd Fixed BungeeSystemTest#testEnableNoMySQL
Test was failing because travis runs MySQL on 3306 port with root user,
these were default Plan settings. Fixed by changing port to 6000 in the
test
2018-12-27 19:00:42 +02:00
Rsl1122 3d65e8c745 Unignored 2 BungeeSystem tests
- Caught a PoolInitializationException in MySQL to throw EnableException
  properly.
2018-12-27 18:51:11 +02:00
Rsl1122 c68c95a608 Removed NetworkSettings and ServerSpecificSettings 2018-12-24 12:01:41 +02:00
Rsl1122 a64336803f Bunch of things:
- IntelliJ Inspection fixes.
- Removed some unused code
- Added ConfigNode#getStringMap
- Removed usages of ConfigNode#getChildren
2018-12-20 13:50:40 +02:00
Rsl1122 4c7636b0c2 Removed Maven configurations (poms) 2018-12-19 19:14:06 +02:00
Rsl1122 51eb37c382 Fixed gradle shadow issues
Now relocation works, the relocated items were not being depended on
2018-12-19 19:08:07 +02:00
Rsl1122 8e2df1de9b Fixed Gradle build failing, shadow problems remain.
Shadow does not relocate classes in the final jar for some reason, and the final jar is bigger than what is produced by maven
2018-12-18 23:06:47 +02:00
MicleBrick 65221b1ba9 Add WIP gradle build scripts (#833) by Miclebrick
> Not actually fully functional, but it's a start
2018-12-18 21:13:05 +02:00
Rsl1122 8d199bcdc3 [#845] Added an event that is called when Plan enables.
This includes, but might not be limited to:
- First time the plugin enables successfully
- Plan is reloaded
- Bukkit-BungeeCord setup updates settings
- Plan is enabled after it was disabled

Following events are available:
Bukkit: PlanBukkitEnableEvent
Sponge: PlanSpongeEnableEvent
BungeeCord: PlanBungeeEnableEvent
Velocity: PlanVelocityEnableEvent
2018-12-18 18:01:58 +02:00
Rsl1122 30bce4e365 Made it possible to run tests in parallel by class 2018-12-18 17:16:33 +02:00
Rsl1122 8161488747 [#777] Configuration format change
- Added a new config updater that can move and remove config values
- Updated the config format to be easier to understand and read.
- Made config updater update old configs to the new format
- Removed Settings enum
- Added generics to Setting, changed from interface to a class
- Created new classes that hold static Setting objects
- Added generics to PlanConfig
- Added PlanConfig#get for getting Setting with generic types.
- Moved config calls made during object initialization,
  possibly eliminating bugs that ignored config settings on first boot
- Added more export settings
- Added JSON Export (#700)
- Fixed Buycraft graph not following Locale setting for timestamps
- Extracted PluginBridge Bridge interface for mocking during tests
2018-12-08 11:44:10 +02:00
Rsl1122 f0deb1ce20 Test clean-up with ComponentMocker class rules 2018-11-26 11:02:18 +02:00
Rsl1122 06565c0c83 Fixed some code smells:
- private constructor for DebugChannels, RedisCheck, VersionInfoLoader
- shortened RedisCheck code to use Check
- InfoRequests delegation instead of extension of HashMap to avoid
  serialization issues.
- Moved InfoRequestHandlerFactory inside InfoRequestFactory.Handlers
  to avoid duplicate constructor and variable pointers.
  - Removed Lazy call to itself from the constructor
- equals+hashcode to StackDataSet, ErrorResponse
- Refactored a while loop in VersionInfoLoader to not have two continue
  statements
2018-11-16 21:02:05 +02:00
Rsl1122 ffa04f1b9f Fixed various code smells
- Replaced all uses of boxed primitive type Suppliers with specialized
  suppliers Eg. Supplier<Integer> with IntSupplier
- Replaced uses of CharSet.forName("UTF-8") with StandardCharsets.UTF-8
- Removed Class.forName("org.h2.Driver") as this check is not required
  since JDBC drivers in the classpath are always loaded since JDK 6.
2018-11-16 19:24:19 +02:00
dependabot[bot] d924d2e65b
Bump maven-shade-plugin from 3.2.0 to 3.2.1 in /Plan/bungeecord
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.2.0...maven-shade-plugin-3.2.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-12 06:10:24 +00:00
Rsl1122 9801aa584b Simplified TPSBuilder
Removed nested classes that created an inheritance tree 9 deep.
2018-11-11 21:14:49 +02:00
Rsl1122 bdd4d4c333 Removed duplicated code: PlanProxyCommand
PlanBungeeCommand and PlanVelocityCommand were the same, and should
stay the same, with exception of the name.
So new module that defines the name of the main command was created and
now the duplicate code could be removed.
2018-11-11 21:09:22 +02:00
Rsl1122 9eaa350758 [Typo] Fix typo in license headers LGNU -> GNU 2018-11-11 20:55:44 +02:00
Risto Lahtela ebaffcab5e
[Merge] Module split (#786)
* Moved project files to 'common'-module

This is done so that refactoring into multiple smaller modules is easier
as the IDE will not attempt to move tests incorrectly when moving things
between different modules

* Created 'bukkit' module

Following classes were removed during the operation:
- BukkitServerInfo (Renamed to ServerServerInfo)
- SpongeServerInfo (could use ServerServerInfo)
- Hastebin (not viable on every platform, unused)
- HastebinTest
- MockPlayers (unused, bukkit specific)

Changes to classes:
- Renamed Importer to BukkitImporter (contained bukkit related impl.)
- Extracted Importer interface from BukkitImporter
- Turned BukkitPlanModule and BukkitClassBindingModule to interfaces by
  using @Binds annotation
- Added Status class since PlayersOnlineListener had a boolean,
  that stated if kicks were counted.

This commit completes split partially and was not pushed on commit.

* Created 'sponge' module

Changes to classes:
- Turned ServerSuperClassBindingModule, SuperClassBindingModule,
  SpongePlanModule and SpongeClassBindingModule to interfaces by
  using @Binds annotation
- Renamed SystemObjectBindingModule to SystemObjectProvidingModule
- Removed sponge related calls in ServerProperties
- Made EmptyImportSystem injectable

This commit completes split partially and was not pushed on commit.

* Changed shade configuration

Further tweaks required.

* Created 'bungeecord' module

Changes to classes:
- Removed use of BungeePingTimerTask in VelocityTaskSystem
- Removed use of RedisBungee in VelocityServerProperties
- Fixed bukkit command.commands.RegisterCommandFilter package

Changes to project structure:
- Dependency versions now in main pom via dependencyManagement
- Repositories now defined in main pom

* Created 'velocity' module

Changes to classes:
- Made RawDataResponse use Gson via reflection since it is no longer
  available in dependencies of 'common' module

* Created 'plugin' module

This module is for creating a single deployment artifact and testing of
system interactions.

Fixes to tests:
- Reflection no longer fails to initialize if Bukkit.getServer() is null
- PingCountTimerBukkit no longer fails to be created if Reflection fails
- Removed unnecessary @AfterClass from H2Test
- Jar resource path fixes to Mocker

* Shading configuration

org.slf4j classes are relocated in 'common', 'bukkit' & 'bungeecord'.
In 'sponge' & 'velocity' they are not relocated, allowing injection
as plugin logger, while using slf4j-nop for HikariCP logging.

This allows single release artifact.

* Removed 'Icon' from .gitignore

* Attempt to fix test resources

Because all jar resources are located in 'common', an attempt to fetch
them is made to common/target/Plan-common.jar, which for some reason
is a bad path.

This attempts to remedy that by creating a temporary file from an
InputStream, read with Class#getResourceAsStream

Ignored HTTPSWebServerAuthTest as the certificate path was invalid for
some reason.
2018-11-11 12:55:09 +02:00