/locate re-added, but it doesn't seem to work. (Potential Bukkit bug.)

This commit is contained in:
sk89q 2011-04-02 01:26:22 -07:00
parent 70bd3d0e9a
commit b4a89462f8

View File

@ -25,6 +25,7 @@
import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.worldguard.bukkit.ConfigurationManager; import com.sk89q.worldguard.bukkit.ConfigurationManager;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
@ -215,4 +216,26 @@ public static void slay(CommandContext args, WorldGuardPlugin plugin,
sender.sendMessage(ChatColor.YELLOW.toString() + "Players slayed."); sender.sendMessage(ChatColor.YELLOW.toString() + "Players slayed.");
} }
} }
@Command(aliases = {"locate"},
usage = "[player]",
desc = "Locate a player",
flags = "", min = 0, max = 1)
@CommandPermissions({"worldguard.locate"})
public static void locate(CommandContext args, WorldGuardPlugin plugin,
CommandSender sender) throws CommandException {
Player player = plugin.checkPlayer(sender);
if (args.argsLength() == 0) {
player.setCompassTarget(player.getWorld().getSpawnLocation());
sender.sendMessage(ChatColor.YELLOW.toString() + "Compass reset to spawn.");
} else {
Player target = plugin.matchSinglePlayer(sender, args.getString(0));
player.setCompassTarget(target.getLocation());
sender.sendMessage(ChatColor.YELLOW.toString() + "Compass repointed.");
}
}
} }