From 719ce614bce46973f00bba980b02e30940d01c77 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Fri, 14 Oct 2022 00:38:24 +0200 Subject: [PATCH] Reduced confusion for fishing drops config --- .../Indyuce/mmocore/loot/fishing/FishingDropItem.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/loot/fishing/FishingDropItem.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/loot/fishing/FishingDropItem.java index ea699fdf..4add8e8b 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/loot/fishing/FishingDropItem.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/loot/fishing/FishingDropItem.java @@ -15,18 +15,22 @@ public class FishingDropItem implements Weighted { private final DropItem dropItem; public FishingDropItem(MMOLineConfig config) { - config.validate("tugs", "experience"); + config.validateKeys("tugs", "experience"); tugs = new RandomAmount(config.getString("tugs")); experience = new RandomAmount(config.getString("experience")); dropItem = MMOCore.plugin.loadManager.loadDropItem(config); - Validate.isTrue(dropItem.getWeight() > 0, "A fishing drop table item must have a strictly positive weight"); } + /** + * An item cannot have a negative weight. Since drop items have 0 weight + * by default, MMOCore takes 1 as minimum value if the item weight is + * negative or equal to 0 + */ @Override public double getWeight() { - return dropItem.getWeight(); + return dropItem.getWeight() <= 0 ? 1 : 0; } public DropItem getItem() {