Files
src
manifest.kod
pom.xml
README.md
Code
24 1,236
src/main/java/com/kodari/starhome/StarHomePlugin.java
package com.kodari.starhome;
import com.kodari.starhome.command.HomeCommand;
import com.kodari.starhome.gui.MenuManager;
import com.kodari.starhome.listener.StarHomeListener;
import com.kodari.starhome.service.ChatInputService;
import com.kodari.starhome.service.ConfigService;
import com.kodari.starhome.service.HomeService;
import com.kodari.starhome.service.MessageService;
import com.kodari.starhome.service.PermissionService;
import com.kodari.starhome.service.SoundService;
import com.kodari.starhome.service.TeleportService;
import com.kodari.starhome.storage.HomeStorage;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class StarHomePlugin extends JavaPlugin {
private ConfigService configService;
private MessageService messages;
private PermissionService permissions;
private HomeService homes;
private MenuManager menus;
private SoundService sounds;
private TeleportService teleports;
private ChatInputService inputs;
@Override public void onEnable() {
saveDefaultConfig();
configService = new ConfigService(this);
initializeServices();
HomeCommand command = new HomeCommand(this);
if (getCommand("home") != null) { getCommand("home").setExecutor(command); getCommand("home").setTabCompleter(command); }
Bukkit.getPluginManager().registerEvents(new StarHomeListener(this, menus), this);
getLogger().info("StarHome enabled with Folia-compatible scheduling.");
}
private void initializeServices() {
messages = new MessageService(this, configService);
permissions = new PermissionService(configService);
homes = new HomeService(new HomeStorage(this), configService, permissions);
menus = new MenuManager(this);
sounds = new SoundService(this);
teleports = new TeleportService(this);
inputs = new ChatInputService(this);
}
public void reloadServices() {
teleports.cancelAll();
configService.reload();
initializeServices();
}
public ConfigService config() { return configService; }
public MessageService messages() { return messages; }
public PermissionService permissions() { return permissions; }
public HomeService homes() { return homes; }
public MenuManager menus() { return menus; }
public SoundService sounds() { return sounds; }
public TeleportService teleports() { return teleports; }
public ChatInputService inputs() { return inputs; }
@Override public void onDisable() {
if (teleports != null) teleports.cancelAll();
if (homes != null) homes.persist();
if (homes != null) homes.shutdown();
}
}