Fix KCauldron dependency loading - closes #121

This commit is contained in:
Luck 2017-01-09 18:20:03 +00:00
parent 7042c45deb
commit 055d181c67
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
5 changed files with 43 additions and 1 deletions

View File

@ -416,6 +416,16 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
return PlatformType.BUKKIT;
}
@Override
public String getServerName() {
return getServer().getName();
}
@Override
public String getServerVersion() {
return getServer().getVersion();
}
@Override
public File getMainDir() {
return getDataFolder();

View File

@ -223,6 +223,16 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
return PlatformType.BUNGEE;
}
@Override
public String getServerName() {
return getProxy().getName();
}
@Override
public String getServerVersion() {
return getProxy().getVersion();
}
@Override
public File getMainDir() {
return getDataFolder();

View File

@ -215,6 +215,18 @@ public interface LuckPermsPlugin {
*/
PlatformType getType();
/**
* Gets the name or "brand" of the running platform
* @return the server brand
*/
String getServerName();
/**
* Gets the version of the running platform
* @return the server version
*/
String getServerVersion();
/**
* Gets the plugins main directory
*

View File

@ -130,7 +130,7 @@ public class DependencyManager {
private static void loadJar(LuckPermsPlugin plugin, File file, String baseClass) throws Exception {
URLClassLoader classLoader = (URLClassLoader) plugin.getClass().getClassLoader();
if (plugin.getType() != PlatformType.SPONGE) {
if (plugin.getType() != PlatformType.SPONGE && !plugin.getServerName().equals("KCauldron")) {
classLoader = (URLClassLoader) classLoader.getParent();
}

View File

@ -374,6 +374,16 @@ public class LPSpongePlugin implements LuckPermsPlugin {
return PlatformType.SPONGE;
}
@Override
public String getServerName() {
return getGame().getPlatform().getType().name();
}
@Override
public String getServerVersion() {
return getGame().getPlatform().getApi().getVersion().orElse("null") + " - " + getGame().getPlatform().getImplementation().getVersion().orElse("null");
}
@Override
public int getPlayerCount() {
return game.getServer().getOnlinePlayers().size();