Files
src
DEVELOPER_GUIDE.md
INSTALLATION.md
pom.xml
README.md
Code
31 2,468
src/main/java/com/kodari/citycore/CityCorePlugin.java
package com.kodari.citycore;
import com.kodari.citycore.command.CityCommand;
import com.kodari.citycore.config.ConfigManager;
import com.kodari.citycore.economy.EconomyService;
import com.kodari.citycore.gui.GUIListener;
import com.kodari.citycore.gui.GUIManager;
import com.kodari.citycore.listener.CityListener;
import com.kodari.citycore.message.MessageService;
import com.kodari.citycore.service.CityDisplayService;
import com.kodari.citycore.service.CityService;
import com.kodari.citycore.service.HologramService;
import com.kodari.citycore.storage.CityRepository;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class CityCorePlugin extends JavaPlugin {
private ConfigManager configManager;
private MessageService messageService;
private CityRepository repository;
private EconomyService economyService;
private CityService cityService;
private CityDisplayService displayService;
private GUIManager guiManager;
@Override
public void onEnable() {
this.configManager = new ConfigManager(this);
this.messageService = new MessageService(this, configManager);
this.repository = new CityRepository(this, configManager);
this.economyService = new EconomyService(this);
this.cityService = new CityService(this, repository, economyService, configManager);
this.displayService = new CityDisplayService(this, cityService, configManager, messageService);
this.guiManager = new GUIManager();
Bukkit.getPluginManager().registerEvents(new CityListener(this, cityService, displayService), this);
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
CityCommand command = new CityCommand(this, cityService, messageService, configManager, guiManager);
if (getCommand("city") != null) {
getCommand("city").setExecutor(command);
getCommand("city").setTabCompleter(command);
}
new HologramService(this).detect();
getLogger().info("CityCore enabled.");
}
@Override
public void onDisable() {
if (displayService != null) {
displayService.shutdown();
}
if (repository != null) {
repository.close();
}
getLogger().info("CityCore disabled.");
}
public CityService getCityService() {
return cityService;
}
}