2020-07-29 21:03:05 +00:00
|
|
|
package me.totalfreedom.tfguilds.command;
|
|
|
|
|
|
|
|
import me.totalfreedom.tfguilds.Common;
|
2021-05-22 04:26:48 +00:00
|
|
|
import org.bukkit.ChatColor;
|
2020-07-29 21:03:05 +00:00
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
public class GuildChatSpyCommand extends Common implements CommandExecutor
|
|
|
|
{
|
2021-05-22 04:26:48 +00:00
|
|
|
|
2020-07-29 21:03:05 +00:00
|
|
|
@Override
|
2021-05-22 04:26:48 +00:00
|
|
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
|
2020-07-29 21:03:05 +00:00
|
|
|
{
|
2021-05-22 04:26:48 +00:00
|
|
|
if (!(sender instanceof Player))
|
2020-07-29 21:03:05 +00:00
|
|
|
{
|
2021-05-22 04:26:48 +00:00
|
|
|
sender.sendMessage(PREFIX + "Console can already view guild chat.");
|
2020-07-29 21:03:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-05-22 04:26:48 +00:00
|
|
|
if (!tfmBridge.isAdmin(sender))
|
2020-07-29 21:03:05 +00:00
|
|
|
{
|
2021-05-22 04:26:48 +00:00
|
|
|
sender.sendMessage(PREFIX + "You do not have the permission.");
|
2020-07-29 21:03:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Player player = (Player)sender;
|
2021-05-22 04:26:48 +00:00
|
|
|
if (GUILD_CHAT_SPY.contains(player))
|
2020-07-29 21:03:05 +00:00
|
|
|
{
|
2021-05-22 04:26:48 +00:00
|
|
|
GUILD_CHAT_SPY.remove(player);
|
|
|
|
sender.sendMessage(PREFIX + ChatColor.GOLD + "Disabled " + ChatColor.GRAY + "guild chat spy.");
|
2020-07-29 21:03:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-05-22 04:26:48 +00:00
|
|
|
GUILD_CHAT_SPY.add(player);
|
|
|
|
sender.sendMessage(PREFIX + ChatColor.GOLD + "Enabled " + ChatColor.GRAY + "guild chat spy.");
|
2020-07-29 21:03:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
2021-05-22 04:26:48 +00:00
|
|
|
}
|