Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package io.github.hsyyid.essentialcmds.cmdexecutors;
- import org.spongepowered.api.entity.living.player.Player;
- import org.spongepowered.api.text.Texts;
- import org.spongepowered.api.text.format.TextColors;
- import org.spongepowered.api.util.Direction;
- import org.spongepowered.api.util.command.CommandException;
- import org.spongepowered.api.util.command.CommandResult;
- import org.spongepowered.api.util.command.CommandSource;
- import org.spongepowered.api.util.command.args.CommandContext;
- import org.spongepowered.api.util.command.spec.CommandExecutor;
- public class DirectionExecutor implements CommandExecutor
- {
- public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
- {
- if (src instanceof Player)
- {
- Player player = (Player) src;
- player.sendMessage(Texts.of(TextColors.GOLD, "You are facing: ", TextColors.GRAY, Direction.getClosest(player.getRotation()).toString()));
- }
- else
- {
- src.sendMessage(Texts.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be an in-game player to send mail!"));
- }
- return CommandResult.success();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment