@telesphoreo :)))

This commit is contained in:
speedxx 2020-08-05 17:42:48 -04:00
parent 20528cec66
commit faeb098959
2 changed files with 21 additions and 7 deletions

View file

@ -32,7 +32,7 @@ public class InviteSubcommand extends Common implements CommandExecutor
Player player = (Player)sender;
Guild guild = Guild.getGuild(player);
Player invitee = Bukkit.getPlayer(args[1]);
if (invitee == null)
if (invitee == null || GUtil.isVanished(invitee))
{
sender.sendMessage(PNF);
return true;

View file

@ -1,17 +1,17 @@
package me.totalfreedom.tfguilds.util;
import java.util.ArrayList;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.metadata.MetadataValue;
public class GUtil
{
@ -54,9 +54,23 @@ public class GUtil
List<String> players = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers())
{
players.add(player.getName());
if (!isVanished(player))
{
players.add(player.getName());
}
}
return players;
}
public static boolean isVanished(Player player)
{
for (MetadataValue meta : player.getMetadata("vanished"))
{
if (meta.asBoolean())
{
return true;
}
}
return false;
}
}