53 Commits
Author SHA1 Message Date
Thijs Wiefferink 669bfbd0fc Remove dead build server link 2024-05-19 23:22:42 +02:00
Thijs Wiefferink 3ce56e7a2a Set version to 1.1 2023-02-11 17:52:31 +01:00
Thijs Wiefferink e7749258ca Test github actions 2019-08-16 18:13:08 +02:00
Thijs Wiefferink 7aed184e8c Only add a prefix if the message is not empty 2018-03-09 12:01:59 +01:00
Thijs Wiefferink b5b7e9c1e5 Log warning for missing messages 2017-12-02 21:32:09 +01:00
Thijs Wiefferink c9a90bb352 Better limit management for argument and language variables
- Increment again for last round of argument and language replacements
- Limit and ReplacementLimitReachedException in separate files
- Add some replacement limit unit tests (more can be added later)
2017-10-23 16:53:20 +02:00
Thijs Wiefferink 90fa17d54d Improve logging during tests for Jenkins (don't use Logger.getGlobal()) 2017-10-19 15:56:33 +02:00
Thijs Wiefferink 255c1e4f60 Add tests for the Message class
- Test public static methods for creating a Message object
- Test isEmpty, prefix, append, prepend
- Get methods and variable replacement still needs to be tested
2017-10-19 15:48:40 +02:00
Thijs Wiefferink ddfef8ed50 Add YAMLMessageProvider and unit tests for it 2017-10-19 15:47:23 +02:00
Thijs Wiefferink 083da2228c Warn if a replacement is null, handle null message parts better 2017-10-16 15:14:59 +02:00
Thijs Wiefferink 73172b9b1a Cleanup variable replacements
- Allow ReplacementProvider returning a Message object
- Escape non-Message results from ReplacementProvider (might be user input or contain variables)
- null replacements do increase the index now (null replacements should never be used though)
2017-09-11 23:33:38 +02:00
Thijs Wiefferink 08ceec2c8e Add easy wrapping of replacements
- Replacement.name() to give a name to a replacement object (instead of the usual number)
- Replacement.prefix() to wrap a ReplacementProvider and add a prefix to the variables
2017-09-11 13:54:52 +02:00
Thijs Wiefferink 288c9a43e0 Fix Message#init() not saving the logger correctly 2017-09-01 23:27:21 +02:00
Thijs Wiefferink 5c42aa1cbe Merge remote-tracking branch 'origin/master' 2017-07-21 18:10:29 +02:00
Thijs Wiefferink b00e8fc946 Prevent crash when an argument replacement introduces its own variable again 2017-07-21 18:10:21 +02:00
Thijs Wiefferink fa8476db0b Set version in example to 1.1-SNAPSHOT 2017-07-21 16:57:17 +02:00
Thijs Wiefferink e8174c87a0 Improve javadoc 2017-07-21 16:55:59 +02:00
Thijs Wiefferink 678cf1030c Fix infinite replacement bug
- At one spot the replacement Limit object was not passed correctly, which could cause infinite replacements crashing the server
- Improve handling of reaching the limit, throw exception instead of checking in all places.
- Move logging class to library itself, so that InteractiveMessenger can also handle logging
2017-07-21 16:53:17 +02:00
Thijs Wiefferink b6066cc4e4 Change version to indicate working towards 1.1 2017-04-22 15:29:23 +02:00
Thijs Wiefferink e68708205b Enable resource filtering to fix version of test plugin 2017-04-02 16:14:06 +02:00
Thijs Wiefferink 4abbb8860f Small optimization to prevent double color stripping 2017-03-30 23:25:21 +02:00
Thijs Wiefferink 534fcfb71b Add basic usage guide 2017-03-25 21:51:17 +01:00
Thijs Wiefferink d5d5fa5c4c Constant naming cleanup 2017-03-25 20:52:37 +01:00
Thijs Wiefferink 91c3bde094 Add relocate instructions 2017-03-25 00:33:23 +01:00
Thijs Wiefferink 9e1b232bea Add AreaShop example 2017-03-23 20:47:21 +01:00
Thijs Wiefferink 364a58378e Content of extra should always be an array
- Add test to catch this error
2017-03-19 20:14:02 +01:00
Thijs Wiefferink 2c2c73f56a Getters/setters for internal representation, compacter tellraw generator output
- Prevent access to the internal variables of InteractiveMessagePart and TextMessagePart to ensure null safety for certain fields
- More compact TellrawGenerator output (and adjusted test cases for that)
- Ingame testing suite:
  - Use -DtestIngame="/path/to/test/server" in the maven command line to build a test plugin and copy it to the server
  - Start ingame testing using the 'testinteractivemessenger' command (alias: 'tim')
  - 'tim start [regex]': start testing all testcases of which the name matches the regex
  - 'tim stop': stop the running test
  - 'tim correct': mark the currently shown test case as correct
  - 'tim wrong': mark the currently shown test case as wrong
  - 'tim continue': continue to the next test case without giving a verdict (either because the test suite already failed the test or because you want to skip it)
  - The input and output of the test case is shown to the test player, and detailed information is displayed in the console
- Added UTF8 encoding test to ensure all languages work
- Use EnumSet where possible
- Move all test cases to the resources folder, where they should be
2017-03-19 16:54:48 +01:00
Thijs Wiefferink f4c20c24ae Testing: cases for newlines and [break] in hover 2017-02-18 16:24:54 +01:00
Thijs Wiefferink e7009138b8 Testing: add hover tests 2017-02-18 16:20:08 +01:00
Thijs Wiefferink 066b085514 Add escaping tests, add way use backslash
- Backslash can now be escaped by backslash
- Tests for escaping all different things
2017-02-18 00:40:40 +01:00
Thijs Wiefferink 4e20b7c97f Break and newline testing and some fixes for that
- Actually add newlines in ConsoleGenerator output
- Parse \n just as [break] is parsed (otherwise it will end up as plain text in the result instead of an actual newline)
- Tests for the current newline properties
- It the future it would be nice to support text after a newline and also adding multiple newlines at once
2017-02-17 23:15:58 +01:00
Thijs Wiefferink 135a58f0b3 Fix toString() of message parts 2017-02-17 22:37:12 +01:00
Thijs Wiefferink 478c92c93c Testing: add reset tag and legacy reset character tests 2017-02-17 21:48:43 +01:00
Thijs Wiefferink 5760aa44ad Testing: split section sign and & testing cases 2017-02-17 21:46:57 +01:00
Thijs Wiefferink 99eb3c79b0 Testing: add formatting tests, add casing tests for tags
- Formatting tests (tags, legacy with & and legacy with section sign)
- Test tags with different capitalisation (they should be case insensitive)
- Fix format and color resets for ConsoleGenerator
2017-02-16 21:48:41 +01:00
Thijs Wiefferink cc526d5725 Use EnumSet to store formatting 2017-02-16 21:27:43 +01:00
Thijs Wiefferink 266abdefac Tests: split same color tags to test them properly
The second tags might break without noticing because the color of the first tag is remembered
2017-02-16 21:26:18 +01:00
Thijs Wiefferink 10d95f235d Non-greedy regex for variables and tags
- This fixes messages that use two language variables after each other, which were getting matched as 1 thing and therefore the second variable would get lost
- Thanks to Chinimala for reporting the bug! (https://github.com/NLthijs48/AreaShop/issues/285)
2017-02-11 23:25:41 +01:00
Thijs Wiefferink 01fb7a500c Show how to use the project in the readme 2017-02-09 15:11:24 +01:00
Thijs Wiefferink 5a583e60b2 Improve Message#isEmpty()
Also see having empty strings in a message as empty
2017-02-04 21:44:29 +01:00
Thijs Wiefferink 7f065fcad1 Add test type for ConsoleGenerator
- In the text files you now specify the input, expected ConsoleGenerator output and expected TellrawGenerator output
- Added InteractiveMessage#copy() and constructor to initialize with a collection of values
- Fix TellrawGenerator destroying given InteractiveMessage object
- Added equals() and hashCode() to InteractiveMessagePart and TextMessagePart
- Add tests to ensure generators don't destroy the given InteractiveMessage object
- Add version to maven-surefire-plugin
- Closes #5
2017-02-01 22:12:57 +01:00
Thijs Wiefferink 7f3bb113e1 Force UTF-8 for running tests, fixes build on Windows
Why is UTF-8 not the default already?.....
2017-01-24 22:48:22 +01:00
Thijs Wiefferink 688752f201 Add tests, fix two color bugs
- Fix colors with underscores not getting replaced
- Fix legacy black color not getting recognized
- Add tests that use all colors
2017-01-24 22:35:50 +01:00
Thijs Wiefferink 1d4c7966b1 Add BufferedWriter target 2017-01-24 17:13:52 +01:00
Thijs Wiefferink a3273701ac Add isEmpty() and prepend() methods 2017-01-24 14:54:24 +01:00
Thijs Wiefferink d43407926d Add testing framework
- RunTests class to setup test suites (directories) and cases (files), it creates a case for each file it finds
- The .txt files define the input (in the format defined by the YamlParser) and the JSON output
- Some simple tests for color have been added
- Can be extended with a lot of tests and also another test type for the output generated by ConsoleGenerator
2017-01-22 21:48:36 +01:00
Thijs Wiefferink 0bbb6f8db9 Fix javadoc of LanguageManager 2017-01-22 21:45:55 +01:00
Thijs Wiefferink e6e474bedf Improve toString() of InteractiveMessagePart and TextMessagePart 2017-01-22 21:43:02 +01:00
Thijs Wiefferink f249746322 Add build server and javadocs to the readme 2017-01-21 19:54:09 +01:00
Thijs Wiefferink f0dfa4ac1b Add build options for sources and javadocs
- "-Dsources" to generate jar with source files
- "-Djavadoc=directory/for/javadocs" to generate javadocs into the specified directory
- Fix deprecation warning by replacing ${name} with ${project.name}
2017-01-21 19:49:30 +01:00
Thijs Wiefferink 16bb949691 Add processing, translation and file layers, major refactoring
- Added LanguageManager class from AreaShop to manage saving/loading language files
- Added Transifex class from AreaShop to convert language files downloaded from Transifex
- Added Message class from AreaShop to process messages:
  - Easily get, modify and send messages by a builder pattern
  - Insert message variables (allows message composition)
  - Insert variables based on index of the argument
  - Insert variables from a given ReplacementProvider
- Split the parser, internal representation and generators into seperate classes:
  - The internal representation (InteractiveMessage) only encodes the structure and formatting of a message, knowing nothing about how it got build and nothing about sending it
  - The parser takes some input and builds an InteractiveMessage (this way multiple parsers can be implemented)
  - Generators take care of producing something that can be sent by reading an InteractiveMessage (ConsoleGenerator and TellrawGenerator are available)
  - Should make it easier to setup unit testing (implement equals() of InteractiveMessage and after that test parsers and generators separately)
- Refactor and improve performance
2017-01-21 17:05:03 +01:00
Thijs Wiefferink 892b7723dc Add examples for hover/click 2016-06-11 21:52:01 +02:00
Thijs Wiefferink 2b62be8312 Add simple message examples 2016-06-11 20:44:36 +02:00