mirror of
https://github.com/array-in-a-matrix/brainwine.git
synced 2025-04-02 11:11:58 -04:00
Added a position command
This commit is contained in:
parent
c0bdf7c166
commit
b11984cb03
2 changed files with 43 additions and 0 deletions
|
@ -18,6 +18,7 @@ import brainwine.gameserver.command.commands.GiveCommand;
|
|||
import brainwine.gameserver.command.commands.HelpCommand;
|
||||
import brainwine.gameserver.command.commands.KickCommand;
|
||||
import brainwine.gameserver.command.commands.PlayerIdCommand;
|
||||
import brainwine.gameserver.command.commands.PositionCommand;
|
||||
import brainwine.gameserver.command.commands.RegisterCommand;
|
||||
import brainwine.gameserver.command.commands.SayCommand;
|
||||
import brainwine.gameserver.command.commands.SeedCommand;
|
||||
|
@ -61,6 +62,7 @@ public class CommandManager {
|
|||
registerCommand(new GiveCommand());
|
||||
registerCommand(new GenerateZoneCommand());
|
||||
registerCommand(new SeedCommand());
|
||||
registerCommand(new PositionCommand());
|
||||
}
|
||||
|
||||
public static void executeCommand(CommandExecutor executor, String commandLine) {
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package brainwine.gameserver.command.commands;
|
||||
|
||||
import static brainwine.gameserver.entity.player.NotificationType.SYSTEM;
|
||||
|
||||
import brainwine.gameserver.command.Command;
|
||||
import brainwine.gameserver.command.CommandExecutor;
|
||||
import brainwine.gameserver.entity.player.Player;
|
||||
|
||||
public class PositionCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void execute(CommandExecutor executor, String[] args) {
|
||||
Player player = (Player)executor;
|
||||
player.notify(String.format("X: %s Y: %s", (int)player.getX(), (int)player.getY() + 1), SYSTEM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "pos";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAliases() {
|
||||
return new String[] { "position", "feet", "coords", "location" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Displays the coordinates of the block you are standing on.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage(CommandExecutor executor) {
|
||||
return "/pos";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExecute(CommandExecutor executor) {
|
||||
return executor instanceof Player && executor.isAdmin();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue