mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
add first capture condition
This commit is contained in:
@@ -166,6 +166,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
||||
}
|
||||
|
||||
private void registerBuiltInRequirements() {
|
||||
this.registerFirstCaptureRequirement();
|
||||
this.registerTimeRequirement();
|
||||
this.registerYRequirement();
|
||||
this.registerInWaterRequirement();
|
||||
@@ -458,6 +459,19 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
||||
}, "&&");
|
||||
}
|
||||
|
||||
private void registerFirstCaptureRequirement() {
|
||||
registerRequirement((args, actions, runActions) -> {
|
||||
boolean required = (boolean) args;
|
||||
return context -> {
|
||||
Boolean arg = context.arg(ContextKeys.FIRST_CAPTURE);
|
||||
boolean first = arg != null && arg;
|
||||
if (first == required) return true;
|
||||
if (runActions) ActionManager.trigger(context, actions);
|
||||
return false;
|
||||
};
|
||||
}, "first-capture");
|
||||
}
|
||||
|
||||
private void registerInWaterRequirement() {
|
||||
registerRequirement((args, actions, runActions) -> {
|
||||
boolean inWater = (boolean) args;
|
||||
|
||||
Reference in New Issue
Block a user