All checks were successful
Build Plugin / build-test (push) Successful in 44s
- Fix Status Color Bug - Add /playtime - Add /timer
80 lines
2.6 KiB
Java
80 lines
2.6 KiB
Java
package de.npid7.serverlite;
|
|
|
|
import de.npid7.serverlite.Commands.D7Command;
|
|
import de.npid7.serverlite.Commands.PlaytimeCommand;
|
|
import de.npid7.serverlite.Commands.StatusCommand;
|
|
import de.npid7.serverlite.Commands.TimerCommand;
|
|
import de.npid7.serverlite.Configs.PlayerConfig;
|
|
import de.npid7.serverlite.Configs.PluginConfig;
|
|
import de.npid7.serverlite.Listeners.JoinListener;
|
|
import de.npid7.serverlite.TabCompleters.D7Completer;
|
|
import de.npid7.serverlite.TabCompleters.PlaytimeCompleter;
|
|
import de.npid7.serverlite.TabCompleters.StatusCompleter;
|
|
import de.npid7.serverlite.TabCompleters.TimerCompleter;
|
|
import de.npid7.serverlite.Tasks.TablistTask;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
/*
|
|
* d7serverlite java plugin
|
|
*/
|
|
public class D7ServerLite extends JavaPlugin {
|
|
// Declare static Instance To access with getInst();
|
|
// using this to access Configs from this Class
|
|
private static D7ServerLite inst;
|
|
|
|
// declare TablistTask and Configs
|
|
private TablistTask tablistUpdater;
|
|
private PluginConfig pluginConfig;
|
|
private PlayerConfig playerConfig;
|
|
|
|
// Override onLoad to set static inst to this class
|
|
@Override
|
|
public void onLoad() {
|
|
inst = this;
|
|
}
|
|
|
|
// Override on Enabel to init the Plugin
|
|
@Override
|
|
public void onEnable() {
|
|
// Create Data Folder
|
|
if (!getDataFolder().exists()) {
|
|
getDataFolder().mkdirs();
|
|
}
|
|
// Init Configs
|
|
pluginConfig = new PluginConfig(getDataFolder() + "/config.json");
|
|
playerConfig = new PlayerConfig(getDataFolder() + "/player_config.json");
|
|
// Run Tablist Updater
|
|
tablistUpdater = new TablistTask();
|
|
// declare commands
|
|
getCommand("status").setExecutor(new StatusCommand());
|
|
getCommand("status").setTabCompleter(new StatusCompleter());
|
|
getCommand("d7").setExecutor(new D7Command());
|
|
getCommand("d7").setTabCompleter(new D7Completer());
|
|
getCommand("timer").setExecutor(new TimerCommand());
|
|
getCommand("trimer").setTabCompleter(new TimerCompleter());
|
|
getCommand("playtime").setExecutor(new PlaytimeCommand());
|
|
getCommand("playtime").setTabCompleter(new PlaytimeCompleter());
|
|
|
|
// Register onJoin Event to generate PlayerConfigEntry
|
|
Bukkit.getPluginManager().registerEvents(new JoinListener(), this);
|
|
}
|
|
|
|
/**
|
|
* Getters declared below
|
|
*/
|
|
|
|
public static D7ServerLite getInst() {
|
|
return inst;
|
|
}
|
|
|
|
public PluginConfig getPluginConfig() {
|
|
return this.pluginConfig;
|
|
}
|
|
|
|
public PlayerConfig getPlayerConfig() {
|
|
return this.playerConfig;
|
|
}
|
|
}
|