Advertisement
Guest User

Untitled

a guest
Sep 5th, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.34 KB | None | 0 0
  1. //
  2. // Decompiled by Procyon v0.5.29
  3. //
  4.  
  5. package freecore.grapplinghook;
  6.  
  7. import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
  8. import freecore.grapplinghook.api.HookAPI;
  9. import org.bukkit.*;
  10. import org.bukkit.command.Command;
  11. import org.bukkit.command.CommandSender;
  12. import org.bukkit.configuration.file.FileConfiguration;
  13. import org.bukkit.entity.Firework;
  14. import org.bukkit.entity.Player;
  15. import org.bukkit.event.Listener;
  16. import org.bukkit.inventory.ItemStack;
  17. import org.bukkit.inventory.ShapedRecipe;
  18. import org.bukkit.inventory.meta.FireworkMeta;
  19. import org.bukkit.plugin.Plugin;
  20. import org.bukkit.plugin.java.JavaPlugin;
  21. import org.bukkit.potion.PotionEffect;
  22. import org.bukkit.potion.PotionEffectType;
  23. import org.bukkit.util.Vector;
  24.  
  25. import java.io.File;
  26. import java.util.Random;
  27.  
  28. public class GrapplingHook extends JavaPlugin
  29. {
  30. FireworkEffect.Type[] TypeList;
  31.  
  32. public final GrapplingListener alisten;
  33. public static GrapplingHook plugin;
  34. public static WorldGuardPlugin worldGuard;
  35. protected FileConfiguration config;
  36.  
  37. public GrapplingHook() {
  38. this.alisten = new GrapplingListener(this);
  39. this.TypeList = new FireworkEffect.Type[] { FireworkEffect.Type.BALL, FireworkEffect.Type.BALL_LARGE, FireworkEffect.Type.BURST, FireworkEffect.Type.CREEPER, FireworkEffect.Type.STAR };
  40. }
  41.  
  42. public void onEnable() {
  43. getLogger().info("=--------------------------------------------=");
  44. getLogger().info("| Successfully started! Beta v0.2 |");
  45. getLogger().info("| Thanks for download our plugin! |");
  46. getLogger().info("| Type /fcteam to see FREECORE team |");
  47. getLogger().info("=--------------------------------------------=");
  48. GrapplingHook.plugin = this;
  49. this.getServer().getPluginManager().registerEvents((Listener)this.alisten, (Plugin)this);
  50. final File configFile = new File(this.getDataFolder() + "/config.yml");
  51. if (!configFile.exists()) {
  52. this.saveDefaultConfig();
  53. }
  54. final Plugin plugin = this.getServer().getPluginManager().getPlugin("WorldGuard");
  55. if (plugin != null && plugin instanceof WorldGuardPlugin) {
  56. GrapplingHook.worldGuard = (WorldGuardPlugin)plugin;
  57. }
  58. /**StaticVars.usePerms = this.getConfig().getBoolean("usePermissions");**/
  59. StaticVars.teleportHooked = this.getConfig().getBoolean("teleportToHook");
  60. StaticVars.fallDamage = this.getConfig().getBoolean("fallDamageWithHook");
  61. /**StaticVars.disableCrafting = this.getConfig().getBoolean("disableCrafting");**/
  62. /**StaticVars.woodUses = this.getConfig().getConfigurationSection("Uses").getInt("wood");**/
  63. /**StaticVars.stoneUses = this.getConfig().getConfigurationSection("Uses").getInt("stone");**/
  64. /**StaticVars.ironUses = this.getConfig().getConfigurationSection("Uses").getInt("iron");**/
  65. /**StaticVars.goldUses = this.getConfig().getConfigurationSection("Uses").getInt("gold");**/
  66. /**StaticVars.diamondUses = this.getConfig().getConfigurationSection("Uses").getInt("diamond");**/
  67. StaticVars.timeBetweenUses = this.getConfig().getInt("timeBetweenGrapples");
  68. /**if (!StaticVars.disableCrafting) {
  69. final ShapedRecipe woodRecipe = new ShapedRecipe(HookAPI.createGrapplingHook(StaticVars.woodUses)).shape(new String[] { " **", " &*", " " }).setIngredient('*', Material.WOOD).setIngredient('&', Material.FISHING_ROD);
  70. final ShapedRecipe stoneRecipe = new ShapedRecipe(HookAPI.createGrapplingHook(StaticVars.stoneUses)).shape(new String[] { " **", " &*", " " }).setIngredient('*', Material.COBBLESTONE).setIngredient('&', Material.FISHING_ROD);
  71. final ShapedRecipe ironRecipe = new ShapedRecipe(HookAPI.createGrapplingHook(StaticVars.ironUses)).shape(new String[] { " **", " &*", " " }).setIngredient('*', Material.IRON_INGOT).setIngredient('&', Material.FISHING_ROD);
  72. final ShapedRecipe goldRecipe = new ShapedRecipe(HookAPI.createGrapplingHook(StaticVars.goldUses)).shape(new String[] { " **", " &*", " " }).setIngredient('*', Material.GOLD_INGOT).setIngredient('&', Material.FISHING_ROD);
  73. final ShapedRecipe diamondRecipe = new ShapedRecipe(HookAPI.createGrapplingHook(StaticVars.diamondUses)).shape(new String[] { " **", " &*", " " }).setIngredient('*', Material.DIAMOND).setIngredient('&', Material.FISHING_ROD);**/
  74. /**this.getServer().addRecipe((Recipe)woodRecipe);
  75. this.getServer().addRecipe((Recipe)stoneRecipe);
  76. this.getServer().addRecipe((Recipe)ironRecipe);
  77. this.getServer().addRecipe((Recipe)goldRecipe);
  78. this.getServer().addRecipe((Recipe)diamondRecipe);**/
  79. }
  80. /**}**/
  81.  
  82. public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
  83.  
  84. final Player player = (Player) sender;
  85. if (label.equalsIgnoreCase("fch")) {
  86. if (sender instanceof Player) {
  87. if (player.hasPermission("freecore.grapplinghook.give")) {
  88. player.setItemInHand(HookAPI.createGrapplingHook(9999));
  89. } else {
  90. player.sendMessage(ChatColor.DARK_RED + "You don't have permission.");
  91. }
  92.  
  93. } else {
  94. sender.sendMessage("You must be a player to preform this command.");
  95. return true;
  96. }
  97. }
  98.  
  99. final Player player1 = (Player) sender;
  100. if (label.equalsIgnoreCase("fcf")) {
  101. if (sender instanceof Player) {
  102. {
  103. if (player1.hasPermission("freecore.fireworks")) {
  104. player1.sendMessage(ChatColor.GREEN + "Firework send! Yeeeah!");
  105. this.shootFireworks((Player) sender);
  106. }
  107. }
  108.  
  109. } else {
  110. sender.sendMessage("You must be a player to preform this command.");
  111. return true;
  112. }
  113.  
  114. }
  115.  
  116. /** **/
  117. final Player player2 = (Player) sender;
  118. if (label.equalsIgnoreCase("fcj"))
  119. if (sender instanceof Player) {
  120. {
  121. if (player2.hasPermission("freecore.jump")) {
  122. player2.setVelocity(new Vector(player2.getVelocity().getX(), 10, player2.getVelocity().getZ()));
  123. player2.sendMessage(ChatColor.AQUA + "Jump! Jump! Jump!");
  124. }
  125. }
  126. } else {
  127. sender.sendMessage("You must be a player to preform this command.");
  128. return true;
  129. }
  130. /** **/
  131.  
  132. final Player player3 = (Player) sender;
  133. if (label.equalsIgnoreCase("fcteam"))
  134. if (sender instanceof Player) {
  135. player3.sendMessage("=-----------------------------------=");
  136. player3.sendMessage("| Our team: |");
  137. player3.sendMessage("|Deppylute - main developer |");
  138. player3.sendMessage("=-----------------------------------=");
  139.  
  140. } else {
  141. sender.sendMessage("You must be a player to preform this command.");
  142. return true;
  143. }
  144.  
  145.  
  146.  
  147.  
  148. /**==============================================================================================================**/
  149.  
  150. final Player player4 = (Player) sender;
  151. if (label.equalsIgnoreCase("fcnv")) {
  152. if (sender instanceof Player) {
  153. if (player4.hasPermission("freecore.nightvision")) {
  154. final Location loc = player.getLocation();
  155. player4.playSound(loc, Sound.ITEM_PICKUP, 1.0f, 0.0f);
  156. loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 2004);
  157. if (player4.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
  158. player4.sendMessage(ChatColor.GOLD + "Yeah! Nightvision disabled!");
  159. player4.removePotionEffect(PotionEffectType.NIGHT_VISION);
  160. return false;
  161. }
  162. player4.sendMessage(ChatColor.GOLD + "Yeah! Nightvision enabled!");
  163. player4.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 100000, 1));
  164. return true;
  165. } else {
  166. player4.sendMessage(ChatColor.GOLD + "You don't have permissions!");
  167. }
  168. } else {
  169. sender.sendMessage("You must be a player to preform this command.");
  170. return true;
  171. }
  172. }
  173.  
  174. /**==============================================================================================================**/
  175.  
  176. return false;
  177. }
  178.  
  179.  
  180. private static boolean isInteger(final String s) {
  181. try {
  182. Integer.parseInt(s);
  183. }
  184. catch (NumberFormatException e) {
  185. return false;
  186. }
  187. return true;
  188. }
  189.  
  190.  
  191. /**==============================================================================================================**/
  192.  
  193. private void shootFireworks(final Player player) {
  194. final Firework fws = (Firework)player.getWorld().spawn(player.getLocation(), (Class)Firework.class);
  195. final FireworkMeta fm = fws.getFireworkMeta();
  196. final Random r = new Random();
  197. final FireworkEffect.Type type = this.TypeList[r.nextInt(5)];
  198. final Color c1i = this.getColour(r.nextInt(16) + 1);
  199. final Color c2i = this.getColour(r.nextInt(16) + 1);
  200. final FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1i).withFade(c2i).with(type).trail(r.nextBoolean()).build();
  201. fm.addEffect(effect);
  202. fm.setPower(r.nextInt(2) + 1);
  203. fws.setFireworkMeta(fm);
  204. }
  205.  
  206. public Color getColour(final int c) {
  207. switch (c) {
  208. default: {
  209. return Color.AQUA;
  210. }
  211. case 2: {
  212. return Color.BLACK;
  213. }
  214. case 3: {
  215. return Color.BLUE;
  216. }
  217. case 4: {
  218. return Color.FUCHSIA;
  219. }
  220. case 5: {
  221. return Color.GRAY;
  222. }
  223. case 6: {
  224. return Color.GREEN;
  225. }
  226. case 7: {
  227. return Color.LIME;
  228. }
  229. case 8: {
  230. return Color.MAROON;
  231. }
  232. case 9: {
  233. return Color.NAVY;
  234. }
  235. case 10: {
  236. return Color.OLIVE;
  237. }
  238. case 11: {
  239. return Color.ORANGE;
  240. }
  241. case 12: {
  242. return Color.PURPLE;
  243. }
  244. case 13: {
  245. return Color.RED;
  246. }
  247. case 14: {
  248. return Color.SILVER;
  249. }
  250. case 15: {
  251. return Color.TEAL;
  252. }
  253. case 16: {
  254. return Color.WHITE;
  255. }
  256. case 17: {
  257. return Color.YELLOW;
  258. }
  259. }
  260. }
  261. /**==============================================================================================================**/
  262. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement