Advertisement
Guest User

The Towers

a guest
Dec 19th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 21.31 KB | None | 0 0
  1. package fr.blackouts.games;
  2.  
  3. import java.io.ByteArrayOutputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.File;
  6. import java.io.IOException;
  7. import java.util.Arrays;
  8. import java.util.logging.Logger;
  9.  
  10. import org.bukkit.Bukkit;
  11. import org.bukkit.ChatColor;
  12. import org.bukkit.Color;
  13. import org.bukkit.GameMode;
  14. import org.bukkit.Location;
  15. import org.bukkit.Material;
  16. import org.bukkit.Server;
  17. import org.bukkit.Sound;
  18. import org.bukkit.World;
  19. import org.bukkit.command.Command;
  20. import org.bukkit.command.CommandSender;
  21. import org.bukkit.configuration.file.FileConfiguration;
  22. import org.bukkit.entity.Player;
  23. import org.bukkit.inventory.ItemStack;
  24. import org.bukkit.inventory.PlayerInventory;
  25. import org.bukkit.inventory.meta.ItemMeta;
  26. import org.bukkit.inventory.meta.LeatherArmorMeta;
  27. import org.bukkit.plugin.PluginDescriptionFile;
  28. import org.bukkit.plugin.PluginManager;
  29. import org.bukkit.plugin.java.JavaPlugin;
  30. import org.bukkit.plugin.messaging.Messenger;
  31. import org.bukkit.potion.PotionEffect;
  32. import org.bukkit.potion.PotionEffectType;
  33. import org.bukkit.scheduler.BukkitRunnable;
  34. import org.bukkit.scheduler.BukkitScheduler;
  35. import org.bukkit.scoreboard.DisplaySlot;
  36. import org.bukkit.scoreboard.Objective;
  37. import org.bukkit.scoreboard.Score;
  38. import org.bukkit.scoreboard.Scoreboard;
  39. import org.bukkit.scoreboard.ScoreboardManager;
  40. import org.bukkit.scoreboard.Team;
  41.  
  42. public class Main extends JavaPlugin
  43. {
  44.   Language handler = new Language(this);
  45.   public Location lobbyLocation;
  46.   private Logger log = Logger.getLogger("Minecraft");
  47.   boolean ok = false;
  48.   boolean inGame = false;
  49.   boolean GameFinish = false;
  50.   String prefix = "[" + ChatColor.RED + "TheTowers" + ChatColor.RESET + "] ";
  51.   String motd;
  52.   ScoreboardManager manager;
  53.   Scoreboard board;
  54.   Team blue;
  55.   Team red;
  56.   Objective kills;
  57.   Objective health;
  58.   Objective points;
  59.   Objective playerpoints;
  60.   Score bluePlayers;
  61.   Score redPlayers;
  62.   Score bluePoints;
  63.   Score redPoints;
  64.  
  65.   public void onEnable()
  66.   {
  67.     this.manager = getServer().getScoreboardManager();
  68.     this.board = this.manager.getNewScoreboard();
  69.     this.blue = this.board.registerNewTeam("blue");
  70.     this.red = this.board.registerNewTeam("red");
  71.     this.kills = this.board.registerNewObjective("Kills", "playerKillCount");
  72.     this.health = this.board.registerNewObjective("health", "health");
  73.     this.points = this.board.registerNewObjective("Points", "dummy");
  74.     this.playerpoints = this.board.registerNewObjective("PlayerPoints", "dummy");    
  75.     this.points.setDisplaySlot(DisplaySlot.SIDEBAR);
  76.     this.points.setDisplayName(ChatColor.GREEN + this.handler.getCaption("PointsScoreboard"));
  77.     this.health.setDisplaySlot(DisplaySlot.BELOW_NAME);
  78.     this.health.setDisplayName(ChatColor.RED + "❤");
  79.     this.playerpoints.setDisplaySlot(DisplaySlot.PLAYER_LIST);
  80.     this.bluePoints = this.points.getScore(Bukkit.getOfflinePlayer(ChatColor.BLUE + this.handler.getCaption("bluePoints") + " : "));
  81.     this.redPoints = this.points.getScore(Bukkit.getOfflinePlayer(ChatColor.RED + this.handler.getCaption("redPoints") + " : "));
  82.     this.bluePoints.setScore(0);
  83.     this.redPoints.setScore(0);
  84.     for (Player online : Bukkit.getOnlinePlayers()) {
  85.       Score score = this.points.getScore(online);
  86.       score.setScore(0);
  87.     }
  88.     this.blue.setAllowFriendlyFire(false);
  89.     this.red.setAllowFriendlyFire(false);
  90.     getServer().getPluginManager().registerEvents(new Events(this), this);
  91.     getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
  92.     this.motd = ("&a" + this.handler.getCaption("MotdPending"));
  93.     BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
  94.     scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
  95.       public void run() {
  96.         if ((Bukkit.getOnlinePlayers().length >= 2) && (!Main.this.inGame) && (!Main.this.ok))
  97.         {
  98.           Main.this.ok = true;
  99.           Bukkit.broadcastMessage(Main.this.prefix + ChatColor.AQUA + Main.this.handler.getCaption("EnoughPlayers"));
  100.           Bukkit.broadcastMessage(Main.this.prefix + ChatColor.AQUA + Main.this.handler.getCaption("GameMinutes"));
  101.           Main.this.timer(Main.this.getConfig().getInt("sec"));
  102.         }
  103.       }
  104.     }
  105.     , 0L, 20L);
  106.   }
  107.  
  108.   public void onLoad()
  109.   {
  110.     try {
  111.       File worldContainer = getServer().getWorldContainer();
  112.       File worldFolder = new File(worldContainer, "world");
  113.       deleteWorlds("world");
  114.       FileUtils.copyFolder(new File(worldContainer, "towers"), worldFolder);
  115.       getLogger().info("Worl deleted successful !");
  116.     }
  117.     catch (Throwable $ex)
  118.     {
  119.       try {
  120.         throw
  121.             $ex;
  122.     } catch (Throwable e) {
  123.         // TODO Auto-generated catch block
  124.         e.printStackTrace();
  125.     }
  126.     }
  127.   }
  128.   public void timer(int sec) { BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
  129.     scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
  130.       int seco;
  131.  
  132.       public void run() {
  133.         if (this.seco >= 0) {
  134.           for (Player p : Bukkit.getOnlinePlayers())
  135.           {
  136.             p.setLevel(this.seco);
  137.           }
  138.         }
  139.         if (this.seco == 60)
  140.         {
  141.           Bukkit.broadcastMessage(Main.this.prefix + ChatColor.AQUA + this.seco + " " + Main.this.handler.getCaption("SecondBeforeGame"));
  142.         }
  143.         if (this.seco == 30)
  144.         {
  145.           Bukkit.broadcastMessage(Main.this.prefix + ChatColor.AQUA + this.seco + " " + Main.this.handler.getCaption("SecondBeforeGame"));
  146.         }
  147.         if ((this.seco < 5) && (!Main.this.inGame))
  148.         {
  149.           if (this.seco == 0)
  150.           {
  151.             for (Player p : Bukkit.getOnlinePlayers())
  152.             {
  153.               p.playSound(p.getLocation(), Sound.LEVEL_UP, 100.0F, 1.0F);
  154.             }
  155.             Bukkit.broadcastMessage(Main.this.prefix + ChatColor.AQUA + Main.this.handler.getCaption("StartsGame"));
  156.             Main.this.startGame();
  157.           }
  158.           return;
  159.           }
  160.           else
  161.           {
  162.             if ((this.seco > -1) && (this.seco != 1)) {
  163.               for (Player p : Bukkit.getOnlinePlayers())
  164.               {
  165.                 p.playSound(p.getLocation(), Sound.CLICK, 100.0F, 1.0F);
  166.               }
  167.               Bukkit.broadcastMessage(Main.this.prefix + ChatColor.AQUA + this.seco + " " + Main.this.handler.getCaption("SecondBeforeGame"));
  168.             }
  169.             if (this.seco == 1)
  170.             {
  171.               for (Player p : Bukkit.getOnlinePlayers())
  172.               {
  173.                 p.playSound(p.getLocation(), Sound.CLICK, 100.0F, 1.0F);
  174.               }
  175.               Bukkit.broadcastMessage(Main.this.prefix + ChatColor.AQUA + this.seco + " " + Main.this.handler.getCaption("SecondBeforeGame"));
  176.             }
  177.          
  178.         }
  179.         this.seco -= 1;
  180.       }
  181.     }
  182.     , 0L, 20L);    
  183.   }
  184.  
  185.   public void startGame()
  186.   {
  187.     Bukkit.getWorld("world").setTime(20000L);
  188.     this.inGame = true;
  189.     this.motd = ("&c" + this.handler.getCaption("MotdInGame"));
  190.     for (Player p : Bukkit.getOnlinePlayers())
  191.     {
  192.       p.setGameMode(GameMode.SURVIVAL);
  193.       p.getInventory().clear();
  194.       p.updateInventory();
  195.       if ((!this.blue.hasPlayer(p)) && (!this.red.hasPlayer(p)))
  196.       {
  197.         if (this.blue.getSize() < this.red.getSize())
  198.         {
  199.           this.blue.addPlayer(p);
  200.           p.teleport(new Location(p.getWorld(), getConfig().getInt("spawnblue.x"), getConfig().getInt("spawnblue.y"), getConfig().getInt("spawnblue.z")));
  201.           respawnPlayer(p);
  202.           p.setBedSpawnLocation(new Location(p.getWorld(), getConfig().getInt("spawnblue.x"), getConfig().getInt("spawnblue.y"), getConfig().getInt("spawnblue.z")));
  203.         } else {
  204.           this.red.addPlayer(p);
  205.           p.teleport(new Location(p.getWorld(), getConfig().getInt("spawnred.x"), getConfig().getInt("spawnred.y"), getConfig().getInt("spawnred.z")));
  206.           respawnPlayer(p);
  207.           p.setBedSpawnLocation(new Location(p.getWorld(), getConfig().getInt("spawnred.x"), getConfig().getInt("spawnred.y"), getConfig().getInt("spawnred.z")));
  208.         }
  209.       }
  210.       if ((this.blue.hasPlayer(p)) && (!this.red.hasPlayer(p)))
  211.       {
  212.         p.teleport(new Location(p.getWorld(), getConfig().getInt("spawnblue.x"), getConfig().getInt("spawnblue.y"), getConfig().getInt("spawnblue.z")));
  213.         respawnPlayer(p);
  214.         p.setBedSpawnLocation(new Location(p.getWorld(), getConfig().getInt("spawnblue.x"), getConfig().getInt("spawnblue.y"), getConfig().getInt("spawnblue.z")));
  215.       }
  216.       if ((this.red.hasPlayer(p)) && (!this.blue.hasPlayer(p)))
  217.       {
  218.         p.teleport(new Location(p.getWorld(), getConfig().getInt("spawnred.x"), getConfig().getInt("spawnred.y"), getConfig().getInt("spawnred.z")));
  219.         respawnPlayer(p);
  220.         p.setBedSpawnLocation(new Location(p.getWorld(), getConfig().getInt("spawnred.x"), getConfig().getInt("spawnred.y"), getConfig().getInt("spawnred.z")));
  221.       }
  222.     }
  223.     BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
  224.     scheduler.scheduleSyncRepeatingTask(this, new Runnable()
  225.     {
  226.       public void run() {
  227.         if ((Main.this.redPoints.getScore() >= 10) && (Main.this.inGame) && (!Main.this.GameFinish))
  228.         {
  229.           Main.this.GameFinish = true;
  230.           for (final Player p : Bukkit.getOnlinePlayers())
  231.           {
  232.             p.setAllowFlight(true);
  233.             p.setFlying(true);
  234.             p.playSound(p.getLocation(), Sound.WITHER_DEATH, 100.0F, 1.0F);
  235.             p.sendMessage(Main.this.prefix + ChatColor.RED + Main.this.handler.getCaption("RedWin"));
  236.             Main.this.motd = ("&c" + Main.this.handler.getCaption("Win"));
  237.             if (Main.this.getConfig().getString("BungeeCord.returnserver").equalsIgnoreCase("none"))
  238.               new BukkitRunnable()
  239.               {
  240.                 public void run() {
  241.                   p.kickPlayer(Main.this.handler.getCaption("Win"));
  242.                 }
  243.               }
  244.               .runTaskLater(Main.this, 100L);
  245.             else {
  246.               new BukkitRunnable()
  247.               {
  248.                 public void run() {
  249.                   Main.this.backToLobby(p);
  250.                 }
  251.               }
  252.               .runTaskLater(Main.this, 200L);
  253.             }
  254.           }
  255.  
  256.           new BukkitRunnable()
  257.           {
  258.             public void run() {
  259.               Bukkit.shutdown();
  260.             }
  261.           }
  262.           .runTaskLater(Main.this, 300L);
  263.         } else if ((Main.this.bluePoints.getScore() >= 10) && (Main.this.inGame) && (!Main.this.GameFinish))
  264.         {
  265.           Main.this.GameFinish = true;
  266.           for (final Player p : Bukkit.getOnlinePlayers())
  267.           {
  268.             p.setAllowFlight(true);
  269.             p.setFlying(true);
  270.             p.playSound(p.getLocation(), Sound.WITHER_DEATH, 100.0F, 1.0F);
  271.             Main.this.motd = ("&9" + Main.this.handler.getCaption("Win"));
  272.             p.sendMessage(Main.this.prefix + ChatColor.BLUE + Main.this.handler.getCaption("BlueWin"));
  273.             if (Main.this.getConfig().getString("BungeeCord.returnserver").equalsIgnoreCase("none"))
  274.               new BukkitRunnable()
  275.               {
  276.                 public void run() {
  277.                   p.kickPlayer(Main.this.handler.getCaption("Win"));
  278.                 }
  279.               }
  280.               .runTaskLater(Main.this, 100L);
  281.             else {
  282.               new BukkitRunnable()
  283.               {
  284.                 public void run() {
  285.                   Main.this.backToLobby(p);
  286.                 }
  287.               }
  288.               .runTaskLater(Main.this, 200L);
  289.             }
  290.             new BukkitRunnable()
  291.             {
  292.               public void run() {
  293.                 Bukkit.shutdown();
  294.               }
  295.             }
  296.             .runTaskLater(Main.this, 200L);
  297.           }
  298.         }
  299.         if (Main.this.blue.getSize() == 0) {
  300.           Main.this.GameFinish = true;
  301.           Main.this.motd = ("&c" + Main.this.handler.getCaption("Win"));
  302.           Bukkit.broadcastMessage(Main.this.prefix + ChatColor.RED + Main.this.handler.getCaption("RedWin"));
  303.           for (final Player p : Bukkit.getOnlinePlayers()) {
  304.             p.setAllowFlight(true);
  305.             p.setFlying(true);
  306.             p.playSound(p.getLocation(), Sound.WITHER_DEATH, 100.0F, 1.0F);
  307.             if (Main.this.getConfig().getString("BungeeCord.returnserver").equalsIgnoreCase("none"))
  308.               new BukkitRunnable()
  309.               {
  310.                 public void run() {
  311.                   p.kickPlayer(Main.this.handler.getCaption("Win"));
  312.                 }
  313.               }
  314.               .runTaskLater(Main.this, 100L);
  315.             else {
  316.               new BukkitRunnable()
  317.               {
  318.                 public void run() {
  319.                   Main.this.backToLobby(p);
  320.                 }
  321.               }
  322.               .runTaskLater(Main.this, 100L);
  323.             }
  324.           }
  325.           new BukkitRunnable()
  326.           {
  327.             public void run() {
  328.               Bukkit.shutdown();
  329.             }
  330.           }
  331.           .runTaskLater(Main.this, 200L);
  332.         }
  333.         if (Main.this.red.getSize() == 0) {
  334.           Main.this.GameFinish = true;
  335.           Main.this.motd = ("&9" + Main.this.handler.getCaption("Win"));
  336.           Bukkit.broadcastMessage(Main.this.prefix + ChatColor.RED + Main.this.handler.getCaption("BlueWin"));
  337.           for (final Player p : Bukkit.getOnlinePlayers()) {
  338.             p.setAllowFlight(true);
  339.             p.setFlying(true);
  340.             p.playSound(p.getLocation(), Sound.WITHER_DEATH, 100.0F, 1.0F);
  341.             if (Main.this.getConfig().getString("BungeeCord.returnserver").equalsIgnoreCase("none"))
  342.               new BukkitRunnable()
  343.               {
  344.                 public void run() {
  345.                   p.kickPlayer(Main.this.handler.getCaption("Win"));
  346.                 }
  347.               }
  348.               .runTaskLater(Main.this, 100L);
  349.             else {
  350.               new BukkitRunnable()
  351.               {
  352.                 public void run() {
  353.                   Main.this.backToLobby(p);
  354.                 }
  355.               }
  356.               .runTaskLater(Main.this, 100L);
  357.             }
  358.           }
  359.           new BukkitRunnable()
  360.           {
  361.             public void run() {
  362.               Bukkit.shutdown();
  363.             }
  364.           }
  365.           .runTaskLater(Main.this, 200L);
  366.         }
  367.       }
  368.     }
  369.     , 0L, 20L);
  370.   }
  371.   public void backToLobby(Player p) {
  372.     ByteArrayOutputStream b = new ByteArrayOutputStream();
  373.     DataOutputStream out = new DataOutputStream(b);
  374.     try
  375.     {
  376.       out.writeUTF("Connect");
  377.       out.writeUTF(getConfig().getString("BungeeCord.returnserver"));
  378.     }
  379.     catch (IOException e) {
  380.       e.printStackTrace();
  381.     }
  382.     p.sendPluginMessage(this, "BungeeCord", b.toByteArray());
  383.   }
  384.   public ItemStack createItem(ItemStack item, String name, String[] lore) {
  385.     ItemMeta im = item.getItemMeta();
  386.     im.setDisplayName(name);
  387.     im.setLore(Arrays.asList(lore));
  388.     item.setItemMeta(im);
  389.     return item;
  390.   }
  391.  
  392.   private boolean delete(File file) {
  393.     if (file.isDirectory()) {
  394.       for (File subfile : file.listFiles())
  395.         if (!delete(subfile))
  396.           return false;
  397.     }
  398.     return file.delete();
  399.   }
  400.   public void deleteWorlds(String worldName) {
  401.     File target = new File(getServer().getWorldContainer(), worldName);
  402.     if (!target.exists()) {
  403.       this.log.info("Could not load world \"" + worldName + "\" with a random seed: no such world " + "exists in the server directory!");
  404.       return;
  405.     }
  406.     if ((target.isDirectory()) &&
  407.       (!delete(target)))
  408.       this.log.info("Failed to delete world \"" + worldName + "\", perhaps the folder is locked?");
  409.   }
  410.  
  411.   public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
  412.   {
  413.     if (command.getName().equalsIgnoreCase("towers")) {
  414.       if (!(sender instanceof Player)) {
  415.         sender.sendMessage(ChatColor.RED + "You have to be a player.");
  416.         return true;
  417.       }
  418.       Player player = (Player)sender;
  419.       if (args.length == 0) {
  420.         player.sendMessage(ChatColor.YELLOW + "Plugin Towers v" + getDescription().getVersion() + " by Dragoh.");
  421.       } else {
  422.         String sub = args[0];
  423.         if (sub.equalsIgnoreCase("help")) {
  424.           player.sendMessage(ChatColor.GREEN + "Rush Help :");
  425.           player.sendMessage("/towers setlobby" + ChatColor.YELLOW + " - Set the lobby");
  426.           player.sendMessage("/towers setspawn [color]" + ChatColor.YELLOW + " - Set the spawn of team [color]");
  427.           player.sendMessage("/towers setpol [color]" + ChatColor.YELLOW + " - Set the pool of team [color]");
  428.           player.sendMessage("/towers setreturnserver [server]" + ChatColor.YELLOW + " - Set BungeeCord returnserver");
  429.         } else if (sub.equalsIgnoreCase("setreturnserver")) {
  430.           if (args[1] != null) {
  431.             getConfig().set("BungeeCord.returnserver", args[1]);
  432.             saveConfig();
  433.             player.sendMessage(this.prefix + ChatColor.RED + "You defined successfully the server of return"); } else {
  434.             player.sendMessage(this.prefix + ChatColor.RED + "You have to inform an argument");
  435.           } } else if (sub.equalsIgnoreCase("setlobby")) {
  436.           this.lobbyLocation = player.getLocation();
  437.           player.sendMessage(ChatColor.GREEN + "You have defined the lobby successfully.");
  438.           getConfig().set("lobby.x", Double.valueOf(player.getLocation().getX()));
  439.           getConfig().set("lobby.y", Double.valueOf(player.getLocation().getY()));
  440.           getConfig().set("lobby.z", Double.valueOf(player.getLocation().getZ()));
  441.           saveConfig();
  442.         } else if (sub.equalsIgnoreCase("setspawn")) {
  443.           if ((!args[1].equalsIgnoreCase("red")) && (!args[1].equalsIgnoreCase("blue"))) {
  444.             player.sendMessage(ChatColor.RED + "The color " + ChatColor.DARK_RED + args[1] + ChatColor.RED + " does not exist.");
  445.           } else {
  446.             player.sendMessage(ChatColor.GREEN + "You have successfully defined the spawn of the " + args[1] + "team");
  447.             getConfig().set("spawn" + args[1] + ".x", Double.valueOf(player.getLocation().getX()));
  448.             getConfig().set("spawn" + args[1] + ".y", Double.valueOf(player.getLocation().getY()));
  449.             getConfig().set("spawn" + args[1] + ".z", Double.valueOf(player.getLocation().getZ()));
  450.             saveConfig();
  451.           }
  452.         } else if (sub.equalsIgnoreCase("setpool")) {
  453.           if ((!args[1].equalsIgnoreCase("red")) && (!args[1].equalsIgnoreCase("blue"))) {
  454.             player.sendMessage(ChatColor.RED + "The color " + ChatColor.DARK_RED + args[1] + ChatColor.RED + " does not exist.");
  455.           } else {
  456.             player.sendMessage(ChatColor.GREEN + "You have successfully defined the pool of the " + args[1] + "team");
  457.             getConfig().set("pool" + args[1] + ".x", Double.valueOf(player.getLocation().getX()));
  458.             getConfig().set("pool" + args[1] + ".y", Double.valueOf(player.getLocation().getY()));
  459.             getConfig().set("pool" + args[1] + ".z", Double.valueOf(player.getLocation().getZ()));
  460.             saveConfig();
  461.           }
  462.         } else {
  463.           sender.sendMessage(ChatColor.RED + "Bad arguments or nonexistent command. Use " + ChatColor.DARK_RED + "/towers help" + ChatColor.RED + ".");
  464.         }
  465.         return true;
  466.       }
  467.     }
  468.     return false;
  469.   }
  470.  
  471.   public void respawnPlayer(Player p) {
  472.     ItemStack helmet = new ItemStack(Material.LEATHER_HELMET, 1);
  473.     ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
  474.     ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS, 1);
  475.     ItemStack boots = new ItemStack(Material.LEATHER_BOOTS, 1);
  476.     LeatherArmorMeta hm = (LeatherArmorMeta)helmet.getItemMeta();
  477.     LeatherArmorMeta cp = (LeatherArmorMeta)chestplate.getItemMeta();
  478.     LeatherArmorMeta lg = (LeatherArmorMeta)leggings.getItemMeta();
  479.     LeatherArmorMeta bt = (LeatherArmorMeta)boots.getItemMeta();
  480.     if (this.blue.hasPlayer(p)) {
  481.       hm.setColor(Color.fromRGB(255));
  482.       cp.setColor(Color.fromRGB(255));
  483.       lg.setColor(Color.fromRGB(255));
  484.       bt.setColor(Color.fromRGB(255));
  485.       helmet.setItemMeta(hm);
  486.       chestplate.setItemMeta(cp);
  487.       leggings.setItemMeta(lg);
  488.       boots.setItemMeta(bt);
  489.       p.getInventory().setHelmet(helmet);
  490.       p.getInventory().setChestplate(chestplate);
  491.       p.getInventory().setLeggings(leggings);
  492.       p.getInventory().setBoots(boots);
  493.     }
  494.     if (this.red.hasPlayer(p)) {
  495.       hm.setColor(Color.fromRGB(16711680));
  496.       cp.setColor(Color.fromRGB(16711680));
  497.       lg.setColor(Color.fromRGB(16711680));
  498.       bt.setColor(Color.fromRGB(16711680));
  499.       helmet.setItemMeta(hm);
  500.       chestplate.setItemMeta(cp);
  501.       leggings.setItemMeta(lg);
  502.       boots.setItemMeta(bt);
  503.       p.getInventory().setHelmet(helmet);
  504.       p.getInventory().setChestplate(chestplate);
  505.       p.getInventory().setLeggings(leggings);
  506.       p.getInventory().setBoots(boots);
  507.     }
  508.     p.getInventory().addItem(new ItemStack[] { new ItemStack(Material.BAKED_POTATO, 16) });
  509.     p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 300, 2));
  510.     p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 300, 4));
  511.     p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 140, 2));
  512.     p.updateInventory();
  513.   }
  514.  
  515.   public void CheckTeam(Player p) {
  516.     if (this.blue.hasPlayer(p)) {
  517.       this.blue.removePlayer(p);
  518.     }
  519.     if (this.red.hasPlayer(p))
  520.       this.red.removePlayer(p);
  521.   }
  522. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement