org.bukkit.Bukkit.getPlayerExact()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.bukkit.Bukkit.getPlayerExact()方法的一些代码示例,展示了Bukkit.getPlayerExact()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.getPlayerExact()方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:getPlayerExact

Bukkit.getPlayerExact介绍

暂无

代码示例

代码示例来源:origin: Bukkit/Bukkit

@Override
  public boolean execute(CommandSender sender, String currentAlias, String[] args) {
    if (!testPermission(sender)) return true;
    if (args.length < 2)  {
      sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
      return false;
    }

    Player player = Bukkit.getPlayerExact(args[0]);

    // If a player is hidden from the sender pretend they are offline
    if (player == null || (sender instanceof Player && !((Player) sender).canSee(player))) {
      sender.sendMessage("There's no player by that name online.");
    } else {
      StringBuilder message = new StringBuilder();

      for (int i = 1; i < args.length; i++) {
        if (i > 1) message.append(" ");
        message.append(args[i]);
      }

      String result = ChatColor.GRAY + sender.getName() + " whispers " + message;

      sender.sendMessage("[" + sender.getName() + "->" + player.getName() + "] " + message);
      player.sendMessage(result);
    }

    return true;
  }
}

代码示例来源:origin: Bukkit/Bukkit

@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
  if (!testPermission(sender)) return true;
  if (args.length < 1 || args[0].length() == 0) {
    sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
    return false;
  }
  Player player = Bukkit.getPlayerExact(args[0]);
  if (player != null) {
    String reason = "Kicked by an operator.";
    if (args.length > 1) {
      reason = createString(args, 1);
    }
    player.kickPlayer(reason);
    Command.broadcastCommandMessage(sender, "Kicked player " + player.getName() + ". With reason:\n" + reason);
  } else {
    sender.sendMessage( args[0] + " not found.");
  }
  return true;
}

代码示例来源:origin: Bukkit/Bukkit

Player player = Bukkit.getPlayerExact(args[i]);
if (player == null) {
  continue;

代码示例来源:origin: GlowstoneMC/Glowstone

Player player = Bukkit.getPlayerExact(args[0]);

代码示例来源:origin: Bukkit/Bukkit

Player player = Bukkit.getPlayerExact(args[0]);
if (player == null) {
  sender.sendMessage("Can't find player " + args[0]);

代码示例来源:origin: Bukkit/Bukkit

Player player = Bukkit.getPlayerExact(args[0]);

代码示例来源:origin: GlowstoneMC/Glowstone

player = sender instanceof Player ? (Player) sender : null;
} else {
  player = Bukkit.getPlayerExact(playerPattern);

代码示例来源:origin: GlowstoneMC/Glowstone

.map(GlowPlayer.class::cast);
} else {
  GlowPlayer player = (GlowPlayer) Bukkit.getPlayerExact(args[0]);
  if (player == null) {
    commandMessages.getNoSuchPlayer().sendInColor(ChatColor.RED, sender, name);

代码示例来源:origin: Bukkit/Bukkit

Player player = Bukkit.getPlayerExact(playerArg);

代码示例来源:origin: GlowstoneMC/Glowstone

.collect(Collectors.toList());
} else {
  GlowPlayer player = (GlowPlayer) Bukkit.getPlayerExact(args[0]);
  if (player == null) {
    commandMessages.getNoSuchPlayer().sendInColor(ChatColor.RED, sender, name);

代码示例来源:origin: Bukkit/Bukkit

final String playerArg = args[1];
final Player player = Bukkit.getPlayerExact(playerArg);
if (player == null) {
  sender.sendMessage(ChatColor.RED + "Can't find player " + playerArg);

代码示例来源:origin: GlowstoneMC/Glowstone

@Override
public boolean execute(CommandSender sender, String label, String[] args,
    CommandMessages commandMessages) {
  if (!testPermission(sender, commandMessages.getPermissionMessage())) {
    return true;
  }
  if (args.length == 0) {
    sendUsageMessage(sender, commandMessages);
    return false;
  }
  String playerName = args[0];
  Player player = Bukkit.getPlayerExact(playerName);
  if (player == null) {
    commandMessages.getPlayerOffline().sendInColor(ChatColor.RED, sender, playerName);
    return false;
  }
  if (args.length == 1) {
    player.kickPlayer(null);
    new LocalizedStringImpl("kick.done.no-reason", commandMessages.getResourceBundle())
        .send(sender, player.getName());
    return true;
  }
  String reason = StringUtils.join(args, ' ', 1, args.length);
  player.kickPlayer(reason);
  new LocalizedStringImpl("kick.done", commandMessages.getResourceBundle())
      .send(sender, player.getName(), reason);
  return true;
}

代码示例来源:origin: GlowstoneMC/Glowstone

Player player = Bukkit.getPlayerExact(name);
if (player == null) {
  messages.getPlayerOffline().sendInColor(ChatColor.RED, sender, name);

代码示例来源:origin: Bukkit/Bukkit

player = Bukkit.getPlayerExact(args[0]);
Player target = Bukkit.getPlayerExact(args[args.length - 1]);
if (target == null) {
  sender.sendMessage("Can't find player " + args[args.length - 1] + ". No tp.");

代码示例来源:origin: GlowstoneMC/Glowstone

final Player player = Bukkit.getPlayerExact(playerPattern);

代码示例来源:origin: GlowstoneMC/Glowstone

GlowPlayer player = (GlowPlayer) Bukkit.getPlayerExact(args[0]);
if (player == null) {
  commandMessages.getNoSuchPlayer().sendInColor(ChatColor.RED, sender, name);

代码示例来源:origin: Bukkit/Bukkit

player = Bukkit.getPlayerExact(args[0]);
if (player == null) {
  sender.sendMessage("Can't find player " + args[0]);

代码示例来源:origin: GlowstoneMC/Glowstone

Player player = Bukkit.getPlayerExact(name);
if (player == null) {
  commandMessages.getPlayerOffline().sendInColor(ChatColor.RED, sender, name);

代码示例来源:origin: GlowstoneMC/Glowstone

targets = new CommandTarget(sender, args[0]).getMatched(location);
} else {
  Player targetPlayer = Bukkit.getPlayerExact(args[0]);
  if (targetPlayer != null) {
    location = targetPlayer.getLocation();

代码示例来源:origin: GlowstoneMC/Glowstone

Player player = Bukkit.getPlayerExact(name);
if (player == null) {
  commandMessages.getNoSuchPlayer().sendInColor(ChatColor.RED, sender, name);

相关文章