Fixed vanilla-exp in fishing drop tables. experience is no longer necessary

This commit is contained in:
Jules 2024-06-20 19:27:09 -07:00
parent ee2793d04d
commit 040e7360df
2 changed files with 6 additions and 7 deletions

View File

@ -2,11 +2,10 @@ package net.Indyuce.mmocore.loot.fishing;
import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.MMOLineConfig;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.loot.Weighted;
import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; import net.Indyuce.mmocore.api.util.math.formula.RandomAmount;
import net.Indyuce.mmocore.loot.LootBuilder; import net.Indyuce.mmocore.loot.LootBuilder;
import net.Indyuce.mmocore.loot.Weighted;
import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem;
import org.apache.commons.lang.Validate;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -15,11 +14,11 @@ public class FishingDropItem implements Weighted {
private final DropItem dropItem; private final DropItem dropItem;
public FishingDropItem(MMOLineConfig config) { public FishingDropItem(MMOLineConfig config) {
config.validateKeys("tugs", "experience"); config.validateKeys("tugs");
tugs = new RandomAmount(config.getString("tugs")); tugs = new RandomAmount(config.getString("tugs"));
experience = new RandomAmount(config.getString("experience")); experience = config.contains("experience") ? new RandomAmount(config.getString("experience")) : new RandomAmount(0, 0);
vanillaExp = config.contains("vanilla-exp") ? new RandomAmount(config.getString("vanilla-experience")) : new RandomAmount(0, 0); vanillaExp = config.contains("vanilla-exp") ? new RandomAmount(config.getString("vanilla-exp")) : new RandomAmount(0, 0);
dropItem = MMOCore.plugin.loadManager.loadDropItem(config); dropItem = MMOCore.plugin.loadManager.loadDropItem(config);
} }

View File

@ -197,8 +197,8 @@ public class FishingListener implements Listener {
player.getWorld().playSound(player.getLocation(), VSound.BLOCK_NOTE_BLOCK_HAT.get(), 1, 0); player.getWorld().playSound(player.getLocation(), VSound.BLOCK_NOTE_BLOCK_HAT.get(), 1, 0);
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
location.getWorld().spawnParticle(VParticle.FIREWORK.get(), location, 0, 4 * (RANDOM.nextDouble() - .5), RANDOM.nextDouble() + 1, 4 * (RANDOM.nextDouble() - .5), .08); location.getWorld().spawnParticle(VParticle.FIREWORK.get(), location, 0, 4 * (RANDOM.nextDouble() - .5), RANDOM.nextDouble() + 1, 4 * (RANDOM.nextDouble() - .5), .08);
player.giveExp(vanillaExpDropped); if (vanillaExpDropped > 0) player.giveExp(vanillaExpDropped);
if (MMOCore.plugin.fishingManager.hasLinkedProfession()) if (experienceDropped > 0 && MMOCore.plugin.fishingManager.hasLinkedProfession())
playerData.getCollectionSkills().giveExperience(MMOCore.plugin.fishingManager.getLinkedProfession(), experienceDropped, EXPSource.FISHING, location, true); playerData.getCollectionSkills().giveExperience(MMOCore.plugin.fishingManager.getLinkedProfession(), experienceDropped, EXPSource.FISHING, location, true);
} }
} }