Skip to content

🧠 Synapse v1.2.0 - Type Handler System

Choose a tag to compare

@iiAhmedYT iiAhmedYT released this 23 Oct 00:20
· 32 commits to master since this release

✨ What's New

⚙️ Type Handler System

Placeholders can now return any Object type! The framework automatically converts objects to strings.

Before:

register("health", context -> String.valueOf(player.getHealth()));

Now:

register("health", context -> player.getHealth()); // Returns double

Built-in Handlers

  • Primitives: Numbers, Booleans, Strings
  • Enums: CREATIVE → "Creative"
  • Collections: Lists/Arrays → "item1, item2, item3"
  • Maps: {a=1, b=2} → "a=1, b=2"
  • Date/Time: Duration → "2h 15m 30s"
  • Wrappers: Optional, Supplier, CompletableFuture

Custom Handlers

// Simple
registerTypeHandler(Location.class, loc -> 
    loc.getWorld().getName() + " @ " + loc.getBlockX() + "," + loc.getBlockZ()
);

// Advanced
public class RankHandler extends BaseTypeHandler<Rank> {
    @Override
    public String handle(Rank rank) {
        return rank.getColor() + rank.getName();
    }
}
registerTypeHandler(new RankHandler());

⚡ Performance Optimizations

  • Faster message parsing with optimized placeholder detection

🐛 Bug Fixes

  • Fix internal exception handling
  • Fix parsing empty namespaces
  • Rename misspelled classes

📚 Docs

Full guide: Type Handlers Documentation


Questions? Discord | Issues