9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-19 15:09:24 +00:00
This commit is contained in:
XiaoMoMi
2024-12-12 16:44:07 +08:00
parent fb81816b53
commit f2715e6bcf
2 changed files with 5 additions and 4 deletions

View File

@@ -570,24 +570,24 @@ public class CustomFishingHook {
if (competition != null && RequirementManager.isSatisfied(context, competition.getConfig().joinRequirements())) {
Double customScore = context.arg(ContextKeys.CUSTOM_SCORE);
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, customScore);
} else {
double score = 0;
if (competition.getGoal() == CompetitionGoal.CATCH_AMOUNT) {
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) {
Float size = context.arg(ContextKeys.SIZE);
if (size != null && size > 0) {
competition.refreshData(context.holder(), size);
competition.refreshScore(context.holder(), size);
}
} else if (competition.getGoal() == CompetitionGoal.TOTAL_SCORE) {
score = nextLoot.score().evaluate(context);
score = score * tempFinalEffect.scoreMultiplier() + tempFinalEffect.scoreAdder();
if (score != 0) {
competition.refreshData(context.holder(), score);
competition.refreshScore(context.holder(), score);
}
}
context.arg(ContextKeys.SCORE_FORMATTED, String.format("%.2f", score));

View File

@@ -177,6 +177,7 @@ public class BukkitItemManager implements ItemManager, Listener {
@Override
public String getCustomFishingItemID(@NotNull ItemStack itemStack) {
if (itemStack.getType() == Material.AIR) return null;
return (String) factory.wrap(itemStack).getTag("CustomFishing", "id").orElse(null);
}