Load additional config
parent
6759e1ab59
commit
5444f75c21
@ -1,7 +1,51 @@
|
||||
package eu.railduction.ruakij.spawnerDrops;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
public static FileConfiguration config;
|
||||
public static FileConfiguration data;
|
||||
|
||||
public void onEnable() {
|
||||
|
||||
PluginManager PluginManager = Bukkit.getPluginManager();
|
||||
|
||||
loadConfigs();
|
||||
|
||||
getLogger().info("Plugin activated");
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
|
||||
getLogger().info("Plugin deactivated");
|
||||
}
|
||||
|
||||
public void loadConfigs() {
|
||||
this.saveDefaultConfig();
|
||||
config = this.getConfig();
|
||||
|
||||
try{
|
||||
File dataFile = new File("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);
|
||||
}
|
||||
}
|
||||
|
||||
public static String serialiseLocation(Location loc){
|
||||
return loc.getWorld().getName()+";"+loc.getBlockX()+";"+loc.getBlockY()+";"+loc.getBlockZ();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue