This commit is contained in:
Super_ 2020-06-18 11:39:30 -04:00
parent 2e16d257e5
commit 338fd7b40e
3 changed files with 51 additions and 0 deletions

View file

@ -78,5 +78,10 @@
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.totalfreedom</groupId>
<artifactId>totalfreedom</artifactId>
<version>5.2</version>
</dependency>
</dependencies>
</project>

View file

@ -1,6 +1,7 @@
package totalfreedom.tfguilds;
import org.bukkit.plugin.java.JavaPlugin;
import totalfreedom.tfguilds.bridge.TFMBridge;
import totalfreedom.tfguilds.command.CreateGuildCommand;
import totalfreedom.tfguilds.command.TfGuildsCommand;
import totalfreedom.tfguilds.config.Config;
@ -11,6 +12,7 @@ public final class TFGuilds extends JavaPlugin
public static TFGuilds plugin;
public Config config;
public Config guilds;
public TFMBridge tfmb;
@Override
public void onEnable()
@ -19,6 +21,7 @@ public final class TFGuilds extends JavaPlugin
enableCommands();
config = new Config(plugin, "config.yml");
guilds = new Config(plugin, "guilds.yml");
tfmb = new TFMBridge();
GLog.info("Enabled");
}

View file

@ -0,0 +1,43 @@
package totalfreedom.tfguilds.bridge;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import totalfreedom.tfguilds.TFGuilds;
public class TFMBridge
{
private TFGuilds plugin;
private TotalFreedomMod tfmPlugin;
public TFMBridge()
{
this.plugin = TFGuilds.plugin;
this.tfmPlugin = null;
}
public TotalFreedomMod getTFM()
{
if (tfmPlugin == null)
{
try
{
final Plugin tfm = plugin.getServer().getPluginManager().getPlugin("TotalFreedomMod");
if (tfm != null && tfm instanceof TotalFreedomMod)
{
tfmPlugin = (TotalFreedomMod) tfm;
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
return tfmPlugin;
}
public boolean isAdmin(Player player)
{
return tfmPlugin.al.isAdmin(player);
}
}