Advertisement
Guest User

Untitled

a guest
Jan 9th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.34 KB | None | 0 0
  1. package me.nunber1_Master.Thor;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Location;
  5. import org.bukkit.World;
  6. import org.bukkit.block.Block;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandExecutor;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.entity.Player;
  11.  
  12. public class ThorThorrCommand implements CommandExecutor
  13. {
  14. @Override
  15. public boolean onCommand(CommandSender sender, Command cmd, String cmdlabel, String[] args)
  16. {
  17. Player player = (Player) sender;
  18. World world = player.getWorld();
  19. Location location = player.getLocation();
  20. ChatColor red = ChatColor.RED;
  21. ChatColor yellow = ChatColor.YELLOW;
  22. if(cmdlabel.equalsIgnoreCase("thorr"))
  23. {
  24. if(args[0].equalsIgnoreCase("destroy"))
  25. {
  26. if(args.length == 1 && player.hasPermission("thor.destroy.me"))
  27. {
  28. world.strikeLightningEffect(location);
  29. world.createExplosion(location, 0);
  30. player.sendMessage(yellow + "[Thor] " + player.getDisplayName() + red + ", you have been granted the power of " + yellow + "Thor!");
  31. }
  32. else if(args[1].equalsIgnoreCase("-d") && player.hasPermission("thor.destroy.me"))
  33. {
  34. world.strikeLightning(location);
  35. world.createExplosion(location, 0);
  36. player.sendMessage(yellow + "[Thor] " + player.getDisplayName() + red + ", you have painfully recieved the power of " + yellow + "Thor!");
  37. }
  38. else if(args.length == 2 && player.hasPermission("thor.destroy.other"))
  39. {
  40. if(player.getServer().getPlayer(args[1]) != null)
  41. {
  42. Player target = player.getServer().getPlayer(args[1]);
  43. Location targetlocation = target.getLocation();
  44. world.strikeLightningEffect(targetlocation);
  45. world.createExplosion(targetlocation, 0);
  46. player.sendMessage(yellow + "[Thor] " + target.getDisplayName() + red + " was succesfuly hit!");
  47. }
  48. else
  49. {
  50. player.sendMessage(yellow + "[Thor] " + args[1] + red + " is not online right now.");
  51. player.sendMessage(yellow + "[Thor] " +red + "Please leave a message after the 'BEEP!'.");
  52. world.strikeLightningEffect(location);
  53. world.createExplosion(location, 0);
  54. player.sendMessage(yellow + "[Thor] " +red + "BEEP!");
  55. }
  56. }
  57. else if(args.length == 3 && player.hasPermission("thor.destroy.other"))
  58. {
  59. if(args[1].equalsIgnoreCase("-d") && player.getServer().getPlayer(args[2]) != null)
  60. {
  61. Player target = player.getServer().getPlayer(args[2]);
  62. Location targetlocation = target.getLocation();
  63. world.strikeLightning(targetlocation);
  64. world.createExplosion(targetlocation, 0);
  65. player.sendMessage(yellow + "[Thor] " + target.getDisplayName() + red + " was succesfuly destroyed!");
  66. }
  67. else
  68. {
  69. player.sendMessage(yellow + "[Thor] " + args[1] + red + " is not online right now.");
  70. player.sendMessage(yellow + "[Thor] " +red + "Please leave a message after the 'BEEP!'.");
  71. world.strikeLightning(location);
  72. world.createExplosion(location, 0);
  73. player.sendMessage(yellow + "[Thor] " +red + "BEEP!");
  74. }
  75. }
  76. else
  77. {
  78. player.sendMessage(yellow + "[Thor] " + red + "You do not have permission to run that command!");
  79. }
  80. }
  81. if(args[0].equalsIgnoreCase("rage"))
  82. {
  83. if(player.hasPermission("thor.rage.me"))
  84. {
  85. if(args.length == 1)
  86. {
  87. int counter = 0;
  88. while(counter < 20)
  89. {
  90. world.strikeLightningEffect(location);
  91. world.createExplosion(location, 0);
  92. try
  93. {
  94. Thread.sleep(150);
  95. }
  96. catch (InterruptedException e)
  97. {
  98. e.printStackTrace();
  99. }
  100. counter++;
  101. }
  102. player.sendMessage(yellow + "[Thor] " + red + "Your rage has powered you!");
  103. }
  104. else if(args[1].equalsIgnoreCase("-d"))
  105. {
  106. int counter = 0;
  107. while(counter < 20)
  108. {
  109. world.strikeLightning(location);
  110. world.createExplosion(location, 0);
  111. try
  112. {
  113. Thread.sleep(150);
  114. }
  115. catch (InterruptedException e)
  116. {
  117. e.printStackTrace();
  118. }
  119. counter++;
  120. }
  121. player.sendMessage(yellow + "[Thor] " + red + "Your rage has OVER powered you!");
  122. }
  123. }
  124. else if(player.hasPermission("thor.rage.look"))
  125. {
  126. if(args.length == 2 && args[1].equalsIgnoreCase("-l"))
  127. {
  128. Block pointedblock = player.getTargetBlock(null, 50);
  129. Location pointedlocation = pointedblock.getLocation();
  130. int counter = 0;
  131. while(counter < 20)
  132. {
  133. world.strikeLightningEffect(pointedlocation);
  134. world.createExplosion(pointedlocation, 0);
  135. try
  136. {
  137. Thread.sleep(150);
  138. }
  139. catch (InterruptedException e)
  140. {
  141. e.printStackTrace();
  142. }
  143. counter++;
  144. }
  145. player.sendMessage(yellow + "[Thor] " + red + "Your target was successfully destroyed!");
  146. }
  147. else if(args.length == 3 && ((args[1].equalsIgnoreCase("-l") && args[2].equalsIgnoreCase("-d")) || (args[1].equalsIgnoreCase("-d") && args[2].equalsIgnoreCase("-l"))))
  148. {
  149. Block pointedblock = player.getTargetBlock(null, 50);
  150. Location pointedlocation = pointedblock.getLocation();
  151. int counter = 0;
  152. while(counter < 20)
  153. {
  154. world.strikeLightning(pointedlocation);
  155. world.createExplosion(pointedlocation, 0);
  156. try
  157. {
  158. Thread.sleep(150);
  159. }
  160. catch (InterruptedException e)
  161. {
  162. e.printStackTrace();
  163. }
  164. counter++;
  165. }
  166. player.sendMessage(yellow + "[Thor] " + red + "Your target was successfully destroyed, painfully!");
  167. }
  168. }
  169. else if(player.hasPermission("thor.rage.other"))
  170. {
  171. if(args.length == 2 && player.getServer().getPlayer(args[1]) != null)
  172. {
  173. Player target = player.getServer().getPlayer(args[1]);
  174. Location targetlocation = target.getLocation();
  175. int counter = 0;
  176. while(counter < 20)
  177. {
  178. world.strikeLightningEffect(targetlocation);
  179. world.createExplosion(targetlocation, 0);
  180. try
  181. {
  182. Thread.sleep(150);
  183. }
  184. catch (InterruptedException e)
  185. {
  186. e.printStackTrace();
  187. }
  188. counter++;
  189. }
  190. player.sendMessage(yellow + "[Thor] " + red + "The target player was successfully hit!");
  191. }
  192. else if(player.getServer().getPlayer(args[1]) == null)
  193. {
  194. player.sendMessage(yellow + "[Thor] " + args[1] + red + " is not online right now.");
  195. player.sendMessage(yellow + "[Thor] " +red + "Please leave a message after the 'BEEP!'.");
  196. int counter = 0;
  197. while(counter < 20)
  198. {
  199. world.strikeLightningEffect(location);
  200. world.createExplosion(location, 0);
  201. try
  202. {
  203. Thread.sleep(150);
  204. }
  205. catch (InterruptedException e)
  206. {
  207. e.printStackTrace();
  208. }
  209. counter++;
  210. }
  211. player.sendMessage(yellow + "[Thor] " +red + "BEEP!");
  212. }
  213. else if(args[1].equalsIgnoreCase("-d") && player.getServer().getPlayer(args[2]) != null)
  214. {
  215. Player target = player.getServer().getPlayer(args[2]);
  216. Location targetlocation = target.getLocation();
  217. int counter = 0;
  218. while(counter < 20)
  219. {
  220. world.strikeLightning(targetlocation);
  221. world.createExplosion(targetlocation, 0);
  222. try
  223. {
  224. Thread.sleep(150);
  225. }
  226. catch (InterruptedException e)
  227. {
  228. e.printStackTrace();
  229. }
  230. counter++;
  231. }
  232. }
  233. else if(player.getServer().getPlayer(args[2]) == null)
  234. {
  235. player.sendMessage(yellow + "[Thor] " + args[1] + red + " is not online right now.");
  236. player.sendMessage(yellow + "[Thor] " +red + "Please leave a message after the 'BEEP!'.");
  237. int counter = 0;
  238. while(counter < 20)
  239. {
  240. world.strikeLightning(location);
  241. world.createExplosion(location, 0);
  242. try
  243. {
  244. Thread.sleep(150);
  245. }
  246. catch (InterruptedException e)
  247. {
  248. e.printStackTrace();
  249. }
  250. counter++;
  251. }
  252. player.sendMessage(yellow + "[Thor] " +red + "BEEP!");
  253. }
  254. }
  255. else
  256. {
  257. player.sendMessage(yellow + "[Thor] " + red + "You do not have permission to run that command!");
  258. }
  259. }
  260. }
  261. return true;
  262. }
  263. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement