Go to file
2024-06-05 23:05:34 +08:00
.idea add basic 2024-05-16 16:11:13 +08:00
src/main/java/cn/lunadeer/minecraftpluginutils finish to test 2024-06-05 23:05:34 +08:00
.gitignore init 2024-05-15 17:34:49 +08:00
pom.xml finish to test 2024-06-05 23:05:34 +08:00
README.md 完善文档 2024-05-27 17:00:28 +08:00

MinecraftPluginUtils

Usage

Maven

<repositories>
    <repository>
        <id>lunadeer-repo</id>
        <url>https://ssl.lunadeer.cn:14454/repository/maven-snapshots/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>cn.lunadeer</groupId>
        <artifactId>MinecraftPluginUtils</artifactId>
        <version>1.3.0-SNAPSHOT</version>
    </dependency>
</dependencies>

Gradle

repositories {
    maven {
        url 'https://ssl.lunadeer.cn:14454/repository/maven-snapshots/'
    }
}

dependencies {
    implementation 'cn.lunadeer:MinecraftPluginUtils:1.3.0-SNAPSHOT'
}
import cn.lunadeer.MinecraftPluginUtils

Example

Logger

import cn.lunadeer.minecraftpluginutils.XLogger;

public final class YourPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        new XLogger(this);      // Initialize the logger with the plugin instance once
        
        XLogger.setDebug(true); // Enable debug mode if needed
        
        XLogger.info("Hello, world!");  // Call the static method
        XLogger.warn("This is a %s", "warning");    // Call the static method with format
    }
}

Notification

import cn.lunadeer.minecraftpluginutils.Notification;

public final class YourPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        new Notification(this); // Initialize the notification with the plugin instance once

        Bukkit.getPluginManager().registerEvents(new PlayerEvents(), this);
    }


    public class PlayerEvents implements Listener{
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event) {
            Notification.info(event.getPlayer(), "Welcome to the server!"); // Send a notification to the player
            Notification.all("Greetings from %s!", event.getPlayer().getName()); // Send a notification to all players
        }
    }
}