This repository has been archived on 2024-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nukkit-alphaapi/src/com/alphaae/mcpe/servers/MainPlugin.java
AlphaAE 0173139302 updata
2019-05-10 11:49:10 +08:00

60 lines
1.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.alphaae.mcpe.servers;
import cn.nukkit.command.SimpleCommandMap;
import cn.nukkit.plugin.Plugin;
import cn.nukkit.plugin.PluginBase;
import cn.nukkit.plugin.PluginManager;
import com.alphaae.mcpe.servers.command.HiCommand;
import com.alphaae.mcpe.servers.command.UpdataUserDataCommand;
import com.alphaae.mcpe.servers.event.FormRespondedEvent;
import com.alphaae.mcpe.servers.event.PlayerInventoryEvent;
import com.alphaae.mcpe.servers.event.PlayerInteractSetEvent;
import com.alphaae.mcpe.servers.event.PlayerJoinQuitEvent;
public class MainPlugin extends PluginBase {
private static Plugin plugin;
public static Plugin getPlugin() {
return plugin;
}
@Override
public void onLoad() {
getLogger().info("AlphaAPI被加载");
}
@Override
public void onEnable() {
plugin = this;
initConfig();
registerCommands();
registerEvents();
}
@Override
public void onDisable() {
super.onDisable();
}
public void initConfig() {
getDataFolder().mkdirs();
saveResource("config.yml");
reloadConfig();
}
private void registerCommands() {
SimpleCommandMap commandMap = getServer().getCommandMap();
commandMap.register("AlphaAPI", new HiCommand(this));
commandMap.register("AlphaAPI", new UpdataUserDataCommand(this));
}
private void registerEvents() {
PluginManager pluginManager = getServer().getPluginManager();
pluginManager.registerEvents(new PlayerJoinQuitEvent(), this);
pluginManager.registerEvents(new PlayerInteractSetEvent(), this);
pluginManager.registerEvents(new FormRespondedEvent(), this);
// pluginManager.registerEvents(new PlayerInventoryEvent(), this);
}
}