9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-29 20:09:14 +00:00

Fix size & score effect

This commit is contained in:
XiaoMoMi
2024-08-18 00:08:16 +08:00
parent 17dd3705d0
commit 4b561602a8
4 changed files with 19 additions and 1 deletions

View File

@@ -41,6 +41,8 @@ public class ContextKeys<T> {
public static final ContextKeys<String> NICK = of("nick", String.class);
public static final ContextKeys<Boolean> OPEN_WATER = of("open_water", Boolean.class);
public static final ContextKeys<Float> SIZE = of("size", Float.class);
public static final ContextKeys<Double> SIZE_MULTIPLIER = of("size_multiplier", Double.class);
public static final ContextKeys<Double> SIZE_ADDER = of("size_adder", Double.class);
public static final ContextKeys<String> SIZE_FORMATTED = of("size_formatted", String.class);
public static final ContextKeys<Double> PRICE = of("price", Double.class);
public static final ContextKeys<String> PRICE_FORMATTED = of("price_formatted", String.class);

View File

@@ -457,6 +457,8 @@ public class CustomFishingHook {
switch (lootType) {
case ITEM -> {
context.arg(ContextKeys.SIZE_MULTIPLIER, tempFinalEffect.sizeMultiplier());
context.arg(ContextKeys.SIZE_ADDER, tempFinalEffect.sizeAdder());
for (int i = 0; i < amount; i++) {
plugin.getScheduler().sync().runLater(() -> {
Item item = plugin.getItemManager().dropItemLoot(context, gears.getItem(FishingGears.GearType.ROD).stream().findAny().orElseThrow().right(), hook);
@@ -526,6 +528,7 @@ public class CustomFishingHook {
}
} else if (competition.getGoal() == CompetitionGoal.TOTAL_SCORE) {
score = nextLoot.score().evaluate(context);
score = score * tempFinalEffect.scoreMultiplier() + tempFinalEffect.scoreAdder();
if (score != 0) {
competition.refreshData(context.getHolder(), score);
}