Files
src
build.gradle
manifest.kod
Code
32 2,434
src/main/java/com/nottanmayyy/lhauth/LHauth.java
package com.nottanmayyy.lhauth;
import com.nottanmayyy.lhauth.commands.CreditsCommand;
import com.nottanmayyy.lhauth.commands.GuideCommand;
import com.nottanmayyy.lhauth.commands.LoginCommand;
import com.nottanmayyy.lhauth.commands.PanelCommand;
import com.nottanmayyy.lhauth.commands.RegisterCommand;
import com.nottanmayyy.lhauth.commands.ReloadCommand;
import com.nottanmayyy.lhauth.inventory.gui.GUIListener;
import com.nottanmayyy.lhauth.inventory.gui.GUIManager;
import com.nottanmayyy.lhauth.listeners.CustomJoinMessageListener;
import com.nottanmayyy.lhauth.listeners.PlayerJoinListener;
import com.nottanmayyy.lhauth.listeners.PlayerQuitListener;
import com.nottanmayyy.lhauth.listeners.ProtectionListener;
import com.nottanmayyy.lhauth.managers.AuthManager;
import com.nottanmayyy.lhauth.managers.ConfigManager;
import com.nottanmayyy.lhauth.managers.CustomJoinMessageManager;
import com.nottanmayyy.lhauth.managers.JoinMessageManager;
import com.nottanmayyy.lhauth.managers.KickManager;
import com.nottanmayyy.lhauth.managers.SessionManager;
import com.nottanmayyy.lhauth.managers.TitleManager;
import org.bukkit.plugin.java.JavaPlugin;
public class LHauth extends JavaPlugin {
private ConfigManager configManager;
private AuthManager authManager;
private SessionManager sessionManager;
private TitleManager titleManager;
private JoinMessageManager joinMessageManager;
private CustomJoinMessageManager customJoinMessageManager;
private GUIManager guiManager;
private KickManager kickManager;
@Override
public void onEnable() {
this.configManager = new ConfigManager(this);
this.sessionManager = new SessionManager(this);
this.authManager = new AuthManager(this);
this.titleManager = new TitleManager(this);
this.customJoinMessageManager = new CustomJoinMessageManager(this);
this.joinMessageManager = new JoinMessageManager(this);
this.guiManager = new GUIManager();
this.kickManager = new KickManager(this);
registerCommands();
registerListeners();
getLogger().info("LHauth has been enabled!");
}
@Override
public void onDisable() {
if (titleManager != null) {
titleManager.stopAllTasks();
}
if (kickManager != null) {
kickManager.stopAllTasks();
}
if (authManager != null) {
authManager.saveAllData();
}
getLogger().info("LHauth has been disabled!");
}
private void registerCommands() {
getCommand("register").setExecutor(new RegisterCommand(this));
getCommand("login").setExecutor(new LoginCommand(this));
getCommand("credits").setExecutor(new CreditsCommand());
getCommand("panel").setExecutor(new PanelCommand(this));
getCommand("guide").setExecutor(new GuideCommand());
getCommand("lhauth").setExecutor(new ReloadCommand(this));
}
private void registerListeners() {
getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
getServer().getPluginManager().registerEvents(new PlayerQuitListener(this), this);
getServer().getPluginManager().registerEvents(new ProtectionListener(this), this);
getServer().getPluginManager().registerEvents(new GUIListener(guiManager), this);
getServer().getPluginManager().registerEvents(new CustomJoinMessageListener(this), this);
}
public ConfigManager getConfigManager() {
return configManager;
}
public AuthManager getAuthManager() {
return authManager;
}
public SessionManager getSessionManager() {
return sessionManager;
}
public TitleManager getTitleManager() {
return titleManager;
}
public JoinMessageManager getJoinMessageManager() {
return joinMessageManager;
}
public CustomJoinMessageManager getCustomJoinMessageManager() {
return customJoinMessageManager;
}
public GUIManager getGUIManager() {
return guiManager;
}
public KickManager getKickManager() {
return kickManager;
}
}