Files
src
build.gradle
manifest.kod
Code
19 875
src/main/java/com/multigameevents/MultiGameEvents.java
package com.multigameevents;
import com.cryptomorin.xseries.XSound;
import com.multigameevents.command.*;
import com.multigameevents.listener.ConnectionListener;
import com.multigameevents.manager.*;
import com.tcoded.folialib.FoliaLib;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class MultiGameEvents extends JavaPlugin {
private FoliaLib foliaLib;
private ConfigManager configManager;
private LocationManager locationManager;
private GameStateManager gameStateManager;
private CountdownManager countdownManager;
private VelocityMessenger velocityMessenger;
@Override
public void onEnable() {
saveDefaultConfig();
this.foliaLib = new FoliaLib(this);
this.configManager = new ConfigManager(this);
this.locationManager = new LocationManager(this);
this.velocityMessenger = new VelocityMessenger(this);
this.gameStateManager = new GameStateManager(this);
this.countdownManager = new CountdownManager(this);
registerCommands();
registerListeners();
getLogger().info("MultiGameEvents enabled!");
}
@Override
public void onDisable() {
if (foliaLib != null) {
foliaLib.getScheduler().cancelAllTasks();
}
getLogger().info("MultiGameEvents disabled!");
}
private void registerCommands() {
getCommand("setgame").setExecutor(new SetGameCommand(this));
getCommand("setpractice").setExecutor(new SetPracticeCommand(this));
getCommand("gamestart").setExecutor(new GameStartCommand(this));
getCommand("nextgame").setExecutor(new NextGameCommand(this));
getCommand("finishgame").setExecutor(new FinishGameCommand(this));
PracticeCommand practiceCommand = new PracticeCommand(this);
getCommand("practice").setExecutor(practiceCommand);
getCommand("practice").setTabCompleter(practiceCommand);
getCommand("setgame").setTabCompleter(new SetGameCommand(this));
getCommand("setpractice").setTabCompleter(new SetPracticeCommand(this));
}
private void registerListeners() {
Bukkit.getPluginManager().registerEvents(new ConnectionListener(this), this);
}
}