Player player =Bukkit.getPlayer("player");Context<Player> context =Context.player(player);// You can create it with null, but please be careful not to use it in any place // where a player is needed, such as checking permissions, sending messagesContext<Player> context =Context.player(null);
Get plugin instance
BukkitCustomFishingPlugin api =BukkitCustomFishingPlugin.getInstance()
// There are three stages in total// CAST: Determines what fishing mechanics are available (such as lava fishing)// LOOT: Affects the weight of the next loot// FISHING: Determines loot-related properties, such as size, score, and game difficultymodifier.apply(effect,FishingEffectApplyEvent.Stage.CAST, context);
Get the loot at a certain location
context.arg(ContextKeys.LOCATION,player.getLocation()); // sets the player locationcontext.arg(ContextKeys.OTHER_LOCATION, custom_location); // sets the custom locationLoot loot =api.getLootManager().getNextLoot(effect, context);
Convert loot into an itemStack
if (loot.type() ==LootType.ITEM) {ItemStack itemStack =api.getItemManager().buildInternal(context,loot.id());}