Update mcMMO for Minecraft 1.7.2

This commit is contained in:
GJ 2013-12-02 12:08:12 -05:00 committed by TfT_02
parent 80571fbe8f
commit 60ddd799de
10 changed files with 198 additions and 56 deletions

View File

@ -8,6 +8,13 @@ Key:
- Removal - Removal
Version 1.5.00-dev Version 1.5.00-dev
+ Added Hardened Clay, Stained Clay, and Packed Ice to Mining blocks
+ Added Acacia and Dark Oak to Woodcutting blocks
+ Added Salmon, Clownfish, and Pufferfish to Fishing XP
+ Added new flowers and grasses to Herbalism XP
! Fishing XP now depends on the type of fish.
! Woodcutting XP in experience.yml now uses the tree species names. Oak is now Generic, and Spruce is now Redwood.
! Red_Rose was replaced by Poppy, and so the key in experience.yml has been updated accordingly.
- Removed deprecated permission nodes - Removed deprecated permission nodes
Version 1.4.08 Version 1.4.08

View File

@ -4,7 +4,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.material.LongGrass;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.config.AutoUpdateConfigLoader; import com.gmail.nossr50.config.AutoUpdateConfigLoader;
import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.experience.FormulaType;
@ -103,9 +106,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
} }
/* Fishing */ /* Fishing */
if (getFishingBaseXP() <= 0) { // TODO: Add validation for each fish type once enum is available.
reason.add("Experience.Fishing.Base should be greater than 0!");
}
if (getFishingShakeXP() <= 0) { if (getFishingShakeXP() <= 0) {
reason.add("Experience.Fishing.Shake should be greater than 0!"); reason.add("Experience.Fishing.Shake should be greater than 0!");
@ -126,20 +127,12 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
} }
/* Woodcutting */ /* Woodcutting */
if (getWoodcuttingXPOak() <= 0) { for (TreeSpecies species : TreeSpecies.values()) {
reason.add("Experience.Woodcutting.Oak should be greater than 0!"); String key = "Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_");
}
if (getWoodcuttingXPBirch() <= 0) { if (config.getInt(key) <= 0) {
reason.add("Experience.Woodcutting.Birch should be greater than 0!"); reason.add(key + " should be greater than 0!");
} }
if (getWoodcuttingXPSpruce() <= 0) {
reason.add("Experience.Woodcutting.Spruce should be greater than 0!");
}
if (getWoodcuttingXPJungle() <= 0) {
reason.add("Experience.Woodcutting.Jungle should be greater than 0!");
} }
if (getWoodcuttingXPHugeBrownMushroom() <= 0) { if (getWoodcuttingXPHugeBrownMushroom() <= 0) {
@ -211,9 +204,108 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public double getPotionXP() { return config.getDouble("Experience.Alchemy.Potion", 150D); } public double getPotionXP() { return config.getDouble("Experience.Alchemy.Potion", 150D); }
/* Fishing */ /* Fishing */
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); } public int getFishXp(MaterialData data) {
switch (data.getData()) {
case 0x0:
return config.getInt("Experience.Fishing.Raw_Fish", 800);
case 0x1:
return config.getInt("Experience.Fishing.Raw_Salmon", 800);
case 0x2:
return config.getInt("Experience.Fishing.Clownfish", 800);
case 0x3:
return config.getInt("Experience.Fishing.Pufferfish", 800);
default:
return 0;
}
}
public int getFishingShakeXP() { return config.getInt("Experience.Fishing.Shake", 50); } public int getFishingShakeXP() { return config.getInt("Experience.Fishing.Shake", 50); }
/* Herbalism */
public int getFlowerAndGrassXp(MaterialData data) {
Material type = data.getItemType();
if (type == Material.RED_ROSE) {
switch (data.getData()) {
case 0x0:
return config.getInt("Experience.Herbalism.Poppy", 100);
case 0x1:
return config.getInt("Experience.Herbalism.Blue_Orchid", 150);
case 0x2:
return config.getInt("Experience.Herbalism.Allium", 300);
case 0x3:
return config.getInt("Experience.Herbalism.Azure_Bluet", 150);
case 0x4:
return config.getInt("Experience.Herbalism.Red_Tulip", 150);
case 0x5:
return config.getInt("Experience.Herbalism.Orange_Tulip", 150);
case 0x6:
return config.getInt("Experience.Herbalism.White_Tulip", 150);
case 0x7:
return config.getInt("Experience.Herbalism.Pink_Tulip", 150);
case 0x8:
return config.getInt("Experience.Herbalism.Oxeye_Daisy", 150);
default:
return 0;
}
}
else if (type == Material.LONG_GRASS) {
switch (((LongGrass) data).getSpecies()) {
case DEAD:
return config.getInt("Experience.Herbalism.Dead_Bush", 100);
case FERN_LIKE:
return config.getInt("Experience.Herbalism.Small_Fern", 100);
case NORMAL:
return config.getInt("Experience.Herbalism.Small_Grass", 100);
default:
return 0;
}
}
else if (type == Material.DOUBLE_PLANT) {
switch (data.getData()) {
case 0x0:
return config.getInt("Experience.Herbalism.Sunflower", 50);
case 0x1:
return config.getInt("Experience.Herbalism.Lilac", 50);
case 0x2:
return config.getInt("Experience.Herbalism.Tall_Grass", 50);
case 0x3:
return config.getInt("Experience.Herbalism.Tall_Fern", 50);
case 0x4:
return config.getInt("Experience.Herbalism.Rose_Bush", 50);
case 0x5:
return config.getInt("Experience.Herbalism.Peony", 50);
default:
return 0;
}
}
return 0;
}
/* Repair */ /* Repair */
public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); } public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
public double getRepairXP(RepairMaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); } public double getRepairXP(RepairMaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
@ -224,10 +316,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); } public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
/* Woodcutting */ /* Woodcutting */
public int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); } public int getWoodcuttingTreeXP(TreeSpecies species) { return config.getInt("Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); }
public int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); }
public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); } public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); } public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
} }

