use of com.gamingmesh.jobs.actions.ItemActionInfo in project Jobs by GamingMesh.
the class JobsPaymentListener method onPlayerFish.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerFish(PlayerFishEvent event) {
// make sure plugin is enabled
if (!plugin.isEnabled())
return;
Player player = event.getPlayer();
// check if in creative
if (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) && !ConfigManager.getJobsConfiguration().payInCreative())
return;
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
return;
// restricted area multiplier
double multiplier = ConfigManager.getJobsConfiguration().getRestrictedMultiplier(player);
if (event.getState().equals(PlayerFishEvent.State.CAUGHT_FISH) && event.getCaught() instanceof Item) {
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
ItemStack items = ((Item) event.getCaught()).getItemStack();
Jobs.action(jPlayer, new ItemActionInfo(items, ActionType.FISH), multiplier);
}
}
Aggregations