From 8f3dce4ee916af1dce0ebabcfd53134fb16ae49d Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 21 Feb 2012 00:26:16 -0500 Subject: [PATCH] Started working on customizing Fishing drops --- .../com/gmail/nossr50/config/LoadProperties.java | 12 ++++++++++-- .../nossr50/datatypes/treasure/FishingTreasure.java | 13 ++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 83e407557..27e31719f 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -99,6 +99,7 @@ public class LoadProperties { public static List excavationFromClay = new ArrayList(); public static List excavationFromMycel = new ArrayList(); public static List excavationFromSoulSand = new ArrayList(); + public static List fishingRewards = new ArrayList(); public static HUDType defaulthud; protected static File configFile; @@ -439,7 +440,9 @@ public class LoadProperties { ItemStack item = new ItemStack(id, amount, (byte) 0, (byte) data); if(readBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) { - // TODO: Fishing + int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Levels"); + FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel); + treasures.put(treasureName, fTreasure); } else { ExcavationTreasure eTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel); if(readBoolean("Treasures." + treasureName + ".Drops_From.Dirt", false)) @@ -462,6 +465,7 @@ public class LoadProperties { } List excavationTreasures = config.getStringList("Excavation.Treasure"); + List fishingTreasures = config.getStringList("Excavation.Treasure"); Iterator treasureIterator = treasures.keySet().iterator(); while(treasureIterator.hasNext()) { @@ -469,7 +473,11 @@ public class LoadProperties { Treasure treasure = treasures.get(treasureKey); if(treasure instanceof FishingTreasure) { - // TODO: Fishing + if(!fishingTreasures.contains(treasureKey)) continue; + + FishingTreasure fTreasure = (FishingTreasure) treasure; + fishingRewards.add(fTreasure); + } else if(treasure instanceof ExcavationTreasure) { if(!excavationTreasures.contains(treasureKey)) continue; diff --git a/src/main/java/com/gmail/nossr50/datatypes/treasure/FishingTreasure.java b/src/main/java/com/gmail/nossr50/datatypes/treasure/FishingTreasure.java index 1a158804c..097851c03 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/treasure/FishingTreasure.java +++ b/src/main/java/com/gmail/nossr50/datatypes/treasure/FishingTreasure.java @@ -3,10 +3,21 @@ package com.gmail.nossr50.datatypes.treasure; import org.bukkit.inventory.ItemStack; public class FishingTreasure extends Treasure { + + private int maxLevel; - public FishingTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel) { + public FishingTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel, int maxLevel) { super(drop, xp, dropChance, dropLevel); + this.setMaxLevel(maxLevel); // TODO Auto-generated constructor stub } + public int getMaxLevel() { + return maxLevel; + } + + public void setMaxLevel(int maxLevel) { + this.maxLevel = maxLevel; + } + }