Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package de.lasche.command;
  2.  
  3. import org.bukkit.GameMode;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandExecutor;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8.  
  9. import de.lasche.plugin.main.Main;
  10.  
  11. public class Gamemode implements CommandExecutor {
  12.  
  13. @Override
  14. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  15.  
  16. if(sender instanceof Player) {
  17. Player player = (Player) sender;
  18. if(player.hasPermission("Lasche.gamemode")) {
  19. if(args.length == 1) {
  20. if(args[0].equalsIgnoreCase("1")) {
  21. player.setGameMode(GameMode.CREATIVE);
  22. player.sendMessage(Main.prefix + "Du bist nun im Kreative Modus!");
  23. return true;
  24. }
  25. if(args[0].equalsIgnoreCase("2")) {
  26. player.setGameMode(GameMode.ADVENTURE);
  27. player.sendMessage(Main.prefix + "Du bist nun im Adventure Modus!");
  28. return true;
  29. }
  30. if(args[0].equalsIgnoreCase("3")) {
  31. player.setGameMode(GameMode.SPECTATOR);
  32. player.sendMessage(Main.prefix + "Du bist nun im Spectator Modus!");
  33. return true;
  34. }
  35. if(args[0].equalsIgnoreCase("0")) {
  36. player.setGameMode(GameMode.SURVIVAL);
  37. player.sendMessage(Main.prefix + "Du bist nun im Survival Modus!");
  38. return true;
  39. }
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.