Hey I need this plugin recreated or modified: spigotmc.org/resources/grappling-hook.70854/
Basically, I want players to be able to fish with the grappling hook, but the original dev removed this with this code:
(thanks to Paper Studios, specifically CyberSecGuy from there, for noticing this for me)
no timeframe, no specific budget
kevin123#8222
Basically, I want players to be able to fish with the grappling hook, but the original dev removed this with this code:
Code:
@EventHandler(priority = EventPriority.HIGH)
public void onThrow(PlayerFishEvent e) {
GrapplingHook gh = GrapplingHook.get(e.getPlayer());
if (gh != null) {
Entity hook = getHook(e);
Log.debug("PlayerFishEvent(" + e.getState().toString() + ") hook=" + ((hook != null) ? "yes" : "no") + " caught=" + ((e.getCaught() != null) ? e.getCaught().getType().toString() : "<none>"));
if (e.getState().equals(PlayerFishEvent.State.FISHING)) { <<----- Is the player fishing? ###
if (gh.canThrow(e.getPlayer())) {
gh.throwHook(e.getPlayer(), hook);
} else { <<< --- Yes he is, so we cancel the fishing event ###
e.setCancelled(true);
}
} else if (e.getState().equals(PlayerFishEvent.State.BITE)) { <<<--- Did a fish bite the line ###
e.setCancelled(true); <--- Yes it did, cancel the fish bite stop fishing ###
} else if (e.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY)) { <<<--- Did he catch a fish? ###
if (gh.canPull()) {
gh.pull(e.getPlayer(), e.getCaught());
} else {
e.setCancelled(true); <<< --- Yes he did, stop the event, remove the fish. ###
hook.remove(); <<< "Then it just disappears" - Right here, this is that.
}
} else if (e.getState().equals(PlayerFishEvent.State.CAUGHT_FISH)) {
e.setCancelled(true);
hook.remove();
} else if (e.getState().equals(PlayerFishEvent.State.IN_GROUND)) {
if (gh.hasLatch()) {
if (gh.canRappel(e.getPlayer()))
gh.startRappel(e.getPlayer());
e.setCancelled(true);
}
} else if (e.getState().toString().equals("REEL_IN")) {
gh.retract(e.getPlayer());
}
}
}
no timeframe, no specific budget
kevin123#8222
