TFGuilds/src/main/java/me/totalfreedom/tfguilds/command/GuildChatCommand.java

41 lines
1.1 KiB
Java
Raw Normal View History

2020-06-18 22:24:02 +00:00
package me.totalfreedom.tfguilds.command;
2020-06-18 18:05:49 +00:00
2020-06-18 22:24:02 +00:00
import me.totalfreedom.tfguilds.util.GBase;
import me.totalfreedom.tfguilds.util.GMessage;
2020-06-18 22:24:02 +00:00
import me.totalfreedom.tfguilds.util.GUtil;
2020-06-18 18:05:49 +00:00
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class GuildChatCommand extends GBase implements CommandExecutor
{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if (args.length == 0)
{
return false;
}
if (GUtil.isConsole(sender))
2020-06-18 18:05:49 +00:00
{
sender.sendMessage(GMessage.PLAYER_ONLY);
2020-06-18 18:05:49 +00:00
return true;
}
Player player = (Player) sender;
2020-06-18 18:05:49 +00:00
String guild = GUtil.getGuild(player);
2020-06-18 18:05:49 +00:00
if (guild == null)
{
sender.sendMessage(GMessage.NOT_IN_GUILD);
2020-06-18 18:05:49 +00:00
return true;
}
GUtil.guildChat(sender, StringUtils.join(args, " "), guild);
return true;
}
}