diff --git a/pom.xml b/pom.xml index f96ce0b..7b78990 100644 --- a/pom.xml +++ b/pom.xml @@ -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> diff --git a/src/main/java/totalfreedom/tfguilds/TFGuilds.java b/src/main/java/totalfreedom/tfguilds/TFGuilds.java index 73be016..0df33fc 100644 --- a/src/main/java/totalfreedom/tfguilds/TFGuilds.java +++ b/src/main/java/totalfreedom/tfguilds/TFGuilds.java @@ -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"); } diff --git a/src/main/java/totalfreedom/tfguilds/bridge/TFMBridge.java b/src/main/java/totalfreedom/tfguilds/bridge/TFMBridge.java new file mode 100644 index 0000000..fb9ceb0 --- /dev/null +++ b/src/main/java/totalfreedom/tfguilds/bridge/TFMBridge.java @@ -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); + } +} \ No newline at end of file