HomeJavaModsPvP Rod Fix (Minecraft 1.9)
ModsJava

PvP Rod Fix (Minecraft 1.9)

Restores use to the fishing rod in PvP for Minecraft 1.9. Free Minecraft Java mod — download and open it in the game.

⬇ Download on Spigot
[​IMG]

This plugin was developed to restore the old mechanics of the fishing rod in PvP situations.

I'll be making a few more adjustments to make it more accurate but it shouldn't be too long. As of now the plugin works fine, and should keep your players happy.

Please understand this only fixes them to a certain degree. If I was to completely fix them in the PvP side of things they wouldn't work well with actual fishing.
If anyone has any code they would like to give me to help this plugin PM me via skype.



Source
Code (Text):
package me.hykurtis.fishingrod;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener {

    public void onEnable() {
        this.getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onRodLand(ProjectileHitEvent e) {
        if(!(e.getEntityType() == EntityType.FISHING_HOOK)) {
            return;
        }
        for(Entity entity : Bukkit.getWorld(e.getEntity().getLocation().getWorld().getName()).getNearbyEntities(e.getEntity().getLocation(), 0.2, 0.2, 0.2)) {
            if(!(entity instanceof Player)) {
                continue;
            }
            FishHook hook = (FishHook) e.getEntity();
            Player rodder = (Player) hook.getShooter();
            Player player = (Player) entity;
            if(player.getName().equalsIgnoreCase(rodder.getName())) {
                continue;
            }
            player.damage(0.2);
            Location loc = player.getLocation().add(0, 0.5, 0);
            player.teleport(loc);
            player.setVelocity(rodder.getLocation().getDirection().multiply(+0.4));
            hook.remove();
            rodder.updateInventory();
            return;
        }
    }

}
 

PvP Rod Fix (Minecraft 1.9) is a free Minecraft Java mod. Downloaded 1,073 times (via Spigot). Download it and open it directly in the game.

Explore more