hassansyyid

Untitled

Nov 15th, 2015
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. package io.github.hsyyid.essentialcmds.cmdexecutors;
  2.  
  3. import org.spongepowered.api.entity.living.player.Player;
  4. import org.spongepowered.api.text.Texts;
  5. import org.spongepowered.api.text.format.TextColors;
  6. import org.spongepowered.api.util.Direction;
  7. import org.spongepowered.api.util.command.CommandException;
  8. import org.spongepowered.api.util.command.CommandResult;
  9. import org.spongepowered.api.util.command.CommandSource;
  10. import org.spongepowered.api.util.command.args.CommandContext;
  11. import org.spongepowered.api.util.command.spec.CommandExecutor;
  12.  
  13. public class DirectionExecutor implements CommandExecutor
  14. {
  15.     public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
  16.     {
  17.         if (src instanceof Player)
  18.         {
  19.             Player player = (Player) src;
  20.             player.sendMessage(Texts.of(TextColors.GOLD, "You are facing: ", TextColors.GRAY, Direction.getClosest(player.getRotation()).toString()));
  21.         }
  22.         else
  23.         {
  24.             src.sendMessage(Texts.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be an in-game player to send mail!"));
  25.         }
  26.         return CommandResult.success();
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment