Vanilla xp bonus should actually be in beginFishing()

or at least be called by beginFishing()
This commit is contained in:
bm01 2013-01-30 23:29:36 +01:00
parent 13a65e875f
commit 8b514d631c
2 changed files with 6 additions and 4 deletions

View File

@ -92,8 +92,7 @@ public class PlayerListener implements Listener {
switch (event.getState()) { switch (event.getState()) {
case CAUGHT_FISH: case CAUGHT_FISH:
Fishing.beginFishing(player, skillLevel, (Item) event.getCaught()); Fishing.beginFishing(player, skillLevel, event);
event.setExpToDrop(event.getExpToDrop() * Fishing.getVanillaXpMultiplier(skillLevel));
break; break;
case CAUGHT_ENTITY: case CAUGHT_ENTITY:

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
@ -104,9 +105,9 @@ public final class Fishing {
* *
* @param player Player fishing * @param player Player fishing
* @param skillLevel Fishing level of the player * @param skillLevel Fishing level of the player
* @param caught Item reeled * @param event Event to process
*/ */
public static void beginFishing(Player player, int skillLevel, Item caught) { public static void beginFishing(Player player, int skillLevel, PlayerFishEvent event) {
int treasureXp = 0; int treasureXp = 0;
FishingTreasure treasure = checkForTreasure(player, skillLevel); FishingTreasure treasure = checkForTreasure(player, skillLevel);
@ -121,11 +122,13 @@ public final class Fishing {
} }
// Drop the original catch at the feet of the player and set the treasure as the real catch // Drop the original catch at the feet of the player and set the treasure as the real catch
Item caught = (Item) event.getCaught();
Misc.dropItem(player.getEyeLocation(), caught.getItemStack()); Misc.dropItem(player.getEyeLocation(), caught.getItemStack());
caught.setItemStack(treasureDrop); caught.setItemStack(treasureDrop);
} }
SkillTools.xpProcessing(player, Users.getProfile(player), SkillType.FISHING, Config.getInstance().getFishingBaseXP() + treasureXp); SkillTools.xpProcessing(player, Users.getProfile(player), SkillType.FISHING, Config.getInstance().getFishingBaseXP() + treasureXp);
event.setExpToDrop(event.getExpToDrop() * Fishing.getVanillaXpMultiplier(skillLevel));
} }
/** /**