mirror of
https://github.com/plexusorg/Module-TFMExtras.git
synced 2025-07-06 22:11:28 +00:00
Fix TFMExtras not working if SWM isn't enabled
This commit is contained in:
parent
fb724fb104
commit
a4c0c1c003
5 changed files with 33 additions and 13 deletions
|
@ -34,7 +34,7 @@ public class TFMExtras extends PlexModule
|
|||
private ModuleConfig config;
|
||||
|
||||
@Getter
|
||||
private final SlimeWorldHook slimeWorldHook = new SlimeWorldHook();
|
||||
private SlimeWorldHook slimeWorldHook;
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
|
@ -43,6 +43,10 @@ public class TFMExtras extends PlexModule
|
|||
config = new ModuleConfig(this, "tfmextras/config.yml", "config.yml");
|
||||
config.load();
|
||||
jumpPads = new JumpPads();
|
||||
if (swmEnabled())
|
||||
{
|
||||
slimeWorldHook = new SlimeWorldHook();
|
||||
}
|
||||
// PlexLog.debug(String.valueOf(config.getInt("server.jumppad_strength")));
|
||||
// PlexLog.log("Test map: {0}", StringUtils.join(SQLUtil.createTable(Lists.newArrayList(), PlayerWorld.class), "\n"));
|
||||
}
|
||||
|
@ -50,14 +54,13 @@ public class TFMExtras extends PlexModule
|
|||
@Override
|
||||
public void enable()
|
||||
{
|
||||
if (slimeWorldHook.plugin() != null)
|
||||
if (swmEnabled())
|
||||
{
|
||||
slimeWorldHook.onEnable(this);
|
||||
registerCommand(new SlimeManagerCommand());
|
||||
registerCommand(new MyWorldCommand());
|
||||
}
|
||||
|
||||
|
||||
getClassesFrom("dev.plex.extras.command").forEach(aClass ->
|
||||
{
|
||||
if (PlexCommand.class.isAssignableFrom(aClass) && aClass.isAnnotationPresent(CommandParameters.class) && aClass.isAnnotationPresent(CommandPermissions.class))
|
||||
|
@ -152,4 +155,17 @@ public class TFMExtras extends PlexModule
|
|||
|
||||
return Collections.unmodifiableSet(classes);
|
||||
}
|
||||
|
||||
private boolean swmEnabled()
|
||||
{
|
||||
try
|
||||
{
|
||||
Class.forName("com.infernalsuite.aswm.api.exceptions.UnknownWorldException");
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue