Збірка усіх плаґінів для WhoMine розроблених [MinersStudios](https://minersstudios.github.io).
/*
 * msUtils: A Minecraft plugin with custom features for WhoMine.
 */
package ua.com.minersstudios.whomine.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import lombok.*;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.World;
import ua.com.minersstudios.whomine.util.misc.WorldDark;
import static ua.com.minersstudios.whomine.util.i18n.*;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class MSUtil extends JavaPlugin
{
	/**
	 * @return a single instance of the class
	 */
	@Getter
	private static MSUtil instance;
	static { instance = new MSUtil(); }

	/**
	 * Ensure that required plugins are installed on a server, if not - disable itself.
	 */
	@Override
	public void onEnable()
	{
		List<String> expectedPluginNames = new ArrayList<>(Arrays.asList(
			"AuthMe", "ProtocolLib", "DiscordSRV"
		));

		for (String p : expectedPluginNames)
		{
			if (getServer().getPluginManager().getPlugin(p) == null)
			{
				getLogger().severe(i18n("Required dependencies unsatisfied."));
				getServer().getPluginManager().disablePlugin(instance);
				getLogger().warning("Am I still running?"); // Debug
				break;
			}
		}
	}

	/**
	 * @return a reference to an object representing World Dark
	 */
	@Getter
	private static World worldDark;
	static { worldDark = WorldDark.initialiseWorldDark(); }

	/**
	 * Confirm or deny the given player's existance in World Dark.
	 * @param player a given player
	 * @return true if player is in the World Dark, false otherwise
	 */
	public boolean isInWorldDark(Player player) { return player.getWorld().equals(worldDark); }
}