Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onRodLand(final ProjectileHitEvent e) {
- if (e.getEntityType() != EntityType.FISHING_HOOK) {
- return;
- }
- for (final Entity entity : e.getEntity().getNearbyEntities(0.2, 0.2, 0.2)) {
- if (!(entity instanceof Player)) {
- continue;
- }
- final FishHook hook = (FishHook) e.getEntity();
- final Player rodder = (Player) hook.getShooter();
- final Player player = (Player) entity;
- if (player.getName().equalsIgnoreCase(rodder.getName())) {
- continue;
- }
- if (player.getGameMode() == GameMode.CREATIVE) {
- continue;
- }
- player.damage(0.2);
- final Location loc = player.getLocation().add(0.0, 0.5, 0.0);
- player.teleport(loc);
- player.setVelocity(rodder.getLocation().getDirection().multiply(0.4));
- hook.remove();
- rodder.updateInventory();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement