EntityLib/test-plugin/src/main/java/me/tofaa/testentitylib/TestEntityLibPlugin.java
2025-03-31 21:27:58 +04:00

47 lines
1.5 KiB
Java

package me.tofaa.testentitylib;
import com.github.retrooper.packetevents.PacketEvents;
import me.tofaa.entitylib.APIConfig;
import me.tofaa.entitylib.EntityLib;
import me.tofaa.entitylib.spigot.SpigotEntityLibPlatform;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandMap;
import org.bukkit.plugin.java.JavaPlugin;
import java.lang.reflect.InvocationTargetException;
import java.text.DateFormat;
public class TestEntityLibPlugin extends JavaPlugin {
@Override
public void onEnable() {
DateFormat.getDateTimeInstance().format(new java.util.Date(timestamp));
SpigotEntityLibPlatform platform = new SpigotEntityLibPlatform(this);
APIConfig settings = new APIConfig(PacketEvents.getAPI())
.debugMode()
.checkForUpdates()
.tickTickables()
.useBstats()
.usePlatformLogger();
EntityLib.init(platform, settings);
CommandMap commandMap;
try {
commandMap = (CommandMap) Bukkit.getServer().getClass().getMethod("getCommandMap").invoke(Bukkit.getServer());
commandMap.register("testapi", new TestTextDisplayCommand());
commandMap.register("testplayer", new TestPlayerCommand());
commandMap.register("testholo", new TestHologramsCommand());
commandMap.register("testmassivepig", new TestMassivePigCommand());
}
catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
}
}
}