Add near cmd

This commit is contained in:
Jesse Boyd 2016-09-25 18:06:20 +10:00
parent 86b776f742
commit 04c011164a
3 changed files with 32 additions and 0 deletions

View File

@ -64,6 +64,7 @@ public class MainCommand extends Command {
new Deny(); new Deny();
new Remove(); new Remove();
new Info(); new Info();
new Near();
new ListCmd(); new ListCmd();
new Debug(); new Debug();
new SchematicCmd(); new SchematicCmd();

View File

@ -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<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
C.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", "));
}
}

View File

@ -454,6 +454,10 @@ public enum C {
NEED_PLOT_ID("$2You've got to specify a plot id.", "Need"), 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_PLOT_WORLD("$2You've got to specify a plot area.", "Need"),
NEED_USER("$2You need to specify a username", "Need"), NEED_USER("$2You need to specify a username", "Need"),
/*
* Near
*/
PLOT_NEAR("$1Players: %s0", "Near"),
/* /*
* Info * Info
*/ */