Commit Graph
120 Commits
Author SHA1 Message Date
gnembon 277872b33c warning cleanup 2023-02-08 21:13:15 +01:00
gnembon 75d94b0570 cleanup of scarpet dependencies 2023-02-08 21:13:14 +01:00
gnembon 8f61271606 semi-auto cleanup 2023-02-04 13:26:21 +01:00
altrisi fb7b1f79a5 Fix unchecked removal of commands by app name 2023-01-23 22:19:07 +01:00
altrisi f63c6acb05 Fully remove scarpet commands when apps are unloaded (#1452)
Using new Loader 0.14+ features
2022-10-02 13:32:27 +02:00
altrisi d273d4ffb8 Fix some resource leaks 2022-08-28 18:34:39 +02:00
altrisi b677cd73c8 Remove old deprecated Module type and subtypes
They were deprecated in #1382
2022-07-25 22:35:24 +02:00
altrisi 41991b0346 Improve error message when commands fail to be added and make commands using the new system check for masking (#1404)
* Improve error message when command already exists

* Add app's name to the message

* Add app name to any command load failure and fix commands from new system masking existing ones

* Fix duplicated app name in an error

* Update to recent snapshot changes
2022-06-27 14:09:03 +02:00
altrisi 0a972d6c56 Settings rework and encapsulation (#1330)
* Settings rework and encapsulation

* Settings overhaul 3

Move everything in the new system to a new API package

Require rules using the new system to specify descriptions in their translation files

Implement temporary system on top of current translations to allow that to work properly

* Fix getRules fallback

* Final touches to settings refactor

* Mention that set shouldn't throw and remove comment

* Change translation keys to unify with translation PR

* Deprecate printAllRulesToLog to allow using any PrintStream

* Remove restriction of CarpetRules being Comparable

And fix overreaction in a deprecation message

* Bring back user input to rule observers

* Make Validator deprecation warning not spam on use

* Remove unneeded abstract methods in CarpetRule already inherited from CarpetRule

They literally do nothing, don't even force them to be implemented, and may be confusing as to why they're there or as if they are needed to be implemented

* Fix legacy SettingsManager field not being assigned correctly

* Finish fixing conflicts from future merge

* Actually fix remaining conflicts from future merge (missing imports)

* Import the newer rule in SettingsManager

* Refactor Validators

* Don't spam deprecation warnings on custom managers

* Get out the var

* Fix missing warning in old rule observers

* Update src/main/java/carpet/api/settings/Rule.java

* Remove `@ApiStatus.Experimental` annotations

* Fix incorrect `@deprecated` javadoc tags

By removing them given the class is deprecated anyway and else there's too much noise

* Add missing static import

* Remove TypedField and use a regular field

I liked that class tbh, but it's true that it wasn't really needed

* Move `field` assignment out of for removal

* Fix not following contract of `type()` returning boxed value

Previously handled by TypedField

* Fix few incorrect translation keys

* Remove resaving of comments when saving config files

Comments ignoring is still a thing when reading, so `locked` configs for example will keep comments

* Condense rule load messages in one

* Only print loaded settings message when at least one setting was changed

* Fix legacy validator detector

* Tweak and add more context to response to invalid values

* Fix strict validator not actually erroring on invalid input
2022-06-27 13:12:15 +02:00
altrisi a60bc386cb Refactor Module into a single record type and fix system globals (#1383) 2022-05-17 20:11:49 +02:00
altrisi 1f0c609dc0 Remove log4j as much as possible (#1334) 2022-02-22 01:35:56 +01:00
altrisi 06af9ce8b1 Migrate the Carpet codebase to Mojang Mappings 2022-01-24 20:33:16 +01:00
altrisi 34e32973fa Use Fabric's newly exposed version APIs for app requirement parsing, expand it to allow wildcards and change load stopping to be a special exception (#1252) 2022-01-08 23:26:14 +01:00
gnembon 18c728db2e fixes #1172 lol 2021-11-27 20:11:05 +01:00
gnembon 229d0b037b events handling is disabled now when potentially triggered from the scarpet script preventing from recursive callbacks. 2021-09-06 02:37:08 -03:00
altrisi 7fb5e47da5 Use newer Java features in places where it makes sense and more (#1009) 2021-08-03 07:32:40 -03:00
gnembon 0e9df3701f rework for events and other stored functions. Fixes #984 2021-07-22 22:22:38 -03:00
gnembon 9a4e15da48 mappings 2021-06-29 17:28:58 -03:00
gnembon bd689b418a prevent events to be called when script server is gone. 2021-05-28 13:50:50 -03:00
gnembon 328ded0537 added /script remove app command 2021-05-27 01:54:26 -03:00
gnembon db9039c02a added app resources for apps from appstores 2021-05-25 00:41:06 -03:00
gnembon dbae5813f0 added framework for auto resource fetching for the apps 2021-05-21 22:31:02 -03:00
altrisi cc7a9c01be Annotated Scarpet (#772)
* Progress by now.

* Output conversions plus a few extra random things

* More progress, mostly list converting and a way to get converters

* Apply ValueConverters, refactor valueconverter getter to

accept types with annotations and generics, made listconverter pass
those params and annotations recursively. And probably more things.

* Some extra docs, the 100% most important thing

* Added MapConverter, strict Strings and Texts, some docs additions

and commented out heuristics

* Rework StrictParam to use SimpleTypeConverters and be saved in a map

* Minor changes and docs & added non-fully-functional context "converter"

* Added support for variable value count converters, multi-value eaters &

0 value eaters (Context).

* Docs update, enable Context converter, fix minor TODOs

* Move (most) parameter annotations into a single class,

remove deprecated ValueCaster#cast, update some docs.

* Small refactor of Param.Strict registering, added boolean to it

* Added PairConverter, moved Context and LV ValueConverters to Params

* Document public methods of AnnotationParser

* Add a lot more docs, make it ready for the first preview PR

* Move ValueConverter population outside of makeFunction,

check lv size for > max arguments, minor doc updates and workaround for
Mercury#28 until released

* Added optional parameters (declared using Java's Optional),

made evalAndConvert check for the presence of the next iteration,
updated test class

* Generalize Value OutputConverter

* ListConverter and MapConverter now follow ValueConverter contract of

incorrect value handling, returning a complete null for an incorrect
value anywhere. Also small fix to OptionalConverter and docs.
Getting ready for checking null in AnnotationParser!

* Change reflection's #invoke to a MethodHandle to boost speed by a lot

Commented

* Dedupe code, update and remove outdated todos, add 2 new ValueCasters

* Merge lambdas in display_title2 test function to be more accurate

* Check nulls somehow, I guess

* Move base function logic into a class to stop

passing hundreds of parameters into static functions and therefore simplify it

* Reduce visibility and fix a bug with PairConverter

* Hide Context provider in usage report

* Add support for primitive varargs

* Added TheLazyT converter

* Drop #getPrefixedTypeName and use 'something' as name of values

* Use value again because of varargs, document that

* Remove a completed TODO

* Remove old disabled heuristic value type name getter

* Fix TheLazyT

* Preparing locators before touching current Carpet infrastructure

* Add notes about non-implementedness of remaining locators

* Added APIs to register custom ValueConverters

* Mention new APIs in javadocs

* Adapt to new Carpet changes and deprecated non-implemented annotations

* Update example function for display_title()

* Better implementation for player_list example

* Fix example error message

* FunctionArgument no longer has generics

* Modernize Text converters

* OutputConverter is final, plus other small changes

* Few non-behavioural changes

* Rename LazyFunction to ScarpetFunction

* Drop LazyValue in parameters, not in return

Updating docs was a nightmare

* CARPET CHANGE - Make Fluff.AbstractLazyFunction.unpackArgs call unpackLazy (was duped)

* Make errors more like current Scarpet errors

* Allow customizing ContextType when evaluating arguments

* Add a few missing docs, comment out outdated ValueCaster doc

It's been a while, wow

* Fix for new Carpet signature :irritatered:

Please don't break API methods! Extensions may be using them, and they
will just crash the game or behave in unexpected ways else!

* Format all code to Carpet's. Powered by Eclipse

Reviewed to be sure it's ok. No functional changes, except from a small correction

* Always use full name for Context.Type

* Add parsing for all current Scarpet api and language classes

And remove test functions

* Allow void return type

* Fix no param methods

Whoops!

* Remove outdated comment and fix small javadoc linting problem

* Drop Param.TheLazyT in favour of just Context.Type type

And small performance improvement to varargs varargs since fastutil's toArray is crap

* Quote functions in error messages

* Make SimpleTypeConverter independent of ValueCaster

'Real world' usage demonstrated it can be annoying else, mostly for wrapper only values where you just want the wrapped object
2021-05-21 01:33:00 -03:00
altrisi be0635de82 Use primitive specific Predicates instead of Function (#859) 2021-05-15 18:54:16 -03:00
gnembon 06c9aea326 tracking module integrity when module composition changes 2021-04-29 02:17:02 -03:00
gnembon edca3fb131 using proper logger now 2021-04-22 22:30:45 -03:00
altrisiandgnembon b7b7667484 Allow apps to specify mod version requirements (#798)
* Allow apps to specify mod version requirements

* Allow a function in requires field and move to `readConfig()`

* Add `server_mods` to system_info()

* Add prefixes and default to `=`

* Added docs for `requires` and for `system_info('server_mods')`

* Better docs for requires (mention * and available prefixes)

* Update docs/scarpet/api/Overview.md

* Update docs/scarpet/api/Overview.md

* Update docs/scarpet/api/Overview.md

Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
2021-04-18 02:36:29 -03:00
gnembon 647a3a15b6 profiler rework 2021-04-06 00:41:12 -03:00
gnembon f0d044a49f added scarpet to the carpet profiler 2021-04-04 22:32:34 -03:00
gnembon ff4b292871 Merge pull request #742 from Ghoulboy78/draw_beta-upgrade
Update draw_beta.sc
2021-03-23 08:36:42 -03:00
gnembon 1a47f4333f refactored file IO and zupport for sips 2021-03-20 06:22:23 -03:00
gnembon 24e7c0fab9 command adding is due to the app refactor 2021-03-18 18:06:21 -03:00
altrisi 8a1c9f2d0b Fix symbolic links (#754) 2021-03-07 17:16:20 -04:00
Ghoulboy78 ae63c7be1d registering as built-in library (thx @altrisi) 2021-02-25 09:32:00 +01:00
gnembon 4c09d6b736 added __on_start and defined better meta-events 2021-02-08 18:08:38 -04:00
gnembon d99ab4fc24 limit depth of game_tick, just in case. 2020-12-20 22:58:41 -04:00
gnembon f54a098948 allow apps define their own command permission level, fixes #542 2020-12-07 16:03:42 -04:00
gnembon 522d971688 added startup and shutdown events. fixes #586 2020-12-07 01:11:55 -04:00
gnembon e8a6b8936f as per discussion, since scripts can now be stowed in the global bin, it makes sense for apps to behave like datapacks. fixes #613 2020-12-07 00:32:08 -04:00
gnembon ac6b3c7f48 apps can be organized in floders in your shared instance space. 2020-12-06 23:40:02 -04:00
gnembon 6e5af5bfc8 added list_files, fixes #589 2020-12-03 04:05:11 -04:00
gnembon d29f49967f rework of the event system, allowing apps to function more independently and allowing for player scoped apps to handle global events. fixes #596 2020-12-02 01:02:36 -04:00
altrisi 5dfd956ba2 Only allow globals in clients, fix potential issue and mention in docs 2020-11-29 21:45:53 +01:00
altrisi 210ad834f6 Allow loading apps from a global path 2020-11-29 15:49:28 +01:00
gnembon 209c3b9262 fixed issues with reload and missing command handler 2020-11-24 22:52:05 -04:00
gnembon 724b63df8a using beta as a indicator 2020-11-24 19:43:21 -04:00
Ghoulboyandaltrisi aeb3e382a6 Replacing draw and distance with apps (#553)
* added draw.sc app

Now working on distance app

* Adding apps as carpet rules

* adding distance app

Co-authored-by: altrisi <altrisi.trillosierra@gmail.com>
2020-11-24 19:40:55 -04:00
gnembon fee127a942 hide beta builtin apps 2020-11-24 19:38:38 -04:00
gnembon a297fd1441 Scarpet rules can provide multinary boolean permission level, fixes #572 2020-11-23 02:35:01 -04:00
altrisiandgnembon ba1071a8d1 Javadocs, cleanup, extension's client rules, built-in BundledModules generators, etc (#544)
* Add javadocs to many methods

* Added built-in ways to generate BundledModules and documented them

* Add Eclipse launch files to .gitignore and fix 11 warnings

* Remove many unused imports

* Remove some dead and unused code around app loading

* Allow extensions to have client-side rules in their SettingsManager

Also change tabs to spaces when those changed

* Remove unnecessary classloader param in BundledModule

* Change max tickwarp duration to Integer.MAX_VALUE

* Move RulePrinter into the source so it can be managed by the IDE

* Properly reset hopperCounters when changing worlds

Also change tabs to spaces again and minor tweaks to javadocs

* Run mergedocs even if Full.md was modified

* Update src/main/java/carpet/commands/TickCommand.java

Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
2020-11-16 09:30:59 -04:00