forked from Upstream/mmocore
Added the possibility to give vanilla exp with fishing drop items.
This commit is contained in:
parent
8000bc9b89
commit
9b7d0c35b7
@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class FishingDropItem implements Weighted {
|
||||
private final RandomAmount experience, tugs;
|
||||
private final RandomAmount experience, tugs, vanillaExp;
|
||||
private final DropItem dropItem;
|
||||
|
||||
public FishingDropItem(MMOLineConfig config) {
|
||||
@ -19,7 +19,7 @@ public class FishingDropItem implements Weighted {
|
||||
|
||||
tugs = new RandomAmount(config.getString("tugs"));
|
||||
experience = new RandomAmount(config.getString("experience"));
|
||||
|
||||
vanillaExp = config.contains("vanilla-exp") ? new RandomAmount(config.getString("vanilla-experience")) : new RandomAmount(0, 0);
|
||||
dropItem = MMOCore.plugin.loadManager.loadDropItem(config);
|
||||
}
|
||||
|
||||
@ -41,6 +41,10 @@ public class FishingDropItem implements Weighted {
|
||||
return experience;
|
||||
}
|
||||
|
||||
public RandomAmount getVanillaExp() {
|
||||
return vanillaExp;
|
||||
}
|
||||
|
||||
public RandomAmount getTugs() {
|
||||
return tugs;
|
||||
}
|
||||
@ -49,6 +53,10 @@ public class FishingDropItem implements Weighted {
|
||||
return experience.calculateInt();
|
||||
}
|
||||
|
||||
public int rollVanillaExp() {
|
||||
return vanillaExp.calculateInt();
|
||||
}
|
||||
|
||||
public int rollTugs() {
|
||||
return tugs.calculateInt();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class FishingListener implements Listener {
|
||||
private final Player player;
|
||||
private final FishHook hook;
|
||||
|
||||
private final int fishStrength, experienceDropped;
|
||||
private final int fishStrength, experienceDropped, vanillaExpDropped;
|
||||
|
||||
private int currentPulls;
|
||||
|
||||
@ -82,7 +82,7 @@ public class FishingListener implements Listener {
|
||||
|
||||
this.fishStrength = (int) Math.floor(caught.rollTugs() * (1 - PlayerData.get(player).getStats().getStat("FISHING_STRENGTH") / 100));
|
||||
this.experienceDropped = caught.rollExperience();
|
||||
|
||||
this.vanillaExpDropped = caught.rollVanillaExp();
|
||||
fishing.add(player.getUniqueId());
|
||||
runTaskTimer(MMOCore.plugin, 0, 2);
|
||||
Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin);
|
||||
@ -195,7 +195,7 @@ public class FishingListener implements Listener {
|
||||
player.getWorld().playSound(player.getLocation(), VersionSound.BLOCK_NOTE_BLOCK_HAT.toSound(), 1, 0);
|
||||
for (int j = 0; j < 8; j++)
|
||||
location.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, location, 0, 4 * (RANDOM.nextDouble() - .5), RANDOM.nextDouble() + 1, 4 * (RANDOM.nextDouble() - .5), .08);
|
||||
|
||||
player.giveExp(vanillaExpDropped);
|
||||
if (MMOCore.plugin.fishingManager.hasLinkedProfession())
|
||||
playerData.getCollectionSkills().giveExperience(MMOCore.plugin.fishingManager.getLinkedProfession(), experienceDropped, EXPSource.FISHING, location, true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user