use of org.bukkit.entity.FishHook in project Glowstone by GlowstoneMC.
the class ItemFishingRod method rightClickAir.
@Override
public void rightClickAir(GlowPlayer player, ItemStack holding) {
if (player.getCurrentFishingHook() == null) {
Location location = calculateSpawnLocation(player);
FishHook fishHook = new GlowFishingHook(location, holding, player);
fishHook.setShooter(player);
player.setCurrentFishingHook((GlowFishingHook) fishHook);
} else {
player.getCurrentFishingHook().reelIn();
player.setCurrentFishingHook(null);
}
}
use of org.bukkit.entity.FishHook in project Denizen-For-Bukkit by DenizenScript.
the class FishingHelperImpl method spawnHook.
@Override
public FishHook spawnHook(Location location, Player player) {
ServerLevel nmsWorld = ((CraftWorld) location.getWorld()).getHandle();
FishingHook hook = new FishingHook(((CraftPlayer) player).getHandle(), nmsWorld, 0, 0);
nmsWorld.addEntity(hook, CreatureSpawnEvent.SpawnReason.CUSTOM);
return (FishHook) hook.getBukkitEntity();
}
use of org.bukkit.entity.FishHook in project Citizens2 by CitizensDev.
the class EventListen method onProjectileHit.
@EventHandler(ignoreCancelled = true)
public void onProjectileHit(final ProjectileHitEvent event) {
if (!(event.getEntity() instanceof FishHook))
return;
NMS.removeHookIfNecessary(npcRegistry, (FishHook) event.getEntity());
new BukkitRunnable() {
int n = 0;
@Override
public void run() {
if (n++ > 5) {
cancel();
}
NMS.removeHookIfNecessary(npcRegistry, (FishHook) event.getEntity());
}
}.runTaskTimer(CitizensAPI.getPlugin(), 0, 1);
}
use of org.bukkit.entity.FishHook in project Denizen-For-Bukkit by DenizenScript.
the class FishingHelperImpl method spawnHook.
@Override
public FishHook spawnHook(Location location, Player player) {
ServerLevel nmsWorld = ((CraftWorld) location.getWorld()).getHandle();
FishingHook hook = new FishingHook(((CraftPlayer) player).getHandle(), nmsWorld, 0, 0);
nmsWorld.addFreshEntity(hook, CreatureSpawnEvent.SpawnReason.CUSTOM);
return (FishHook) hook.getBukkitEntity();
}
Aggregations