- Added CMDSender#supportsChatEvents because Nukkit players don't support
hover or click events. This means that isPlayer method is not sufficient
for finding out if the sender can produce these events.
* Improved Extension errors
* Removed scary reflective operation exception
* Additional context to SQL Exceptions
* Added error context to Listeners
* Added error context to most error logging places
* Ignore cyclomatic complexity of DBOpException
Adds context to almost all error logging situations, except those where it is unknown, or to commands that are being refactored on another branch.
Close#1245
This commit is a squash of 8 optimization commits to TPSCounter.
1. Extracted duplicate code in TPSCounters to ServerSensors.
- TPSCounter tasks now live inside common module
- ServerTPSCounter and ProxyTPSCounter
- Gathering methods are implemented with ServerSensor interface:
Player count, TPS, Entity count, Chunk count
- ServerProperties#getOnlinePlayers was replaced with ServerSensor
- Fixed sonar smells: "Hiding field" in TPSStoreTransaction & NavLink
2. Optimizations down to 0.15ms / run
- Optimized entity+chunk count (same for loop)
- Added warm-up for system resource methods
- Removed Stream API usages
- Removed List copy operation
- Entities & chunks only count once per minute
- CPU & RAM averages now produced with Average class
- Maximum player count per minute now produced with Maximum class
Affects issues:
- Fixed#1289
- Reduced constructor parameters in Exporter
- Removed Throwable#printStackTrace calls
- Cleaned up SessionsMutator#toJSONMaps a little
- Replaced uses of getString/Number/ methods of PlanConfig with PlanConfig#get
- GeoLite2 downloads the file using License key, only if EULA is accepted
- Fallback to IP2C if GeoLite2 is not available
- Remove GeoIP.dat after successfully downloading GeoLite2-Country.mmdb
- Added case where geolocation fails to enable and doesn't cause issues
- Adds Apache commons-compress to the dependencies because of a tar archive
Affects issues:
- Fixed#1273
- Removed unused code in Reflection
- Removed duplicated Strings in GMTimes
- Added private constructor to TimeZoneUtility
- Renamed local variable in RegisterDateMinimizationPatch
- Replaced Function<String, Boolean> with Predicate in ExtensionRegister
- Changed AFKListeners to use primitive boolean
- Changed Config#get(Setting<Boolean>) uses to isTrue and isFalse
- comment to NukkitListenerSystem
Removed InfoSystem
- Removed /plan m setup
- Removed /planbungee setup
- Removed /planbungee con
- Removed /plan m con
- Removed all InfoRequests
- Removed /info web endpoint
- Removed ConnectionLog
Removed two config settings:
- Display of session accordion as table
(Accordion is table now)
- Display of most played world on sessions
(Always displayed now)
Removed html generation java code for player page
tables
Deprecated PlayerDeath related things
Removed AnalysisContainer data, and
server HealthInformation
Affects issues:
- Close#840
- Removed GenerateAnalysis & CacheAnalysis requests from InfoSystem
- Stopped using AnalysisContainer for /server page
- Moved constant placeholders to ServerPage
- Removed BootAnalysisTask, instead using PeriodicAnalysisTask
- Analysis command and periodic analysis task now export instead of
making requests anywhere, Bungee will not export on analyze command.
Bug:
- Unused result of orElseThrow in DataStoreQueries
- Missing synchronized keywords in ConfigChange
- PlanConfig#hashCode since equals exists
Blocker:
- Add assertion to BungeeSystemTest, SessionTest, CommonDBTest,
LocaleSystemTest, FileWatcherTest
- Removed BungeeBukkitConnectionTest (Not executed)
Critical:
- Fix typo in ErrorPageLang.AUTHENTICATION_FAILED_401 name
- Duplicate Exception definition in ConfigValueParser
Major:
- Renamed 'name' to 'playerName' in BukkitImporter
- Non generic exceptions to Reflection
- Extracted tenary to if in TableContainer, ProviderInformation
And some minor smells
* ShutdownHook: No sessions to save check
ShutdownHook now checks if it needs to save any sessions and does not
start the database if no sessions are unsaved.
* SessionCache.getActiveSessions() now immutable
* [#769] Bukkit and Sponge server shutdown save
Implemented following save procedure for Bukkit:
- On plugin disable check if server is shutting down and save sessions
- Shutdown hook triggered on JVM shutdown calls the same session save
- Save clears sessions from cache, so the sessions are not saved twice
Implemented following save procedure for Sponge:
- Listen for GameStoppingServerEvent
- On plugin disable ask listener if shutting down and save sessions
- Shutdown hook triggered on JVM shutdown calls the same session save
- Save clears sessions from cache, so the sessions are not saved twice
Test:
- Tests ShutdownSave on reload
- Tests ShutdownSave on shutdown
- Tests ShutdownSave on JVM shutdown
Fixed SonarCloud smells:
Level blocker:
- Removed 'dbType' field from CreateIndexTransaction (is in Transaction)
- Removed unused 'dbSystem' from AnalysisContainer
- 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.
- 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)
- 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
- 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.
- Removed ProxyRegisterProcessor
- Optimized name updating to occur on login instead of chat events
- This removes the need to store player names in the DataCache.
- 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.
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)
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
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
- 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
- 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
- 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.
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.
* 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.