mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
Fix size & score effect
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -484,6 +484,19 @@ public class BukkitConfigManager extends ConfigManager {
|
||||
double minSize = min.evaluate(context);
|
||||
double maxSize = max.evaluate(context);
|
||||
float size = (float) RandomUtils.generateRandomDouble(minSize, maxSize);
|
||||
Double sm = context.arg(ContextKeys.SIZE_MULTIPLIER);
|
||||
if (sm == null) sm = 1.0;
|
||||
Double sa = context.arg(ContextKeys.SIZE_ADDER);
|
||||
if (sa == null) sa = 0.0;
|
||||
size = (float) (sm * size + sa);
|
||||
if (restrictedSizeRange()) {
|
||||
if (size > maxSize) {
|
||||
size = (float) maxSize;
|
||||
}
|
||||
if (size < minSize) {
|
||||
size = (float) minSize;
|
||||
}
|
||||
}
|
||||
item.setTag(size, "CustomFishing", "size");
|
||||
context.arg(ContextKeys.SIZE, size);
|
||||
context.arg(ContextKeys.MIN_SIZE, minSize);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Project settings
|
||||
# Rule: [major update].[feature update].[bug fix]
|
||||
project_version=2.2.17
|
||||
project_version=2.2.18
|
||||
config_version=36
|
||||
project_group=net.momirealms
|
||||
|
||||
|
||||
Reference in New Issue
Block a user