mirror of
https://github.com/plexusorg/Module-TFMExtras.git
synced 2025-06-30 07:26:42 +00:00
Fix TFMExtras not working if SWM isn't enabled
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
@ -183,6 +183,10 @@ public class SlimeWorldHook implements IHook<SlimePlugin>
|
||||
{
|
||||
PlexLog.error(STORAGE_FAILURE);
|
||||
}
|
||||
catch (WorldLockedException | UnknownWorldException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
final World world = Bukkit.getWorld(uuid.toString());
|
||||
if (world == null)
|
||||
|
Reference in New Issue
Block a user