Skip to content

πŸ› οΈ SkJson 5.4 β€” Debug changes, Custom loops and better get/set syntax

Choose a tag to compare

@cooffeeRequired cooffeeRequired released this 15 May 21:17
· 18 commits to main since this release

πŸš€ New Features & Improvements

  • Added support for custom loops
  • Improved get/set operation syntax
  • Added new walkAsFiles method for traversing JSON files
  • Refactored SerializedJson to JsonAccessor for better JSON data access
  • Enhanced support for working with JSON arrays and objects
  • Added better support for JSON loops
  • Added support for AbstractLoops with improved parsing and validation system
  • New implementation for working with nested loops in JSON data
  • Enhanced system for working with loop-indices and loop-keys

Example of AbstractLoopExpression Usage

Java Implementation Example

// Example of custom loop implementation
public class CustomAbstractLoop extends AbstractLoopExpression<Object> {
    private LoopState state;

    public enum LoopState {
        ID, VALUE, KEY, INDEX
    }

    @Override
    public boolean isIntendedLoop(AbstractLoop loop, AbstractExpressionInitializer initializer) {
        if (loop.getLoopedExpression() instanceof CustomExpression exprCustom) {
            switch (initializer.parser().mark) {
                case 1 -> state = LoopState.KEY;
                case 2 -> state = LoopState.VALUE;
                case 5 -> state = LoopState.INDEX;
            }
            return true;
        }
        return false;
    }

    @Override
    public Class<?> getExpressionToLoop() {
        return Expression.class;
    }

    @Override
    public Object[] get(Event event) {
        Object current = loop.getCurrent(event);
        if (current == null) return null;
        return current;
    }
}

πŸ› Bug Fixes

  • Fixed issues with accessing JSON data in loops
  • Improved null value checking in JSON data
  • Fixed issues with accessing indices in JSON arrays
  • Enhanced JSON data validation during parsing
  • Fixed issues with nested loops
  • Improved error detection and handling in loop expressions
  • Fixed issue with request body without defined http version
  • Fixed variable parsing in literal
  • Fixed conflicts with Skript-reflect lately.

πŸ” View full diff between 5.3 and 5.4

Thank you for your continued support and valuable feedback!