AddonsAPI - Added #getFolder() in BSModule

This commit is contained in:
Florian CUNY 2017-12-22 13:37:28 +01:00
parent 6178b768bb
commit 1c3b3a2c56
3 changed files with 21 additions and 0 deletions

View File

@ -20,6 +20,8 @@ import us.tastybento.bskyblock.managers.LocalesManager;
import us.tastybento.bskyblock.util.Util; import us.tastybento.bskyblock.util.Util;
import us.tastybento.bskyblock.util.nms.NMSAbstraction; import us.tastybento.bskyblock.util.nms.NMSAbstraction;
import java.io.File;
/** /**
* Main BSkyBlock class - provides an island minigame in the sky * Main BSkyBlock class - provides an island minigame in the sky
* @author Tastybento * @author Tastybento
@ -222,4 +224,9 @@ public class BSkyBlock extends JavaPlugin implements BSModule {
public boolean isAddon() { public boolean isAddon() {
return false; return false;
} }
@Override
public File getFolder() {
return getDataFolder();
}
} }

View File

@ -1,7 +1,10 @@
package us.tastybento.bskyblock.api; package us.tastybento.bskyblock.api;
import java.io.File;
public interface BSModule { public interface BSModule {
String getIdentifier(); String getIdentifier();
boolean isAddon(); boolean isAddon();
File getFolder();
} }

View File

@ -5,8 +5,11 @@ import us.tastybento.bskyblock.api.BSModule;
import us.tastybento.bskyblock.managers.CommandsManager; import us.tastybento.bskyblock.managers.CommandsManager;
import us.tastybento.bskyblock.managers.LocalesManager; import us.tastybento.bskyblock.managers.LocalesManager;
import java.io.File;
public abstract class BSAddon implements BSModule { public abstract class BSAddon implements BSModule {
private File folder;
private AddonDescription description; private AddonDescription description;
private AddonState state; private AddonState state;
@ -41,4 +44,12 @@ public abstract class BSAddon implements BSModule {
public boolean isAddon() { public boolean isAddon() {
return true; return true;
} }
@Override
public File getFolder() {
if (folder == null) {
folder = new File(BSkyBlock.getPlugin().getFolder() + "/addons/" + getIdentifier());
}
return folder;
}
} }