ActionHealth/src/main/java/com/zeshanaslam/actionhealth/Main.java

77 lines
2.4 KiB
Java
Raw Normal View History

2017-03-10 18:04:15 +01:00
package com.zeshanaslam.actionhealth;
import com.zeshanaslam.actionhealth.action.ActionHelper;
import com.zeshanaslam.actionhealth.action.ActionListener;
import com.zeshanaslam.actionhealth.action.ActionTask;
import com.zeshanaslam.actionhealth.commands.HealthCommand;
import com.zeshanaslam.actionhealth.config.ConfigStore;
import com.zeshanaslam.actionhealth.events.HealthListeners;
import com.zeshanaslam.actionhealth.utils.HealthUtil;
2021-06-13 00:42:20 +02:00
import com.zeshanaslam.actionhealth.utils.Metrics;
2017-03-20 06:15:09 +01:00
import org.bukkit.Bukkit;
2017-03-10 18:04:15 +01:00
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
2017-03-10 18:04:15 +01:00
2017-03-20 06:15:09 +01:00
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
2017-03-10 18:04:15 +01:00
public class Main extends JavaPlugin {
public ConfigStore configStore;
public boolean worldGuardEnabled;
2017-03-20 06:15:09 +01:00
public HealthUtil healthUtil;
public int taskID = -1;
2019-08-04 20:59:35 +02:00
public boolean mcMMOEnabled;
public boolean mythicMobsEnabled;
public boolean langUtilsEnabled;
public BukkitTask actionTask;
2021-06-11 02:26:59 +02:00
public Metrics metrics;
2017-03-20 06:15:09 +01:00
public List<UUID> toggle = new ArrayList<>();
2017-03-10 18:04:15 +01:00
@Override
2017-03-20 06:15:09 +01:00
public void onEnable() {
2017-03-10 18:04:15 +01:00
saveDefaultConfig();
2017-03-20 06:15:09 +01:00
// Register health util
this.healthUtil = new HealthUtil(this);
2017-03-10 18:04:15 +01:00
// Load config settings
configStore = new ConfigStore(this);
2017-03-10 18:04:15 +01:00
2017-03-20 06:15:09 +01:00
// Create player folder
File file = new File("plugins/ActionHealth/players/");
file.mkdirs();
// Register listeners
getServer().getPluginManager().registerEvents(new HealthListeners(this), this);
getServer().getPluginManager().registerEvents(new ActionListener(this, new ActionHelper(this)), this);
// Register commands
2017-03-20 06:15:09 +01:00
getCommand("Actionhealth").setExecutor(new HealthCommand(this));
2017-03-10 18:04:15 +01:00
worldGuardEnabled = Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard");
2019-08-04 20:59:35 +02:00
if (Bukkit.getServer().getPluginManager().isPluginEnabled("mcMMO")) {
mcMMOEnabled = true;
}
if (Bukkit.getServer().getPluginManager().isPluginEnabled("MythicMobs")) {
mythicMobsEnabled = true;
}
2019-08-08 18:20:59 +02:00
if (Bukkit.getServer().getPluginManager().isPluginEnabled("LangUtils")) {
2019-08-08 18:20:59 +02:00
langUtilsEnabled = true;
}
actionTask = new ActionTask(this).runTaskTimer(this, 0, configStore.checkTicks);
2017-03-10 18:04:15 +01:00
}
@Override
public void onDisable() {
}
}