Blue_future

Spigot Help

Jul 30th, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. gospawn:
  2. package blue.future.test.commands;
  3.  
  4. import org.bukkit.Location;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandExecutor;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9.  
  10. import net.md_5.bungee.api.ChatColor;
  11.  
  12. public class gospawn implements CommandExecutor {
  13.  
  14. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  15. if (label.equalsIgnoreCase("gospawn")){
  16. if (!(sender instanceof Player)) {
  17. sender.sendMessage(
  18. ChatColor.DARK_RED + "You Need To Be A Player To Execute This Command Not A " + sender.getName());
  19. return false;
  20. }
  21.  
  22. Player player = (Player) sender;
  23.  
  24. Location l = new Location(player.getWorld(), 0, 64, 0);
  25.  
  26. player.sendMessage(ChatColor.GREEN + "The Player " + player.getName() + " Hes Been Teleported To Spawn");
  27. player.teleport(l);
  28.  
  29. return true;
  30. }
  31. return false;
  32. }
  33. }
  34.  
  35.  
  36.  
  37. cmd:
  38.  
  39. package blue.future.test.commands;
  40.  
  41. import org.bukkit.command.Command;
  42. import org.bukkit.command.CommandExecutor;
  43. import org.bukkit.command.CommandSender;
  44. import org.bukkit.entity.Player;
  45.  
  46. import net.md_5.bungee.api.ChatColor;
  47.  
  48. public class cmd implements CommandExecutor {
  49.  
  50. public boolean onCommand(CommandSender sender, Command command, String label, String[] arg) {
  51. if (label.equalsIgnoreCase("cmd")) {
  52.  
  53. if (!(sender instanceof Player)) {
  54. sender.sendMessage(
  55. ChatColor.DARK_RED + "You Need To Be A Player To Use This Command Not A " + sender.getName());
  56.  
  57. return false;
  58. }
  59.  
  60. Player player = (Player) sender;
  61.  
  62. player.sendMessage(ChatColor.DARK_PURPLE + "The Command Has Been Executed By " + player.getName());
  63.  
  64. return true;
  65. }
  66. return false;
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment