Files
src
build.gradle
manifest.kod
Code
18 1,316
src/main/java/com/nottanmayyy/lhauth/LHauth.java
package com.nottanmayyy.lhauth;
import com.nottanmayyy.lhauth.commands.CreditsCommand;
import com.nottanmayyy.lhauth.commands.LoginCommand;
import com.nottanmayyy.lhauth.commands.RegisterCommand;
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.JoinMessageManager;
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;
@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.joinMessageManager = new JoinMessageManager(this);
registerCommands();
registerListeners();
getLogger().info("LHauth has been enabled!");
}
@Override
public void onDisable() {
if (titleManager != null) {
titleManager.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());
}
private void registerListeners() {
getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
getServer().getPluginManager().registerEvents(new PlayerQuitListener(this), this);
getServer().getPluginManager().registerEvents(new ProtectionListener(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;
}
}