check if tfm isn't detected

This commit is contained in:
speedxx 2020-08-07 15:35:26 -04:00
parent faeb098959
commit 8fd15988e0
6 changed files with 22 additions and 9 deletions

View file

@ -1,14 +1,13 @@
package me.totalfreedom.tfguilds;
import me.totalfreedom.tfguilds.config.ConfigEntry;
import me.totalfreedom.tfguilds.guild.Guild;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import me.totalfreedom.tfguilds.config.ConfigEntry;
import me.totalfreedom.tfguilds.guild.Guild;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class Common
{

View file

@ -15,6 +15,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public final class TFGuilds extends JavaPlugin
{
private static TFGuilds plugin;
public static TFGuilds getPlugin()
{
return plugin;

View file

@ -1,6 +1,7 @@
package me.totalfreedom.tfguilds.bridge;
import me.totalfreedom.tfguilds.TFGuilds;
import me.totalfreedom.tfguilds.util.GLog;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -39,11 +40,23 @@ public class TFMBridge
public boolean isAdmin(Player player)
{
if (getTFM() == null)
{
GLog.warn("TFM not detected on the server. Checking if player is OP...");
return player.isOp();
}
return getTFM().al.isAdmin(player);
}
public boolean isAdmin(CommandSender sender)
{
if (getTFM() == null)
{
GLog.warn("TFM not detected on the server. Checking if sender is OP...");
return sender.isOp();
}
return getTFM().al.isAdmin(sender);
}
}

View file

@ -1,5 +1,6 @@
package me.totalfreedom.tfguilds.command;
import java.util.List;
import me.totalfreedom.tfguilds.Common;
import me.totalfreedom.tfguilds.guild.Guild;
import org.apache.commons.lang.StringUtils;
@ -8,8 +9,6 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import java.util.List;
public class ListSubcommand extends Common implements CommandExecutor
{
@Override

View file

@ -305,7 +305,9 @@ public class Guild
if (sender != null)
{
if (player == sender)
{
continue;
}
}
player.sendMessage(GUtil.colorize("&7[GUILD CHAT SPY | " + GUtil.colorize(name) + "] " + as + ": " + msg));
}

View file

@ -1,11 +1,10 @@
package me.totalfreedom.tfguilds.guild;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.tfguilds.TFGuilds;
import java.util.List;
public class GuildRank
{
private static TFGuilds plugin = TFGuilds.getPlugin();