kenshinshideandseek/src/main/java/net/tylermurphy/hideAndSeek/Main.java

60 lines
1.5 KiB
Java
Raw Normal View History

2021-08-13 20:49:36 +00:00
package net.tylermurphy.hideAndSeek;
import static net.tylermurphy.hideAndSeek.Store.*;
import java.util.List;
2021-08-13 20:49:36 +00:00
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import net.tylermurphy.hideAndSeek.events.EventListener;
import net.tylermurphy.hideAndSeek.events.EventTick;
2021-08-13 20:49:36 +00:00
public class Main extends JavaPlugin implements Listener {
public static Main plugin;
public void onEnable() {
plugin = this;
// Setup Initial Player Count
getServer().getPluginManager().registerEvents(new EventListener(), this);
2021-08-13 20:49:36 +00:00
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
playerList.put(player.getName(), player);
}
// Init Configuration
Store.loadConfig();
2021-08-13 20:49:36 +00:00
// Register Commands
CommandHandler.registerCommands();
2021-08-13 20:49:36 +00:00
// Start Tick Timer
2021-08-18 23:21:59 +00:00
Bukkit.getServer().getScheduler().runTaskTimer(this, new Runnable(){
2021-08-13 20:49:36 +00:00
public void run(){
2021-08-18 23:21:59 +00:00
try{
EventTick.onTick();
2021-08-18 23:21:59 +00:00
} catch (Exception e) {
e.printStackTrace();
}
2021-08-13 20:49:36 +00:00
}
2021-08-18 23:21:59 +00:00
},0,1);
2021-08-13 20:49:36 +00:00
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
return CommandHandler.handleCommand(sender, cmd, label, args);
}
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
return CommandTabCompleter.handleTabComplete(sender, command, label, args);
2021-08-13 20:49:36 +00:00
}
}