diff --git a/src/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java b/src/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java index acd09c8b..41a7fa03 100644 --- a/src/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java +++ b/src/com/sk89q/worldguard/bukkit/commands/GeneralCommands.java @@ -25,6 +25,7 @@ import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; 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.WorldGuardPlugin; @@ -215,4 +216,26 @@ public static void slay(CommandContext args, WorldGuardPlugin plugin, 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."); + } + } }