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

75 lines
1.9 KiB
Java
Raw Normal View History

2021-08-13 20:49:36 +00:00
package net.tylermurphy.hideAndSeek;
2021-08-27 21:20:07 +00:00
import java.io.File;
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.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
2021-09-01 01:55:27 +00:00
import org.bukkit.scheduler.BukkitTask;
2021-08-13 20:49:36 +00:00
2021-09-01 01:55:27 +00:00
import net.tylermurphy.hideAndSeek.bukkit.CommandHandler;
import net.tylermurphy.hideAndSeek.bukkit.EventListener;
import net.tylermurphy.hideAndSeek.bukkit.TabCompleter;
import net.tylermurphy.hideAndSeek.bukkit.Tick;
import net.tylermurphy.hideAndSeek.events.Glow;
import net.tylermurphy.hideAndSeek.events.Taunt;
import net.tylermurphy.hideAndSeek.events.Worldborder;
2021-08-13 20:49:36 +00:00
public class Main extends JavaPlugin implements Listener {
public static Main plugin;
2021-08-27 21:20:07 +00:00
public static File root;
2021-08-13 20:49:36 +00:00
2021-09-01 01:55:27 +00:00
public static Taunt taunt;
public static Glow glow;
public static Worldborder worldborder;
private BukkitTask onTickTask;
2021-08-13 20:49:36 +00:00
public void onEnable() {
plugin = this;
// Setup Initial Player Count
getServer().getPluginManager().registerEvents(new EventListener(), this);
2021-08-13 20:49:36 +00:00
// Init Configuration
Store.loadConfig();
2021-08-13 20:49:36 +00:00
// Register Commands
CommandHandler.registerCommands();
2021-08-13 20:49:36 +00:00
2021-08-27 21:20:07 +00:00
// Get Data Folder
root = this.getServer().getWorldContainer();
2021-08-13 20:49:36 +00:00
// Start Tick Timer
2021-09-01 01:55:27 +00:00
onTickTask = 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{
2021-09-01 01:55:27 +00:00
Tick.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
}
2021-09-01 01:55:27 +00:00
public void onDisable() {
onTickTask.cancel();
}
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) {
2021-09-01 01:55:27 +00:00
return TabCompleter.handleTabComplete(sender, command, label, args);
2021-08-13 20:49:36 +00:00
}
}