SHARE
TWEET

Untitled

a guest Aug 24th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package de.woked.commands;
  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. public class GamemodeCommand implements CommandExecutor {
  10.  
  11.     @Override
  12.     public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  13.         if (sender instanceof Player) {
  14.             Player player = (Player) sender;
  15.             if (player.hasPermission("lobby.gamemode")) {
  16.                 if (args.length == 0) {
  17.                     player.sendMessage("§cNutze : §a/gm §7- §a/gamemode");
  18.                 } else if (args.length == 1) {
  19.                     if (args[0].equalsIgnoreCase("1")) {
  20.                         player.setGameMode(GameMode.CREATIVE);
  21.                         player.sendMessage("§aDu bist nun in §cGM1");
  22.                     } else if (args[0].equalsIgnoreCase("0")) {
  23.                         player.setGameMode(GameMode.SURVIVAL);
  24.                         player.sendMessage("§aDu bist nun in §cGM0");
  25.                     } else if (args[0].equalsIgnoreCase("2")) {
  26.                         player.setGameMode(GameMode.ADVENTURE);
  27.                         player.sendMessage("§aDu bist nun in §cGM2");
  28.                     } else if (args[0].equalsIgnoreCase("3")) {
  29.                         player.setGameMode(GameMode.SPECTATOR);
  30.                         player.sendMessage("§aDu bist nun in §cGM3");
  31.                     }
  32.                 }
  33.             }
  34.         }
  35.         return false;
  36.     }
  37.  
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top