TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/bridge/TFGuildsBridge.java

60 lines
1.2 KiB
Java
Raw Normal View History

2020-07-21 19:21:51 +00:00
package me.totalfreedom.totalfreedommod.bridge;
import me.totalfreedom.tfguilds.Common;
import me.totalfreedom.tfguilds.TFGuilds;
import me.totalfreedom.totalfreedommod.FreedomService;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class TFGuildsBridge extends FreedomService
{
2020-08-01 04:10:44 +00:00
public boolean enabled = false;
2020-07-21 19:21:51 +00:00
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
2020-08-01 04:10:44 +00:00
public boolean isTFGuildsEnabled()
2020-07-21 19:21:51 +00:00
{
2020-08-01 04:10:44 +00:00
if (enabled)
2020-07-21 19:21:51 +00:00
{
2020-08-01 04:10:44 +00:00
return true;
}
try
{
final Plugin tfGuilds = server.getPluginManager().getPlugin("TFGuilds");
if (tfGuilds != null && tfGuilds.isEnabled())
2020-07-21 19:21:51 +00:00
{
2020-08-01 04:10:44 +00:00
if (tfGuilds instanceof TFGuilds)
2020-07-21 19:21:51 +00:00
{
2020-08-01 04:10:44 +00:00
enabled = true;
return true;
2020-07-21 19:21:51 +00:00
}
}
}
2020-08-01 04:10:44 +00:00
catch (NoClassDefFoundError ex)
{
return false;
}
return false;
2020-07-21 19:21:51 +00:00
}
public boolean inGuildChat(Player player)
{
2020-08-01 04:10:44 +00:00
if (!isTFGuildsEnabled())
{
return false;
}
2020-07-21 19:21:51 +00:00
return Common.IN_GUILD_CHAT.contains(player);
}
}