Commit Graph

134 Commits

Author SHA1 Message Date
Risto Lahtela 15c9325eb4 Added activity index queries and placeholders.
- Added CommonQueries#fetchActivityIndexOf
- Added CommonQueries#getActivityGroupForIndex

- Added %plan_player_activity_index%
- Added %plan_player_activity_group%

Affects issues:
- Close #1663
2021-01-20 16:58:46 +02:00
Risto Lahtela 1664199574 Extension Table now handles Optionals
Updated mcMMO Extension to R1.2

Affects issues:
- Fixed #1643
2021-01-03 12:27:49 +02:00
Risto Lahtela 7420e46df2 Fixed SonarCloud code smells
- Redundancies:
  - MySQLDB: Removed null check
  - DeathEventListener: Removed warning suppression
  - several Test classes: Removed public class identifier
  - Unused private fields
- Constructors of abstract classes should be protected x31
- Added missing Parameterized types x2
- "throws" declerations for runtime EnableException
- Prevented Boxed Boolean from causing NPE in the future x15
- Renamed lesser scope variables that were hiding variables x12

- Some smaller ones that I was too tired to write down
2020-11-05 23:16:01 +02:00
Risto Lahtela e6f879783d Made a bunch of API holders use AtomicReference 2020-11-05 21:58:31 +02:00
FluxCapacitor 0ac5ad6f23
Send no response body when the response status code is 204. (#1610)
Affects issues:
- Fixed #1605
2020-10-15 21:03:13 +03:00
Risto Lahtela 12a264b1ea Made API Services volatile to avoid thread visibility issues 2020-10-11 15:12:26 +03:00
dependabot-preview[bot] 3d29aa0d98 Bump commons-lang3 from 3.10 to 3.11 in /Plan
Bumps commons-lang3 from 3.10 to 3.11.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-07-17 05:45:45 +00:00
Risto Lahtela 93dc1bbb9e
Added more context to errors (#1450)
* 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
2020-05-15 12:20:29 +03:00
Risto Lahtela 99406b961f Manually decode URI parameters
Affects issues:
- Fixed #1444
2020-05-13 10:23:11 +03:00
Risto Lahtela ea2ae5d3e1 Linked web users to players or console
PageExtension API:
- Added WebUser#getUsername
- Changed WebUser#getName to return player's name or 'console'
- API version 5.1-R0.4
2020-05-03 23:26:01 +03:00
Risto Lahtela dff96b1728 Implemented session playtime to Query API.
CommonQueries#fetchCurrentSessionPlaytime,
requires Capability#QUERY_API_ACTIVE_SESSION_PLAYTIME

API version increased to v5.1-R0.3

Affects issues:
- #1384
2020-05-03 18:32:55 +03:00
Risto Lahtela 3903a266a3
Added Login & Registration pages (#1422)
- Added login.html and register.html
- Added .bg-gradient
- Added logonsine.js for a decoration.
- Added /login, /register, /auth/login, /auth/logout and /auth/register endpoints
- Redirects to /login if cookie not present with auth enabled.
- Basic login functionality using cookies
- Registration page allows new kind of registration that doesn't log passwords on console.
- Fixes a bug with stippets that blocked any cross-plugin modifications (PageExtension API)
- Fixes a typo with css snippet code that made the css not apply (PageExtension API)
2020-05-02 23:31:29 +03:00
dependabot-preview[bot] d976d9dd10 Bump com.jfrog.bintray from 1.8.4 to 1.8.5 in /Plan
Bumps com.jfrog.bintray from 1.8.4 to 1.8.5.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-07 05:39:49 +00:00
dependabot-preview[bot] 6a07cd5cc9 Bump commons-lang3 from 3.9 to 3.10 in /Plan
Bumps commons-lang3 from 3.9 to 3.10.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-30 06:04:17 +00:00
Risto Lahtela 45d6bfb840 Made resource resolution more flexible
- API 5.1-R0.2: Added ResolverService#getResolvers method
- /players/ now redirects to /players
- All error pages now have proper css

Affects issues:
- Fixed #1378
2020-03-28 13:00:34 +02:00
Risto Lahtela b7c84980e3 Bump API version, add Capabilities:
- PAGE_EXTENSION_RESOLVERS
- PAGE_EXTENSION_RESOURCES
2020-03-20 22:26:03 +02:00
Risto Lahtela 38bb2ce61c Added ResponseBuilder#setContent(WebResource) 2020-03-20 22:26:03 +02:00
Risto Lahtela 4fd19bbc5e Removed PlanFiles#getCustomizableResourceOrDefault 2020-03-20 22:26:03 +02:00
Risto Lahtela ff6f960a84 Renamed Resource snippet Positions 2020-03-20 22:26:03 +02:00
Risto Lahtela dae96ef53d Implemented ResourceSvc
- Customizable resources
- Snippets
- Fixed issue with a web resource being fetched on enable (favicon in ResponseResolver)
- Fixed some issues with Config#addNode used in an orElse block of Optional
- Deprecated PlanFiles#getCustomizableResourceOrDefault
2020-03-20 22:26:02 +02:00
Risto Lahtela f2ba301880 Made CapabilityService more resilient
Affects issues:
- Fixed #1356
2020-03-20 22:26:02 +02:00
Risto Lahtela 648cdb1a0c Added a ResourceService
- Allows customizable files
- Allows js and css addition to html files
2020-03-20 22:26:02 +02:00
Risto Lahtela b339800650 Removed JUnit 4 2020-03-14 12:40:23 +02:00
Risto Lahtela 77d33c991a Moved NotFoundException to API 2020-03-14 12:40:22 +02:00
Risto Lahtela 68be3117b1 Moved BadRequestException to API
Changed Bad Request response to JSON:
{
    "status": 400,
    "error": "message",
    "target": "/requested/target"
}
2020-03-14 12:40:21 +02:00
Risto Lahtela 0a8b0e273c Fixed checkstyle on newer JDKs
See https://github.com/gradle/gradle/issues/8286 for more information
2020-03-14 12:40:21 +02:00
Risto Lahtela c204ce9b1b Fixed some code smells & bugs 2020-03-14 12:40:19 +02:00
Rsl1122 420e098d41 Moved ServerPage colors to the JSON responses 2020-03-14 12:39:57 +02:00
Rsl1122 b5d07de18b Removed unused code 2020-03-14 12:39:55 +02:00
Rsl1122 1ab5f3473d Refactored JSONResolvers to use the new API 2020-03-14 12:39:53 +02:00
Rsl1122 2b1b459a37 Refactored static resource resolution 2020-03-14 12:39:32 +02:00
Rsl1122 77dbc74cc5 Refactored Root page redirect
- Fixed issue where response code was not set
- Fixed ResponseSender not setting values for response headers
- Changed ResponseResolver to mostly use Response instead of _old
2020-03-14 12:39:31 +02:00
Rsl1122 6ed6dd1f9f Refactored Resolver to use new Request class
URIPath and URIQuery were not enough info on the Request
In addition the Request supports
- WebUser
- Request Headers
- Request method (GET, POST etc)
2020-03-14 12:39:30 +02:00
Rsl1122 4a1234f9b4 Refactored /server page to use ResolverService 2020-03-14 12:39:28 +02:00
Rsl1122 2736ba042a Refactored /debug page to use ResolverService
Some issues that were identified:
- Going to /debug/ makes the style requests return the debug page content
  because the /debug resolver is used
- In the future when / is to be resolved it might override a bunch of requests.
- Use of RequestTarget as incompatible with URIPath for some reason which lead to infinite
  redirect, so the attempted change was reverted before this commit.
- Some Responses are using PlanFiles to obtain a html file (SRP violation)

Rest of the pages still use the old resolution that is now deprecated.
2020-03-14 12:37:23 +02:00
Rsl1122 9c74c40f72 Renamed some Service related classes 2020-03-14 12:35:06 +02:00
Rsl1122 96837dbcd0 Tested and fixed URLTarget behavior
Now properly omits previous segments and uses the same code for getPart.
You can read the javadocs or tests if you want to figure out the behavior
2020-03-14 12:35:05 +02:00
Rsl1122 7f0341087e Implemented a CompositeResolver
Allows building tree-like structure for resolution
2020-03-14 12:35:05 +02:00
Rsl1122 e7da714f55 Initial draft of ResolverService
Affects issues:
- #1288
2020-03-14 12:35:05 +02:00
Rsl1122 ee9a9ba7d8 Refactored code of DataProvider
Some optional values from different providers
were not included in ProviderInformation,
which lead to unnecessary instanceof usage and
weird static methods.

Added the optional info to ProviderInformation
and created a Builder, making much cleaner code
and removing those odd ball methods.

- Also fixed StoreProviderTransaction having
  insert of Icon and Tab in wrong order
2020-01-26 22:38:59 +02:00
Rsl1122 7581968e27 Fixed javadoc errors 2019-10-05 11:27:19 +03:00
Rsl1122 2da10001dc Truncation of Extension table column names 2019-09-05 17:22:09 +03:00
Rsl1122 5d3bc4c95d Implemented SettingsService 2019-09-03 09:32:38 +03:00
Rsl1122 6cbf28ad17 Plan API 5.0-R0.2: Changed GroupProvider to return String[] 2019-09-03 09:32:22 +03:00
Rsl1122 0605adcbab Added missing license header 2019-09-03 09:32:18 +03:00
Rsl1122 a7978c8bda Plan API 5.0-R0.1: DATA_EXTENSION_GROUPS Capability 2019-09-03 09:32:17 +03:00
Rsl1122 e66b63281d Made build in extension registration more resistant:
- Attempt to reduce the amount of exceptions that might slip through
  and fail to start Plan

Affects issues:
- Close #1134
2019-08-12 09:32:18 +03:00
Rsl1122 484f3d5976 Fixed some code smells
! Removed BukkitImporter#getNames
- Refactored duplicate code in PerServerAggregateQueries
- Refactored duplicate code in BaseUserQueries
- Refactored duplicate code in GeoInfoQueries
- Refactored duplicate code in PingQueries
- Refactored duplicate code in 3 patches
- Refactored many duplicated string literals (SQL)
! Removed unnecessary Exception in GeoInfoStoreTransaction
2019-08-06 22:34:50 +03:00
Rsl1122 27f6350076 Fixed javadoc errors
Affects issues:
- #993
2019-08-05 10:25:00 +03:00
Rsl1122 64cf78101c Register DataExtension super class Providers
Affects issues:
- Close #1121
2019-08-02 16:07:37 +03:00
Rsl1122 43a43b604c api 0.0.6: Query API
Affects issues:
- #1117
2019-07-28 11:22:32 +03:00
Rsl1122 45da64e88f 'showInPlayerTable' parameter for Providers
for BooleanProvider, DoubleProvider, PercentageProvider, NumberProvider,
StringProvider annotations.
When the parameter is set to 'true' the value from the Provider is shown
on a table alongside players.

Capability DATA_EXTENSION_SHOW_IN_PLAYER_TABLE added
2019-05-12 11:13:39 +03:00
Rsl1122 6d788ba61a Added NotReadyException to DataExtension API (0.0.5) 2019-05-10 14:21:52 +03:00
dependabot[bot] 40b531b3da Bump com.jfrog.bintray from 1.8.1 to 1.8.4 in /Plan (#1024)
Bumps com.jfrog.bintray from 1.8.1 to 1.8.4.

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-05-01 10:59:16 +03:00
Rsl1122 71250c3d65 JSON parser for player table data 2019-04-30 18:36:50 +03:00
Risto Lahtela 1dcae30d67
[Merge][#638] Plan API 0.0.4, Tables for DataExtensions (#1010) 2019-04-14 10:31:30 +03:00
Rsl1122 e18bf38637 Added a CapabilityService to api module 2019-04-07 13:45:44 +03:00
Rsl1122 9b29edd16e Fix some code smells 2019-03-31 14:20:10 +03:00
Rsl1122 bb2be54604 More flexible definition of calling Extension methods 2019-03-31 12:12:59 +03:00
Rsl1122 ffce4c9e32 Removed update booleans from PluginInfo 2019-03-31 11:42:27 +03:00
Rsl1122 001b5a6cc7 Fixing some new code smells:
Critical:
- String literal duplication fixed in a few places
- Cognitive complexity reduced in BooleanProviderValueGatherer

Major:
- Called Optional#isPresent before accessing value
  16 instances in ProviderTransactions
- private constructor to Extension tables
- Missing deprecated tags to deprecated plugin tab stuff
- Unused class variable removal
- Throw dedicated exceptions in ServerServerInfo
- Unused method removal

Minor:
- Renamed 'API' field to 'service' in ExtensionService
- Unused variable removal
2019-03-27 14:30:53 +02:00
Rsl1122 47a6a9b2aa Transaction for removing unsatisfied Conditional data:
This is one of the most complex queries I have made.

- Select all fulfilled conditions for all players (conditionName when
  true and not_conditionName when false)
- Left join with player value & provider tables when uuids match, and
  when condition matches a condition in the query above.
- Filter the join query for values where the condition did not match
  any provided condition in the join (Is null)
- Delete all player values with IDs that are returned by the left join
  query after filtering

In addition:
- Added test for the transaction
- Added extension data removal to RemoveEverythingTransaction
- Added unregister method to ExtensionService
2019-03-26 12:22:57 +02:00
Rsl1122 f73cef8587 Bump extension API to 0.0.2 2019-03-24 15:53:20 +02:00
Rsl1122 0be153d03e Added booleans to PluginInfo for controlling method calls. 2019-03-24 15:52:32 +02:00
Rsl1122 600e90873e Added Conditional#negated 2019-03-24 15:34:58 +02:00
Rsl1122 2b620f97f1 Added BooleanProvider#hidden 2019-03-24 15:34:45 +02:00
Rsl1122 099330ebd7 DataExtension API player page plugin tab generation 2019-03-24 12:28:13 +02:00
Rsl1122 a514e29e78 getByName to Extension enums 2019-03-23 13:06:31 +02:00
Rsl1122 e8da008538 Added 'extensions' module:
- Module is in charge of registering built in DataExtensions
- This is done via ExtensionRegister
2019-03-20 13:37:56 +02:00
Rsl1122 48e65a60c8 ExtensionService implementation 2019-03-18 15:04:53 +02:00
Rsl1122 dead33f78c Interface for registering DataExtensions 2019-03-18 14:52:23 +02:00
Rsl1122 c5b28fe3f9 Storage of plugin info, icon and tabs of DataExtension 2019-03-17 11:56:33 +02:00
Rsl1122 b52d113e2e Provider Extraction + priority to Providers:
Implemented methods for extracting each kind of Provider annotation
related method information to a DataProvider.

DataProviders required some duplicate code due to type erasure of the
parameter class.

----

Added Display-priority to Providers, highest value is placed top most.

InvalidateMethod annotations are now extracted.
2019-03-14 16:53:05 +02:00
Rsl1122 a52954dbb8 Method names used as provider identifiers 2019-03-13 10:50:54 +02:00
Rsl1122 245c083237 Refactored ExtensionExtractor, Added Group parameter 2019-03-11 12:30:21 +02:00
Rsl1122 aa8fe70e1f Validation class for annotations 2019-03-06 17:56:47 +02:00
Rsl1122 98847a5b71 Retention and Target to Providers 2019-03-06 16:54:41 +02:00
Rsl1122 b396602135 Added StringProvider 2019-03-06 16:40:55 +02:00
Rsl1122 605f28f12c Added PercentageProvider 2019-03-06 16:36:40 +02:00
Rsl1122 1fb62cc1cc Added DoubleProvider 2019-03-06 16:32:34 +02:00
Rsl1122 c6f3d7b59b Added NumberProvider 2019-03-06 16:30:12 +02:00
Rsl1122 53216a4e1c Added BooleanProvider annotation 2019-03-06 16:22:10 +02:00
Rsl1122 5f2e097ac3 Information annotations for DataExtension API 2019-03-03 21:21:04 +02:00
Rsl1122 b4a3feddf5 Plan api module 2019-03-03 21:21:04 +02:00