Reimplemented TreeFeller on Jungle Trees experience nerf

This commit is contained in:
bm01 2013-01-27 04:19:26 +01:00
parent 7ccadae489
commit d43e61a49c
2 changed files with 18 additions and 6 deletions

View File

@ -18,6 +18,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.Combat; import com.gmail.nossr50.skills.Combat;
import com.gmail.nossr50.skills.SkillType; import com.gmail.nossr50.skills.SkillType;
import com.gmail.nossr50.skills.SkillTools; import com.gmail.nossr50.skills.SkillTools;
import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModChecks; import com.gmail.nossr50.util.ModChecks;
@ -178,14 +179,12 @@ public abstract class TreeFeller {
Woodcutting.checkDoubleDrop(player, block); Woodcutting.checkDoubleDrop(player, block);
try { try {
xp += Woodcutting.getExperienceFromLog(block); xp += Woodcutting.getExperienceFromLog(block, ExperienceGainMethod.TREE_FELLER);
} }
catch (IllegalArgumentException exception) { catch (IllegalArgumentException exception) {
break; break;
} }
// TODO: Nerf XP from jungle trees, as it was done previously
Misc.dropItem(block.getLocation(), new ItemStack(Material.LOG, 1, Woodcutting.extractLogItemData(block.getData()))); Misc.dropItem(block.getLocation(), new ItemStack(Material.LOG, 1, Woodcutting.extractLogItemData(block.getData())));
break; break;
case LEAVES: case LEAVES:

View File

@ -23,6 +23,11 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public final class Woodcutting { public final class Woodcutting {
protected enum ExperienceGainMethod {
DEFAULT,
TREE_FELLER,
};
public static final int DOUBLE_DROP_MAX_LEVEL = AdvancedConfig.getInstance().getMiningDoubleDropMaxLevel(); public static final int DOUBLE_DROP_MAX_LEVEL = AdvancedConfig.getInstance().getMiningDoubleDropMaxLevel();
public static final double DOUBLE_DROP_CHANCE = AdvancedConfig.getInstance().getMiningDoubleDropChance(); public static final double DOUBLE_DROP_CHANCE = AdvancedConfig.getInstance().getMiningDoubleDropChance();
public static final int LEAF_BLOWER_UNLOCK_LEVEL = AdvancedConfig.getInstance().getLeafBlowUnlockLevel(); public static final int LEAF_BLOWER_UNLOCK_LEVEL = AdvancedConfig.getInstance().getLeafBlowUnlockLevel();
@ -69,7 +74,7 @@ public final class Woodcutting {
} }
else { else {
try { try {
xp = getExperienceFromLog(block); xp = getExperienceFromLog(block, ExperienceGainMethod.DEFAULT);
} }
catch (IllegalArgumentException exception) { catch (IllegalArgumentException exception) {
return; return;
@ -84,10 +89,11 @@ public final class Woodcutting {
* Retrieves the experience reward from a log * Retrieves the experience reward from a log
* *
* @param log Log being broken * @param log Log being broken
* @param experienceGainMethod How the log is being broken
* @return Amount of experience * @return Amount of experience
* @throws IllegalArgumentException if 'log' is invalid * @throws IllegalArgumentException if 'log' is invalid
*/ */
protected static int getExperienceFromLog(Block log) { protected static int getExperienceFromLog(Block log, ExperienceGainMethod experienceGainMethod) {
TreeSpecies logType = TreeSpecies.getByData(extractLogItemData(log.getData())); TreeSpecies logType = TreeSpecies.getByData(extractLogItemData(log.getData()));
// Apparently species can be null in certain cases (custom server mods?) // Apparently species can be null in certain cases (custom server mods?)
@ -104,7 +110,14 @@ public final class Woodcutting {
case BIRCH: case BIRCH:
return Config.getInstance().getWoodcuttingXPBirch(); return Config.getInstance().getWoodcuttingXPBirch();
case JUNGLE: case JUNGLE:
return Config.getInstance().getWoodcuttingXPJungle(); int xp = Config.getInstance().getWoodcuttingXPJungle();
switch (experienceGainMethod) {
case TREE_FELLER:
return (int) (xp * 0.5);
default:
return xp;
}
default: default:
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }