Files
src
pom.xml
Code
21 979
src/main/java/com/starhome/StarHome.java
package com.starhome;
import com.starhome.command.HomeCommand;
import com.starhome.config.StarHomeConfig;
import com.starhome.gui.GUIListener;
import com.starhome.listener.TeleportListener;
import com.starhome.manager.HomeManager;
import com.starhome.manager.TeleportManager;
import com.starhome.scheduler.SchedulerAdapter;
import com.starhome.storage.YamlStorageManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class StarHome extends JavaPlugin {
private StarHomeConfig configuration;
private SchedulerAdapter scheduler;
private HomeManager homes;
private TeleportManager teleports;
@Override
public void onEnable() {
saveDefaultConfig();
configuration = new StarHomeConfig(getConfig());
scheduler = new SchedulerAdapter(this);
homes = new HomeManager(new YamlStorageManager(getDataFolder()));
teleports = new TeleportManager(this);
HomeCommand command = new HomeCommand(this);
getCommand("home").setExecutor(command);
getCommand("home").setTabCompleter(command);
Bukkit.getPluginManager().registerEvents(new GUIListener(), this);
Bukkit.getPluginManager().registerEvents(new TeleportListener(this), this);
}
@Override
public void onDisable() {
if (homes != null) {
homes.saveAll();
}
}
public StarHomeConfig getConfiguration() {
return configuration;
}
public SchedulerAdapter getScheduler() {
return scheduler;
}
public HomeManager getHomes() {
return homes;
}
public TeleportManager getTeleports() {
return teleports;
}
public String message(String key, String... replacements) {
return configuration.message(key, replacements);
}
}