diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index a23ef546b..a82337de4 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -64,6 +64,7 @@ public class MainCommand extends Command { new Deny(); new Remove(); new Info(); + new Near(); new ListCmd(); new Debug(); new SchematicCmd(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Near.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Near.java new file mode 100644 index 000000000..c9a15294d --- /dev/null +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Near.java @@ -0,0 +1,27 @@ +package com.intellectualcrafters.plot.commands; + +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.RunnableVal2; +import com.intellectualcrafters.plot.object.RunnableVal3; +import com.intellectualcrafters.plot.util.StringMan; +import com.plotsquared.general.commands.Command; +import com.plotsquared.general.commands.CommandDeclaration; + +@CommandDeclaration(command = "near", + aliases = "n", + description = "Display nearby players", + usage = "/plot near", + category = CommandCategory.INFO) +public class Near extends Command { + public Near() { + super(MainCommand.getInstance(), true); + } + + @Override + public void execute(PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { + final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); + C.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", ")); + } +} diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java index 5996c768a..8682f5838 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -454,6 +454,10 @@ public enum C { NEED_PLOT_ID("$2You've got to specify a plot id.", "Need"), NEED_PLOT_WORLD("$2You've got to specify a plot area.", "Need"), NEED_USER("$2You need to specify a username", "Need"), + /* + * Near + */ + PLOT_NEAR("$1Players: %s0", "Near"), /* * Info */