INDEX_RETURN

WetSponge API

An early experiment in API unification. A Java abstraction layer designed to bridge the gap between rival Minecraft server architectures (Spigot & Sponge) using the Adapter Pattern.

WetSponge was my first significant foray into software architecture, developed years before starting my formal engineering education.

At the time, the Minecraft server ecosystem was fragmented between two incompatible giants: Spigot (the industry standard) and Sponge (the modern challenger). Developers were forced to rewrite their plugins entirely for each platform. WetSponge was an attempt to solve this by creating a Unified Standard Library: an abstraction layer that allowed writing business logic once and running it on any server implementation.

Although it is now a legacy project, it represents the genesis of my interest in API Design and Multiplatform Architectures.

Architectural Design

The library implements the Adapter Pattern at a systemic level. The core API defines interfaces for common game concepts, while platform-specific modules provide the concrete implementation.

:: Unified Event Bus

Abstracted two incompatible paradigms: Spigot’s reflection-based EventPriority and Sponge’s bus-based Order. I implemented a Normalized Listener Pipeline that wraps native events in generic envelopes, ensuring consistent cancellation behavior and priority handling across ecosystems.

:: Abstracted Scheduler

Standardized the execution model by hiding the complexity of BukkitScheduler and Sponge TaskManager. The API provides a fluent interface to schedule tasks based on Server Ticks (game loops) or Wall-Clock Time, handling context switching between the main server thread and async worker pools transparently.

:: Runtime Bridge Injection

To support multiple platforms with a single artifact, I engineered a Dynamic Bridge Loader. At startup, the core library inspects the runtime environment and injects the correct implementation module using a primitive Dependency Injection container.

:: Command Router & Dispatcher

A declarative command system that decouples business logic from platform specifics. It implements a Cross-Platform Tokenizer to handle argument parsing and permission validation uniformly, mapping the final execution to the underlying server’s logic.

Implementation: The ā€œWrite Onceā€ Promise

The goal was to make the API feel native. Below is an example of how a developer would register a command that works on both platforms without conditional compilation.

public class MyCrossPlatformPlugin extends WetSpongePlugin {

    @Override
    public void onEnable() {
        getLogger().info("Loading cross-platform logic...");

        // Registering a command. The API handles the mapping to
        // /mycmd in both ecosystems.
        getCommandManager().register(new MyCommand(), "mycmd");
    }
}

class MyCommand implements CommandExecutor {
    @Override
    public void onCommand(CommandSender sender, String[] args) {
        // 'CommandSender' abstracts both Spigot and Sponge implementations
        sender.sendMessage("Hello from a platform-agnostic plugin!");
    }
}

Retrospective

Looking back, WetSponge was a naive but ambitious precursor to the problems I now solve professionally. It taught me the immense difficulty of maintaining a Multiplatform Abstraction: a challenge I see reflected today in technologies like Kotlin Multiplatform and the IntelliJ Platform SDK.