Guest User

Untitled

a guest
Jul 21st, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. /* */ package me.blackhawklex.blackarrowtorching.listeners;
  2. /* */
  3. /* */ import java.util.ArrayList;
  4. /* */ import java.util.List;
  5. /* */ import me.blackhawklex.blackarrowtorching.BlackArrowTorching;
  6. /* */ import org.bukkit.Location;
  7. /* */ import org.bukkit.World;
  8. /* */ import org.bukkit.block.Block;
  9. /* */ import org.bukkit.entity.Arrow;
  10. /* */ import org.bukkit.entity.Entity;
  11. /* */ import org.bukkit.event.entity.EntityListener;
  12. /* */ import org.bukkit.event.entity.ProjectileHitEvent;
  13. /* */
  14. /* */ public class Listener_Entity extends EntityListener
  15. /* */ {
  16. /* */ private BlackArrowTorching plugin;
  17. /* */
  18. /* */ public Listener_Entity(BlackArrowTorching plugin)
  19. /* */ {
  20. /* 35 */ this.plugin = plugin;
  21. /* */ }
  22. /* */
  23. /* */ public void onProjectileHit(ProjectileHitEvent event)
  24. /* */ {
  25. /* 40 */ if (event.getEntity() instanceof Arrow) {
  26. /* 41 */ Arrow arrow = (Arrow)event.getEntity();
  27. /* 42 */ Location arrowLoc = arrow.getLocation();
  28. /* 43 */ World world = event.getEntity().getWorld();
  29. /* 44 */ Block block = world.getBlockAt(arrowLoc);
  30. /* 45 */ List blockList = new ArrayList();
  31. /* 46 */ for (int i = -1; i < 1; ++i) {
  32. /* 47 */ int x = arrowLoc.getBlockX() - i;
  33. /* 48 */ for (int j = -1; j < 1; ++j) {
  34. /* 49 */ int y = arrowLoc.getBlockY() - j;
  35. /* 50 */ for (int k = -1; k < 1; ++k) {
  36. /* 51 */ int z = arrowLoc.getBlockZ() - k;
  37. /* 52 */ Block blockToBeAdded = world.getBlockAt(x, y, z);
  38. /* 53 */ blockList.add(blockToBeAdded);
  39. /* */ }
  40. /* */ }
  41. /* */ }
  42. /* 57 */ blockList.add(block);
  43. /* */
  44. /* 59 */ for (Block b : blockList)
  45. /* 60 */ if (b.getTypeId() == 50)
  46. /* */ {
  47. /* 62 */ event.getEntity().getWorld().getBlockAt(b.getLocation()).setTypeId(0);
  48. /* */ }
  49. /* */ }
  50. /* */ }
  51. /* */ }
  52.  
  53. /* Location: C:\Ali\Java\Plugins\BlackArrowTorching.jar
  54. * Qualified Name: me.blackhawklex.blackarrowtorching.listeners.Listener_Entity
  55. * Java Class Version: 6 (50.0)
  56. * JD-Core Version: 0.5.3
  57. */
Add Comment
Please, Sign In to add comment