mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
Reduced confusion for fishing drops config
This commit is contained in:
parent
c5177c8fc2
commit
719ce614bc
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user