All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.command.defaults.TestForCommand Maven / Gradle / Ivy

The newest version!
package org.bukkit.command.defaults;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

@Deprecated
public class TestForCommand extends VanillaCommand {
  public TestForCommand() {
    super("testfor");
    this.description = "Tests whether a specifed player is online";
    this.usageMessage = "/testfor ";
    this.setPermission("bukkit.command.testfor");
  }

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

    sender.sendMessage(ChatColor.RED + "/testfor is only usable by commandblocks with analog output.");
    return true;
  }

  // Spigot Start
  @Override
  public java.util.List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
    if (args.length == 0) {
      return super.tabComplete(sender, alias, args);
    }
    return java.util.Collections.emptyList();
  }
  // Spigot End
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy