72 lines
1.8 KiB
Java
72 lines
1.8 KiB
Java
package hdvtdev.blockAndSeek;
|
|
|
|
import me.libraryaddict.disguise.LibsDisguises;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.CommandExecutor;
|
|
import org.bukkit.plugin.Plugin;
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.util.Objects;
|
|
import java.util.logging.Logger;
|
|
|
|
public class BlockAndSeek extends JavaPlugin implements CommandExecutor {
|
|
|
|
private static Plugin javaPlugin;
|
|
|
|
public static Plugin getInstance() {
|
|
return javaPlugin;
|
|
}
|
|
|
|
public static File getPluginDataFolder() {
|
|
return javaPlugin.getDataFolder();
|
|
}
|
|
|
|
public static InputStream getPluginResource(String resource) {
|
|
return javaPlugin.getResource(resource);
|
|
}
|
|
|
|
public static void saveResource(File file) {
|
|
saveResource(file.getAbsolutePath());
|
|
}
|
|
|
|
public static void saveResource(String file) {
|
|
javaPlugin.saveResource(file, false);
|
|
}
|
|
|
|
public static Logger getPluginLogger() {
|
|
return javaPlugin.getLogger();
|
|
}
|
|
|
|
@Override
|
|
public void onEnable() {
|
|
|
|
javaPlugin = this;
|
|
|
|
|
|
LibsDisguises libsDisguises = (LibsDisguises) Bukkit.getPluginManager().getPlugin("LibsDisguises");
|
|
if (libsDisguises == null) {
|
|
getLogger().severe("LibsDisguises not found! It's required for the plugin to work!");
|
|
super.onDisable();
|
|
}
|
|
|
|
try {
|
|
ConfigManager.loadAll();
|
|
} catch (IOException e) {
|
|
getLogger().severe("Failed to save some .yml configs!");
|
|
}
|
|
|
|
Objects.requireNonNull(getCommand("blockandseek")).setExecutor(new CommandListener());
|
|
getServer().getPluginManager().registerEvents(new EventListener(), this);
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onDisable() {
|
|
|
|
}
|
|
|
|
}
|