generated from Rosewood-Development/RoseTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
64 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/xyz/oribuin/fishing/fish/condition/impl/BoatCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package xyz.oribuin.fishing.fish.condition.impl; | ||
|
||
import org.bukkit.entity.Boat; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.FishHook; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.inventory.ItemStack; | ||
import xyz.oribuin.fishing.api.condition.CatchCondition; | ||
import xyz.oribuin.fishing.fish.Fish; | ||
|
||
public class BoatCondition implements CatchCondition { | ||
|
||
/** | ||
* Check if the requirements are met to run the condition | ||
* | ||
* @param fish The fish to check | ||
* | ||
* @return Results in true if the condition should run | ||
*/ | ||
@Override | ||
public boolean shouldRun(Fish fish) { | ||
return fish.condition().boatFishing(); | ||
} | ||
|
||
/** | ||
* Check if the player can catch the fish with the current conditions | ||
* | ||
* @param fish The fish the player is trying to catch | ||
* @param player The player to check | ||
* @param rod The fishing rod the player is using | ||
* @param hook The fishhook the player is using | ||
* | ||
* @return Results in true if the player can catch the fish | ||
*/ | ||
@Override | ||
public boolean check(Fish fish, Player player, ItemStack rod, FishHook hook) { | ||
if (!player.isInsideVehicle()) return false; | ||
|
||
Entity vehicle = player.getVehicle(); | ||
return vehicle instanceof Boat; | ||
} | ||
|
||
} |