View File

@ -304,6 +304,7 @@ public class FishingManager extends SkillManager {
*/ */
public void handleFishing(Item fishingCatch) { public void handleFishing(Item fishingCatch) {
this.fishingCatch = fishingCatch; this.fishingCatch = fishingCatch;
int fishXp = ExperienceConfig.getInstance().getFishXp(fishingCatch.getItemStack().getData());
int treasureXp = 0; int treasureXp = 0;
Player player = getPlayer(); Player player = getPlayer();
FishingTreasure treasure = null; FishingTreasure treasure = null;
@ -351,7 +352,7 @@ public class FishingManager extends SkillManager {
} }
} }
applyXpGain(ExperienceConfig.getInstance().getFishingBaseXP() + treasureXp); applyXpGain(fishXp + treasureXp);
} }
/** /**

View File

@ -148,7 +148,12 @@ public class HerbalismManager extends SkillManager {
processGreenThumbPlants(blockState, greenTerra); processGreenThumbPlants(blockState, greenTerra);
} }
if (material == Material.DOUBLE_PLANT || material == Material.RED_ROSE || material == Material.LONG_GRASS) {
xp = ExperienceConfig.getInstance().getFlowerAndGrassXp(blockState.getData());
}
else {
xp = ExperienceConfig.getInstance().getXp(skill, material); xp = ExperienceConfig.getInstance().getXp(skill, material);
}
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) { if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) {
drops = blockState.getBlock().getDrops(); drops = blockState.getBlock().getDrops();

View File

@ -39,11 +39,13 @@ public class Mining {
switch (blockType) { switch (blockType) {
case ENDER_STONE: case ENDER_STONE:
case GOLD_ORE: case GOLD_ORE:
case HARD_CLAY:
case IRON_ORE: case IRON_ORE:
case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE:
case NETHERRACK: case NETHERRACK:
case OBSIDIAN: case OBSIDIAN:
case SANDSTONE: case SANDSTONE:
case STAINED_CLAY:
handleMiningDrops(blockState); handleMiningDrops(blockState);
return; return;
@ -55,12 +57,13 @@ public class Mining {
case COAL_ORE: case COAL_ORE:
case DIAMOND_ORE: case DIAMOND_ORE:
case REDSTONE_ORE: case EMERALD_ORE:
case GLOWSTONE: case GLOWSTONE:
case LAPIS_ORE: case LAPIS_ORE:
case STONE: case PACKED_ICE:
case EMERALD_ORE:
case QUARTZ_ORE: case QUARTZ_ORE:
case REDSTONE_ORE:
case STONE:
Misc.dropItem(blockState.getLocation(), new ItemStack(blockType)); Misc.dropItem(blockState.getLocation(), new ItemStack(blockType));
return; return;
@ -82,17 +85,20 @@ public class Mining {
case COAL_ORE: case COAL_ORE:
case DIAMOND_ORE: case DIAMOND_ORE:
case EMERALD_ORE: case EMERALD_ORE:
case GLOWSTONE:
case LAPIS_ORE:
case STONE:
case ENDER_STONE: case ENDER_STONE:
case GLOWSTONE:
case GOLD_ORE: case GOLD_ORE:
case HARD_CLAY:
case IRON_ORE: case IRON_ORE:
case LAPIS_ORE:
case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE:
case NETHERRACK: case NETHERRACK:
case OBSIDIAN: case OBSIDIAN:
case PACKED_ICE:
case REDSTONE_ORE: case REDSTONE_ORE:
case SANDSTONE: case SANDSTONE:
case STAINED_CLAY:
case STONE:
case QUARTZ_ORE: case QUARTZ_ORE:
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops()); Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
return; return;

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -55,28 +56,14 @@ public final class Woodcutting {
return mcMMO.getModManager().getBlock(blockState).getXpGain(); return mcMMO.getModManager().getBlock(blockState).getXpGain();
} }
switch (((Tree) blockState.getData()).getSpecies()) { TreeSpecies species = ((Tree) blockState.getData()).getSpecies();
case GENERIC: int xp = ExperienceConfig.getInstance().getWoodcuttingTreeXP(species);
return ExperienceConfig.getInstance().getWoodcuttingXPOak();
case REDWOOD: if (species == TreeSpecies.JUNGLE && experienceGainMethod == ExperienceGainMethod.TREE_FELLER) {
return ExperienceConfig.getInstance().getWoodcuttingXPSpruce();
case BIRCH:
return ExperienceConfig.getInstance().getWoodcuttingXPBirch();
case JUNGLE:
int xp = ExperienceConfig.getInstance().getWoodcuttingXPJungle();
if (experienceGainMethod == ExperienceGainMethod.TREE_FELLER) {
xp *= 0.5; xp *= 0.5;
} }
return xp; return xp;
default:
return 0;
}
} }
/** /**

View File

@ -112,7 +112,9 @@ public final class BlockUtils {
switch (blockState.getType()) { switch (blockState.getType()) {
case BROWN_MUSHROOM: case BROWN_MUSHROOM:
case CACTUS: case CACTUS:
case DOUBLE_PLANT:
case MELON_BLOCK: case MELON_BLOCK:
case LONG_GRASS:
case PUMPKIN: case PUMPKIN:
case RED_MUSHROOM: case RED_MUSHROOM:
case RED_ROSE: case RED_ROSE:
@ -150,10 +152,13 @@ public final class BlockUtils {
switch (blockState.getType()) { switch (blockState.getType()) {
case ENDER_STONE: case ENDER_STONE:
case GLOWSTONE: case GLOWSTONE:
case HARD_CLAY:
case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE:
case NETHERRACK: case NETHERRACK:
case OBSIDIAN: case OBSIDIAN:
case PACKED_ICE:
case SANDSTONE: case SANDSTONE:
case STAINED_CLAY:
case STONE: case STONE:
return true; return true;
@ -195,6 +200,7 @@ public final class BlockUtils {
public static boolean isLog(BlockState blockState) { public static boolean isLog(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case LOG: case LOG:
case LOG_2:
case HUGE_MUSHROOM_1: case HUGE_MUSHROOM_1:
case HUGE_MUSHROOM_2: case HUGE_MUSHROOM_2:
return true; return true;
@ -213,6 +219,7 @@ public final class BlockUtils {
public static boolean isLeaves(BlockState blockState) { public static boolean isLeaves(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case LEAVES: case LEAVES:
case LEAVES_2:
return true; return true;
default: default:
@ -275,7 +282,7 @@ public final class BlockUtils {
* Determine if a given block can be made into Mycelium * Determine if a given block can be made into Mycelium
* *
* @param blockState The {@link BlockState} of the block to check * @param blockState The {@link BlockState} of the block to check
* @return true if the block can be made in Mycelium, false otherwise * @return true if the block can be made into Mycelium, false otherwise
*/ */
public static boolean canMakeShroomy(BlockState blockState) { public static boolean canMakeShroomy(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {

View File

@ -1,12 +1,14 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.CoalType;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.FurnaceRecipe; import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe; import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.Coal;
import org.bukkit.material.Dye; import org.bukkit.material.Dye;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@ -586,6 +588,8 @@ public final class ItemUtils {
case PUMPKIN_SEEDS: case PUMPKIN_SEEDS:
case WATER_LILY: case WATER_LILY:
case VINE: case VINE:
case LONG_GRASS:
case DOUBLE_PLANT:
return true; return true;
case INK_SACK: case INK_SACK:
@ -614,7 +618,6 @@ public final class ItemUtils {
case PORK: case PORK:
case GRILLED_PORK: case GRILLED_PORK:
case WOOL: case WOOL:
case RED_ROSE: // Not sure we should include this, as it will also trigger from herbalism
case IRON_INGOT: case IRON_INGOT:
case SNOW_BALL: case SNOW_BALL:
case BLAZE_ROD: case BLAZE_ROD:
@ -627,12 +630,17 @@ public final class ItemUtils {
case ARROW: case ARROW:
case SLIME_BALL: case SLIME_BALL:
case NETHER_STAR: case NETHER_STAR:
case COAL: // Not sure we should include this, as it will also trigger when mining
case ROTTEN_FLESH: case ROTTEN_FLESH:
case GOLD_NUGGET: case GOLD_NUGGET:
case EGG: case EGG:
return true; return true;
case COAL: // Not sure we should include this, as it will also trigger when mining
return (((Coal) item.getData()).getType() == CoalType.COAL);
case RED_ROSE: // Not sure we should include this, as it will also trigger from herbalism
return (item.getData().getData() == 0x0);
default: default:
return false; return false;
} }
@ -647,7 +655,9 @@ public final class ItemUtils {
public static boolean isWoodcuttingDrop(ItemStack item) { public static boolean isWoodcuttingDrop(ItemStack item) {
switch (item.getType()) { switch (item.getType()) {
case LOG: case LOG:
case LOG_2:
case LEAVES: case LEAVES:
case LEAVES_2:
case SAPLING: case SAPLING:
case APPLE: case APPLE:
return true; return true;

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
@ -30,6 +31,10 @@ public class StringUtils {
return createPrettyEnumString(ability.toString()); return createPrettyEnumString(ability.toString());
} }
public static String getPrettyTreeSpeciesString(TreeSpecies species) {
return createPrettyEnumString(species.toString());
}
public static String getPrettySecondaryAbilityString(SecondaryAbility secondaryAbility) { public static String getPrettySecondaryAbilityString(SecondaryAbility secondaryAbility) {
switch (secondaryAbility) { switch (secondaryAbility) {
case HERBALISM_DOUBLE_DROPS: case HERBALISM_DOUBLE_DROPS:

View File

@ -82,7 +82,10 @@ Experience:
Alchemy: Alchemy:
Potion: 120 Potion: 120
Fishing: Fishing:
Base: 800 Raw_Fish: 800
Raw_Salmon: 800
Clownfish: 800
Pufferfish: 800
Shake: 50 Shake: 50
Excavation: Excavation:
Clay: 40 Clay: 40
@ -95,27 +98,46 @@ Experience:
Snow_Block: 40 Snow_Block: 40
Soul_Sand: 40 Soul_Sand: 40
Woodcutting: Woodcutting:
Oak: 70 Acacia: 90
Spruce: 80
Birch: 90 Birch: 90
Dark_Oak: 90
Generic: 70
Jungle: 100 Jungle: 100
Redwood: 80
Huge_Mushroom_Red: 70 Huge_Mushroom_Red: 70
Huge_Mushroom_Brown: 70 Huge_Mushroom_Brown: 70
Herbalism: Herbalism:
Allium: 300
Azure_Bluet: 150
Blue_Orchid: 150
Brown_Mushroom: 150 Brown_Mushroom: 150
Cactus: 30 Cactus: 30
Carrot: 50 Carrot: 50
Cocoa: 30 Cocoa: 30
Crops: 50 Crops: 50
Dead_Bush: 100
Lilac: 50
Melon_Block: 20 Melon_Block: 20
Nether_Warts: 50 Nether_Warts: 50
Orange_Tulip: 150
Oxeye_Daisy: 150
Peony: 50
Pink_Tulip: 150
Poppy: 100
Potato: 50 Potato: 50
Pumpkin: 20 Pumpkin: 20
Red_Mushroom: 150 Red_Mushroom: 150
Red_Rose: 100 Red_Tulip: 150
Rose_Bush: 50
Small_Fern: 100
Small_Grass: 100
Sugar_Cane_Block: 30 Sugar_Cane_Block: 30
Sunflower: 50
Tall_Grass: 50
Tall_Fern: 50
Vine: 10 Vine: 10
Water_Lily: 100 Water_Lily: 100
White_Tulip: 150
Yellow_Flower: 100 Yellow_Flower: 100
Mining: Mining:
Coal_Ore: 100 Coal_Ore: 100
@ -124,14 +146,17 @@ Experience:
Ender_Stone: 150 Ender_Stone: 150
Glowstone: 30 Glowstone: 30
Gold_Ore: 350 Gold_Ore: 350
Hard_Clay: 30
Iron_Ore: 250 Iron_Ore: 250
Lapis_Ore: 400 Lapis_Ore: 400
Mossy_Cobblestone: 30 Mossy_Cobblestone: 30
Netherrack: 30 Netherrack: 30
Obsidian: 150 Obsidian: 150
Packed_Ice: 50
Quartz_Ore: 100 Quartz_Ore: 100
Redstone_Ore: 150 Redstone_Ore: 150
Sandstone: 30 Sandstone: 30
Stained_Clay: 50
Stone: 30 Stone: 30
Repair: Repair:
Base: 1000.0 Base: 1000.0