Initialising project
parent
a850972224
commit
92718de5a9
@ -0,0 +1,54 @@
|
||||
package eu.ruekov.ruakij.LinkedBeaconTeleporters;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
public static Plugin plugin;
|
||||
|
||||
public static FileConfiguration config;
|
||||
public static FileConfiguration data;
|
||||
|
||||
public void onEnable() {
|
||||
|
||||
plugin = this;
|
||||
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
|
||||
|
||||
loadConfigs();
|
||||
|
||||
getLogger().info("Plugin activated");
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
|
||||
getLogger().info("Plugin deactivated");
|
||||
}
|
||||
|
||||
public void loadConfigs() {
|
||||
// config.yml
|
||||
this.saveDefaultConfig();
|
||||
config = this.getConfig();
|
||||
|
||||
// data.yml
|
||||
try{
|
||||
File dataFile = new File("plugins/"+ plugin.getName() +"/data.yml");
|
||||
dataFile.createNewFile();
|
||||
data = YamlConfiguration.loadConfiguration(
|
||||
dataFile
|
||||
);
|
||||
}catch (Exception ex){
|
||||
getLogger().severe("Could not load/create data.yml!");
|
||||
ex.printStackTrace();
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
name: ${artifactId}
|
||||
version: ${version}
|
||||
author: ${author}
|
||||
main: ${groupId}.${artifactId}.Main
|
Loading…
Reference in New Issue