mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
fix air
This commit is contained in:
@@ -570,24 +570,24 @@ public class CustomFishingHook {
|
|||||||
if (competition != null && RequirementManager.isSatisfied(context, competition.getConfig().joinRequirements())) {
|
if (competition != null && RequirementManager.isSatisfied(context, competition.getConfig().joinRequirements())) {
|
||||||
Double customScore = context.arg(ContextKeys.CUSTOM_SCORE);
|
Double customScore = context.arg(ContextKeys.CUSTOM_SCORE);
|
||||||
if (customScore != null) {
|
if (customScore != null) {
|
||||||
competition.refreshData(context.holder(), customScore);
|
competition.refreshScore(context.holder(), customScore);
|
||||||
context.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", customScore));
|
context.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", customScore));
|
||||||
context.arg(ContextKeys.SCORE, customScore);
|
context.arg(ContextKeys.SCORE, customScore);
|
||||||
} else {
|
} else {
|
||||||
double score = 0;
|
double score = 0;
|
||||||
if (competition.getGoal() == CompetitionGoal.CATCH_AMOUNT) {
|
if (competition.getGoal() == CompetitionGoal.CATCH_AMOUNT) {
|
||||||
score = 1;
|
score = 1;
|
||||||
competition.refreshData(context.holder(), score);
|
competition.refreshScore(context.holder(), score);
|
||||||
} else if (competition.getGoal() == CompetitionGoal.MAX_SIZE || competition.getGoal() == CompetitionGoal.MIN_SIZE || competition.getGoal() == CompetitionGoal.TOTAL_SIZE) {
|
} else if (competition.getGoal() == CompetitionGoal.MAX_SIZE || competition.getGoal() == CompetitionGoal.MIN_SIZE || competition.getGoal() == CompetitionGoal.TOTAL_SIZE) {
|
||||||
Float size = context.arg(ContextKeys.SIZE);
|
Float size = context.arg(ContextKeys.SIZE);
|
||||||
if (size != null && size > 0) {
|
if (size != null && size > 0) {
|
||||||
competition.refreshData(context.holder(), size);
|
competition.refreshScore(context.holder(), size);
|
||||||
}
|
}
|
||||||
} else if (competition.getGoal() == CompetitionGoal.TOTAL_SCORE) {
|
} else if (competition.getGoal() == CompetitionGoal.TOTAL_SCORE) {
|
||||||
score = nextLoot.score().evaluate(context);
|
score = nextLoot.score().evaluate(context);
|
||||||
score = score * tempFinalEffect.scoreMultiplier() + tempFinalEffect.scoreAdder();
|
score = score * tempFinalEffect.scoreMultiplier() + tempFinalEffect.scoreAdder();
|
||||||
if (score != 0) {
|
if (score != 0) {
|
||||||
competition.refreshData(context.holder(), score);
|
competition.refreshScore(context.holder(), score);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", score));
|
context.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", score));
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ public class BukkitItemManager implements ItemManager, Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCustomFishingItemID(@NotNull ItemStack itemStack) {
|
public String getCustomFishingItemID(@NotNull ItemStack itemStack) {
|
||||||
|
if (itemStack.getType() == Material.AIR) return null;
|
||||||
return (String) factory.wrap(itemStack).getTag("CustomFishing", "id").orElse(null);
|
return (String) factory.wrap(itemStack).getTag("CustomFishing", "id").orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user