COWMODSКаталог модов

ServerLibraries

A Library made to ease serverside mod creation

Автор: Relism8741обновлён 26 авг. 2024 г.
БиблиотекиОптимизация

Описание

ServerLibraries

Modrinth Shield Github Shield Wakatime

Banner Image

ServerLibraries is a library for Minecraft server-side Fabric mod development, aiming to simplify the development experience and make it feel like making a Bukkit-based plugin.

Features

  • Simplified event handling with hundreds of mapped events.
  • Easy sync/async scheduling.

Example Usage

Here's an example of how to use ServerLibraries to handle events:

// Listener class that handles server events
public class ExampleListener implements Listener {

    @EventHandler
    public void onPlayerChatEvent(@NotNull PlayerChatEvent event) {
        event.setCancelled(true);
        ServerPlayerEntity player = event.getPlayer();
        String message = event.getMessage();
        // Format the message to display the player's name followed by the message
        String formattedMessage = player.getName().getString() + " > " + message;
        // Broadcast the formatted message to all players and log it in the console
        msg.broadcast(formattedMessage);
        msg.log(formattedMessage);
    }

    @EventHandler
    public void onPlayerMoveEvent(@NotNull PlayerMoveEvent event) {
        // Get the player and their position
        ServerPlayerEntity player = event.getPlayer();
        BlockPos pos = player.getBlockPos();
        // Format and send the coordinates as an action bar message
        String message = "X: " + pos.getX() + " Y: " + pos.getY() + " Z: " + pos.getZ();
        msg.sendActionBar(player, message);
    }
}

// Main Fabric mod class
public class ExampleMod implements ModInitializer {
    @Override
    public void onInitialize() {
        EventsRegistry.registerListener(new ExampleListener());
    }
}

Installation

To include ServerLibraries in your project, add the following to your build.gradle file.

Maven Repository

repositories {
    exclusiveContent {
        forRepository {
            maven {
                name = "Modrinth"
                url = "https://api.modrinth.com/maven"
            }
        }
        filter {
            includeGroup "maven.modrinth"
        }
    }
}

Dependency

Add the following dependency. Replace <version> with the version you want to use. You can find available versions here or use the version below for the latest stable release.

Stable Release Shield

dependencies {
    modImplementation "maven.modrinth:kjqxZ07F:<version>"
}

Documentation

Docs and Javadocs can be found on here.

Галерея

banner

Последние версии

Все версии →
beta

ServerLibraries 1.4

1.4
26 авг. 2024 г.315Minecraft: 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21, 1.21.1fabric
Скачать
Что нового
Improved the Event API and added example usages
release

ServerLibraries 1.3

1.3
17 июл. 2024 г.172Minecraft: 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21fabric
Скачать
Что нового
Updated to 1.21, added Bossbars, added a ping and tps command, added servermetrics and their factory in the api and a bunch of other stuff.
alpha

ServerLibraries 1.2

1.2
9 июл. 2024 г.154Minecraft: 1.20.6fabric
Скачать
Что нового
Added the cancellable PlayerMoveEvent
alpha

ServerLibraries 1.1

1.1
9 июл. 2024 г.107Minecraft: 1.20.6fabric
Скачать
Что нового
Added some events, server metrics and bossbar functionality
alpha

ServerLibraries 1.0

1.0
3 июн. 2024 г.126Minecraft: 1.20.6fabric
Скачать