/**
* Destroys the instance, and removes it from the config "instances.yml"
*/
public void destroy(){
instanceFinishEvent event = new instanceFinishEvent(getHomeLocation().getWorld().getChunkAt(chunkX, chunkZ));
Bukkit.getServer().getPluginManager().callEvent(event);
IDinstance.remove(getID());
instanceLocation.remove(world + chunkX + chunkZ);
YamlConfiguration instances = YamlConfiguration.loadConfiguration(new File(InstancesBase.plugin.getDataFolder(),"instances.yml"));
List<String> list = instances.getStringList(type.toString());
if (list != null){
if (list.contains(world + ":" + chunkX + ":" + chunkZ)){
list.remove(world + ":" + chunkX + ":" + chunkZ);
instances.set(type.toString(), list);
try {
instances.save(new File(InstancesBase.plugin.getDataFolder(),"instances.yml"));
} catch (IOException e) {
System.out.print("Unable to save the 'instances.yml'. Is the disk full?");
}
}
}
}
Comments
0 B
|👍
/👎