You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.7 KiB
Java

4 years ago
package eu.railduction.ruakij.spawnerDrops;
import eu.railduction.ruakij.spawnerDrops.listener.OnBlockBreak;
import eu.railduction.ruakij.spawnerDrops.listener.OnBlockPlace;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
4 years ago
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
4 years ago
import java.io.File;
4 years ago
public class Main extends JavaPlugin {
4 years ago
4 years ago
public static Plugin plugin;
public static FileConfiguration config;
public static FileConfiguration data;
public void onEnable() {
4 years ago
plugin = this;
PluginManager pluginManager = Bukkit.getPluginManager();
pluginManager.registerEvents(new OnBlockPlace(), this);
pluginManager.registerEvents(new OnBlockBreak(), this);
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("plugins/SpawnerDrops/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();
}
4 years ago
}