Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. @EventHandler
  2. public void onRodLand(final ProjectileHitEvent e) {
  3. if (e.getEntityType() != EntityType.FISHING_HOOK) {
  4. return;
  5. }
  6. for (final Entity entity : e.getEntity().getNearbyEntities(0.2, 0.2, 0.2)) {
  7. if (!(entity instanceof Player)) {
  8. continue;
  9. }
  10. final FishHook hook = (FishHook) e.getEntity();
  11. final Player rodder = (Player) hook.getShooter();
  12. final Player player = (Player) entity;
  13. if (player.getName().equalsIgnoreCase(rodder.getName())) {
  14. continue;
  15. }
  16. if (player.getGameMode() == GameMode.CREATIVE) {
  17. continue;
  18. }
  19. player.damage(0.2);
  20. final Location loc = player.getLocation().add(0.0, 0.5, 0.0);
  21. player.teleport(loc);
  22. player.setVelocity(rodder.getLocation().getDirection().multiply(0.4));
  23. hook.remove();
  24. rodder.updateInventory();
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement