@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; Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
Player invitee = Bukkit.getPlayer(args[1]); Player invitee = Bukkit.getPlayer(args[1]);
if (invitee == null) if (invitee == null || GUtil.isVanished(invitee))
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;

View file

@ -1,17 +1,17 @@
package me.totalfreedom.tfguilds.util; 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.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; 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.entity.Player;
import org.bukkit.metadata.MetadataValue;
public class GUtil public class GUtil
{ {
@ -53,10 +53,24 @@ public class GUtil
{ {
List<String> players = new ArrayList<>(); List<String> players = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{
if (!isVanished(player))
{ {
players.add(player.getName()); players.add(player.getName());
} }
}
return players; return players;
} }
public static boolean isVanished(Player player)
{
for (MetadataValue meta : player.getMetadata("vanished"))
{
if (meta.asBoolean())
{
return true;
}
}
return false;
}
} }