Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. package club.combopvp.nuclearapocalypse.commands;
  2.  
  3. import org.bukkit.Bukkit;
  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. import org.bukkit.potion.PotionEffectType;
  10.  
  11. import club.combopvp.nuclearapocalypse.Main;
  12. import net.md_5.bungee.api.ChatColor;
  13.  
  14. public class NACommand implements CommandExecutor {
  15.  
  16. public Main main;
  17.  
  18. public NACommand(Main main) {
  19. this.main = main;
  20. }
  21.  
  22. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  23. if(args.length > 0) {
  24. if(args[0].equalsIgnoreCase("join")) {
  25. main.allPlayersInEvent.add((Player) sender);
  26. main.sendEventMessage(ChatColor.GRAY + "You have joined the event!");
  27. return true;
  28. }
  29. }
  30. if(args.length > 1) {
  31. if(args[0].equalsIgnoreCase("test")) {
  32. if(args[1].equalsIgnoreCase("unfreeze")) {
  33. main.freezePlayers = false;
  34. return true;
  35. }
  36. if(args[1].equalsIgnoreCase("startExplosion")) {
  37. main.randomExplosionsInReactor = true;
  38. return true;
  39.  
  40. }
  41. if(args[1].equalsIgnoreCase("stopExplosion")) {
  42. main.randomExplosionsInReactor = false;
  43. return true;
  44.  
  45. }
  46. if(args[1].equalsIgnoreCase("start")) {
  47. for(int i = 0; main.allPlayersInEvent.size() > i; i++) {
  48. //CHANGE world to name of world
  49.  
  50. Location loc = new Location(Bukkit.getWorld("world"), -683, 46, -1091);
  51. loc.setPitch(-9);
  52. loc.setYaw(-90);
  53. main.freezePosition = loc;
  54. main.freezePlayers = true;
  55. main.sendEventMessage(ChatColor.RED + "The reactor are working at has exploded! You must escape!");
  56. Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
  57. public void run() {
  58. main.randomExplosionsInReactor = true;
  59. }
  60. }, 20 * 3);//3 sec
  61. Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
  62. public void run() {
  63. main.randomExplosionsInReactor = false;
  64. main.freezePlayers = false;
  65.  
  66. }
  67. }, 20 * 5);//5 sec
  68. Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
  69. public void run() {
  70. main.effectAllPlayers(PotionEffectType.SLOW, 100000, 0);
  71. }
  72. }, 20 * 30);//30 sec
  73.  
  74.  
  75. }
  76. return true;
  77. }
  78. }
  79. }
  80. sender.sendMessage(ChatColor.RED + "Error: Not enough args");
  81. return true;
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement