Split gcmd sub cmds out n other stuff

This commit is contained in:
Seth
2020-07-31 21:10:44 -07:00
parent 891e5c2f12
commit 76bb2d08ac
21 changed files with 431 additions and 255 deletions

View File

@ -3,14 +3,13 @@ package me.totalfreedom.totalfreedommod.bridge;
import me.totalfreedom.tfguilds.Common;
import me.totalfreedom.tfguilds.TFGuilds;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class TFGuildsBridge extends FreedomService
{
private TFGuilds tfGuildsPlugin = null;
public boolean enabled = false;
@Override
public void onStart()
@ -22,31 +21,39 @@ public class TFGuildsBridge extends FreedomService
{
}
public TFGuilds getTfGuildsPlugin()
public boolean isTFGuildsEnabled()
{
if (tfGuildsPlugin == null)
if (enabled)
{
try
return true;
}
try
{
final Plugin tfGuilds = server.getPluginManager().getPlugin("TFGuilds");
if (tfGuilds != null && tfGuilds.isEnabled())
{
final Plugin tfGuilds = server.getPluginManager().getPlugin("TFGuilds");
if (tfGuilds != null)
if (tfGuilds instanceof TFGuilds)
{
if (tfGuilds instanceof TFGuilds)
{
tfGuildsPlugin = (TFGuilds)tfGuilds;
}
enabled = true;
return true;
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
return tfGuildsPlugin;
catch (NoClassDefFoundError ex)
{
return false;
}
return false;
}
public boolean inGuildChat(Player player)
{
if (!isTFGuildsEnabled())
{
return false;
}
return Common.IN_GUILD_CHAT.contains(player);
}
}