idk some "cool" stuff
This commit is contained in:
@@ -3,34 +3,63 @@ 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 File dataFolder;
|
||||
private static Plugin javaPlugin;
|
||||
|
||||
public static Plugin getInstance() {
|
||||
return javaPlugin;
|
||||
}
|
||||
|
||||
public static File getPluginDataFolder() {
|
||||
return dataFolder;
|
||||
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() {
|
||||
|
||||
dataFolder = getDataFolder();
|
||||
javaPlugin = this;
|
||||
|
||||
|
||||
LibsDisguises libsDisguises = (LibsDisguises) Bukkit.getPluginManager().getPlugin("LibsDisguises");
|
||||
if (libsDisguises == null) {
|
||||
getLogger().severe("LibsDisguises не найден!");
|
||||
getLogger().severe("LibsDisguises not found! It's required for the plugin to work!");
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
Localization.load(this);
|
||||
ConfigManager.load();
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user