Implemented a max point limit per rarity for fish that are too long
This commit is contained in:
parent
510d5130aa
commit
e576c1cc33
|
|
@ -79,7 +79,8 @@ public class Config extends AbstractConfig {
|
|||
getFishTypes(rarityPrefix),
|
||||
config.getInt(rarityPrefix, "chance", 1),
|
||||
config.getDouble(rarityPrefix, "multiplier", 1.0),
|
||||
config.getInt(rarityPrefix, "rarity-value", 1)
|
||||
config.getInt(rarityPrefix, "rarity-value", 1),
|
||||
config.getInt(rarityPrefix, "max-point-limit", 1000)
|
||||
);
|
||||
RARITY_SET.add(rarity);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class CatchFish implements Listener {
|
|||
Fish fish = optionalFish.get();
|
||||
|
||||
float length = fish.generateLength();
|
||||
int pointsValue = pointsManagement.calculatePoints(fish.getRarity(), length);
|
||||
int pointsValue = Math.min(fish.getRarity().maxPointLimit(), pointsManagement.calculatePoints(fish.getRarity(), length));
|
||||
Optional<ItemStack> fishItem = fish.createItem(player, length, pointsValue);
|
||||
if (fishItem.isEmpty()) {
|
||||
player.sendMiniMessage(Messages.OTHER_ERRORS.UNABLE_TO_CREATE_FISH, null);
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ import net.kyori.adventure.text.Component;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
public record Rarity(String internalName, Component displayName, String displayNameString, Set<FishType> fishTypes, int chance, double multiplier, int rarityValue) {
|
||||
public record Rarity(String internalName, Component displayName, String displayNameString, Set<FishType> fishTypes, int chance, double multiplier, int rarityValue, int maxPointLimit) {
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user