daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package apple.Comandos;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.GameMode;
  8. import org.bukkit.command.Command;
  9. import org.bukkit.command.CommandExecutor;
  10. import org.bukkit.command.CommandSender;
  11. import org.bukkit.configuration.file.FileConfiguration;
  12. import org.bukkit.entity.Player;
  13. import org.bukkit.event.Listener;
  14.  
  15. import apple.Main;
  16.  
  17. public class Gm implements CommandExecutor, Listener
  18. {
  19.   public final Main instance = Main.getMain();
  20.   List<String> fly = new ArrayList();
  21.  
  22.   public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
  23.   {
  24.     if (label.equalsIgnoreCase("gm")) {
  25.       if (!(sender instanceof Player)) {
  26.           sender.sendMessage(Main.GameMode.message("MSG_CONSOLE"));
  27.         return true;
  28.       }
  29.       Player p = (Player)sender;
  30.       if (!p.hasPermission("apple.bypass")) {
  31.         p.sendMessage(Main.GameMode.message("MSG_PERMISSION"));
  32.         return true;
  33.       }
  34.       if (args.length == 0) {
  35.         p.sendMessage("§c§lERROR: §cUse: /gm <0/1/2/3>");
  36.         return true;
  37.       }
  38.       if (args[0].equalsIgnoreCase("0")) {
  39.         Player player = (Player)sender;
  40.         player.setGameMode(GameMode.SURVIVAL);
  41.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  42.         return true;
  43.       }
  44.       if (args[0].equalsIgnoreCase("1")) {
  45.         Player player = (Player)sender;
  46.         player.setGameMode(GameMode.CREATIVE);
  47.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  48.         return true;
  49.       }
  50.       if (args[0].equalsIgnoreCase("2")) {
  51.         Player player = (Player)sender;
  52.         player.setGameMode(GameMode.SPECTATOR);
  53.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  54.         return true;
  55.       }
  56.       if (args[0].equalsIgnoreCase("3")) {
  57.         Player player = (Player)sender;
  58.         player.setGameMode(GameMode.ADVENTURE);
  59.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  60.         return true;
  61.       }
  62.       return false;
  63.     }
  64.     if (label.equalsIgnoreCase("gmc")) {
  65.       if (!(sender instanceof Player)) {
  66.           sender.sendMessage(Main.GameMode.message("MSG_CONSOLE"));
  67.         return true;
  68.       }
  69.       Player p = (Player)sender;
  70.       if (!p.hasPermission("apple.bypass")) {
  71.         p.sendMessage(Main.GameMode.message("MSG_PERMISSION"));
  72.         return true;
  73.         }
  74.         Player player = (Player)sender;
  75.         player.setGameMode(GameMode.CREATIVE);
  76.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  77.         return true;
  78.         }
  79.     if (label.equalsIgnoreCase("gms")) {
  80.       if (!(sender instanceof Player)) {
  81.           sender.sendMessage(Main.GameMode.message("MSG_CONSOLE"));
  82.         return true;
  83.       }
  84.       Player p = (Player)sender;
  85.       if (!p.hasPermission("apple.bypass")) {
  86.         p.sendMessage(Main.GameMode.message("MSG_PERMISSION"));
  87.         return true;
  88.         }
  89.         Player player = (Player)sender;
  90.         player.setGameMode(GameMode.SURVIVAL);
  91.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  92.         return true;
  93.         }
  94.     if (label.equalsIgnoreCase("gma")) {
  95.       if (!(sender instanceof Player)) {
  96.           sender.sendMessage(Main.GameMode.message("MSG_CONSOLE"));
  97.         return true;
  98.       }
  99.       Player p = (Player)sender;
  100.       if (!p.hasPermission("apple.bypass")) {
  101.         p.sendMessage(Main.GameMode.message("MSG_PERMISSION"));
  102.         return true;
  103.         }
  104.         Player player = (Player)sender;
  105.         player.setGameMode(GameMode.ADVENTURE);
  106.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  107.         return true;
  108.         }
  109.     if (label.equalsIgnoreCase("gmsp")) {
  110.       if (!(sender instanceof Player)) {
  111.           sender.sendMessage(Main.GameMode.message("MSG_CONSOLE"));
  112.         return true;
  113.       }
  114.       Player p = (Player)sender;
  115.       if (!p.hasPermission("apple.bypass")) {
  116.         p.sendMessage(Main.GameMode.message("MSG_PERMISSION"));
  117.         return true;
  118.         }
  119.         Player player = (Player)sender;
  120.         player.setGameMode(GameMode.SPECTATOR);
  121.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  122.         return true;
  123.         }
  124.     if (label.equalsIgnoreCase("gamemode")) {
  125.       if (!(sender instanceof Player)) {
  126.           sender.sendMessage(Main.GameMode.message("MSG_CONSOLE"));
  127.         return true;
  128.       }
  129.       Player p = (Player)sender;
  130.       if (!p.hasPermission("apple.bypass")) {
  131.         p.sendMessage(Main.GameMode.message("MSG_PERMISSION"));
  132.         return true;
  133.       }
  134.       if (args.length == 0) {
  135.         p.sendMessage("§c§lERROR: §cUse: /gamemode <0/1/2/3>");
  136.         return true;
  137.       }
  138.       if (args[0].equalsIgnoreCase("0")) {
  139.         Player player = (Player)sender;
  140.         player.setGameMode(GameMode.SURVIVAL);
  141.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  142.         return true;
  143.       }
  144.      
  145.       if (args[0].equalsIgnoreCase("1")) {
  146.         Player player = (Player)sender;
  147.         player.setGameMode(GameMode.CREATIVE);
  148.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  149.         if (args.length > 2){
  150.             Player alvo = Bukkit.getPlayer(args[1]);
  151.             if (args[0] == 1){
  152.                 alvo.setGameMode(GameMode.CREATIVE);
  153.                 return true;
  154.             }
  155.         }
  156.       }
  157.       if (args[0].equalsIgnoreCase("2")) {
  158.         Player player = (Player)sender;
  159.         player.setGameMode(GameMode.SPECTATOR);
  160.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  161.         return true;
  162.       }
  163.       if (args[0].equalsIgnoreCase("3")) {
  164.         Player player = (Player)sender;
  165.         player.setGameMode(GameMode.ADVENTURE);
  166.         player.sendMessage(Main.GameMode.message("MSG_CHANGE_GAMEMODE"));
  167.         return true;
  168.       }
  169.     return false;
  170.   }
  171.     return false;
  172. }
  173. }
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