Skip to content

Commit a262cc2

Browse files
committed
Commit
1 parent 2c96bdb commit a262cc2

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/main/java/me/nik/combatplus/listeners/FishingRodKnockback.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,39 @@ public class FishingRodKnockback implements Listener {
2929
@EventHandler(priority = EventPriority.HIGHEST)
3030
public void onRodLand(ProjectileHitEvent e) {
3131

32-
Entity hookEntity = e.getEntity();
33-
World world = hookEntity.getWorld();
32+
Entity rodHook = e.getEntity();
33+
World world = rodHook.getWorld();
3434
if (e.getEntityType() != EntityType.FISHING_HOOK) return;
3535

36-
Entity hitEntity;
36+
Entity target;
3737

3838
try {
39-
hitEntity = e.getHitEntity();
39+
target = e.getHitEntity();
4040
} catch (NoSuchMethodError error) {
41-
hitEntity = world.getNearbyEntities(hookEntity.getLocation(), 0.25, 0.25, 0.25).stream().filter(entity -> entity instanceof Player).findFirst().orElse(null);
41+
target = world.getNearbyEntities(rodHook.getLocation(), 0.25, 0.25, 0.25).stream().filter(entity -> entity instanceof Player).findFirst().orElse(null);
4242
}
4343

44-
if (hitEntity == null) return;
45-
if (!(hitEntity instanceof LivingEntity)) return;
44+
if (target == null) return;
45+
if (!(target instanceof LivingEntity)) return;
4646

47-
if (hitEntity.hasMetadata("NPC")) return;
47+
if (target.hasMetadata("NPC")) return;
4848

49-
FishHook hook = (FishHook) hookEntity;
49+
FishHook hook = (FishHook) rodHook;
5050
Player rodder = (Player) hook.getShooter();
5151

52-
if (hitEntity instanceof Player) {
53-
Player player = (Player) hitEntity;
52+
if (target instanceof Player) {
53+
Player player = (Player) target;
5454

5555
if (player.equals(rodder)) return;
5656

5757
if (player.getGameMode() == GameMode.CREATIVE) return;
5858
}
5959

60-
LivingEntity livingEntity = (LivingEntity) hitEntity;
60+
LivingEntity livingEntity = (LivingEntity) target;
6161

6262
if (livingEntity.getNoDamageTicks() > livingEntity.getMaximumNoDamageTicks() / 2f) return;
6363

64-
EntityDamageEvent event = makeEvent(rodder, hitEntity, fishingRodDamage);
64+
EntityDamageEvent event = makeEvent(rodder, target, fishingRodDamage);
6565
Bukkit.getPluginManager().callEvent(event);
6666
if (event.isCancelled()) return;
6767

0 commit comments

Comments
 (0)