Skip to content
Nonnipat Tangrojjanakhajorn edited this page Oct 2, 2025 · 2 revisions

SingularityLib Wiki

This wiki provides documentation and examples for core classes and features in SingularityLib, a Minecraft plugin API designed to streamline plugin development.


Table of Contents

  1. Overview
  2. Installation
  3. Core Concepts
  4. Class Examples
  5. Contributing
  6. Roadmap

Overview

SingularityLib is a Minecraft plugin API providing improved command registration, configuration utilities, GUI creation, item and entity management, database support, and Discord integration.
It is a fork of ExperienceLib.

Note: The project is in active development. Bugs and missing features may be present. Report issues here.


Installation

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>io.github.pinont</groupId>
        <artifactId>SingularityLib</artifactId>
        <version>2.2.0</version>
    </dependency>
</dependencies>

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'io.github.pinont:SingularityLib:2.2.0'
}

Core Concepts

CorePlugin

Your main plugin class should extend CorePlugin instead of JavaPlugin:

public class Main extends CorePlugin {
    @Override
    public void onPluginStart() {
        // Initialization logic
    }
    @Override
    public void onPluginStop() {
        // Cleanup logic
    }
}

Command System

SingularityLib simplifies command registration and management.

Example: Creating a Simple Command

public class FlySpeed implements SimpleCommand {
    @Override
    public String getName() { return "flyspeed:fs"; }
    @Override
    public String description() { return "Set Player Flying speed"; }
    @Override
    public void execute(CommandSourceStack commandSourceStack, String[] args) {
        Player player = (Player) commandSourceStack.getSender();
        // Command logic here
    }
}

Example: Vanish Command

public class Vanish implements SimpleCommand {
    @Override
    public String getName() { return "vanish:v"; }
    @Override
    public String description() { return "Vanish player"; }
    @Override
    public void execute(CommandSourceStack commandSourceStack, String[] args) {
        // Vanish logic here
    }
}

Auto-Registration

Automatically register annotated components using the Register class:

Register register = new Register();
register.scanAndCollect("your.package.name");
register.registerAll(plugin);
  • Scans for classes annotated with @AutoRegister and registers listeners, commands, and custom items.

Custom Items

Create items with custom interactions and appearances by inheriting from CustomItem.

Example: Custom Item

public class MyCustomItem extends CustomItem {
    @Override
    public ItemInteraction getInteraction() {
        // Define interaction logic
    }
    @Override
    public ItemCreator register() {
        // Set visual/item properties
    }
}

Example: Player Head Item

ItemStack head = new ItemStack(Material.PLAYER_HEAD);
ItemHeadCreator creator = new ItemHeadCreator(head)
    .setName("Cool Head")
    .setOwner("PlayerName");
ItemStack finalHead = creator.create();

Entity Creation

Use EntityCreator to spawn and configure entities:

Example: Spawning an Entity

EntityCreator creator = new EntityCreator(EntityType.ZOMBIE)
    .setMaxHealth(40)
    .setVisualFire(true);
Entity zombie = creator.spawn(world, x, y, z);

Database Utilities (MySQL)

Manage MySQL connections and configuration easily:

Example: Connecting to MySQL

MySQL mysql = new MySQL();
Connection conn = mysql.getConnection();
// Use conn for database operations

If configuration is missing, the class creates a template config and prompts you to fill in credentials.


Event System

Listen to custom item interactions with ItemExecuteEvent:

Example: Using ItemExecuteEvent

@EventHandler
public void onItemExecute(ItemExecuteEvent event) {
    Player player = event.getPlayer();
    ItemStack item = event.getItem();
    if (!event.isCancelled()) {
        event.execute();
    }
}

Class Examples

Results above are limited to 10 classes.
View more source files on GitHub


Contributing

PRs and issues are welcome! Priority feedback areas:

  • Command API ergonomics
  • Desired GUI patterns (animation, pagination)
  • Item metadata extension needs
  • Database extensibility

Roadmap

  • Paginated & Animated GUI
  • Item enchantment & attribute expansion
  • Custom entities
  • Command aliases and subcommands
  • Custom crafting recipes
  • Discord event listeners
  • Additional database backends (SQLite, MongoDB)

For detailed JavaDocs and more class examples, visit the GitHub repository.


Note: This documentation was generated using code search and may be incomplete. For full class listings and up-to-date docs, browse the repo.