mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Some cleanups to mob related XP code
This commit is contained in:
parent
c9c2c483fa
commit
a43ae4178a
2
pom.xml
2
pom.xml
@ -135,7 +135,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.11-R0.1-SNAPSHOT</version>
|
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -128,11 +128,11 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Taming */
|
/* Taming */
|
||||||
if (getTamingXPWolf() <= 0) {
|
if (getTamingXP(EntityType.WOLF) <= 0) {
|
||||||
reason.add("Experience.Taming.Animal_Taming.Wolf should be greater than 0!");
|
reason.add("Experience.Taming.Animal_Taming.Wolf should be greater than 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getTamingXPOcelot() <= 0) {
|
if (getTamingXP(EntityType.OCELOT) <= 0) {
|
||||||
reason.add("Experience.Taming.Animal_Taming.Ocelot should be greater than 0!");
|
reason.add("Experience.Taming.Animal_Taming.Ocelot should be greater than 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,9 +370,10 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
||||||
|
|
||||||
/* Taming */
|
/* Taming */
|
||||||
public int getTamingXPHorse() { return config.getInt("Experience.Taming.Animal_Taming.Horse", 1000); }
|
public int getTamingXP(EntityType type)
|
||||||
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
|
{
|
||||||
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
|
return config.getInt("Experience.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
|
||||||
|
}
|
||||||
|
|
||||||
/* Woodcutting */
|
/* Woodcutting */
|
||||||
public int getWoodcuttingTreeXP(TreeSpecies species) { return config.getInt("Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); }
|
public int getWoodcuttingTreeXP(TreeSpecies species) { return config.getInt("Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); }
|
||||||
|
@ -30,10 +30,6 @@ public class Taming {
|
|||||||
public static int thickFurUnlockLevel = AdvancedConfig.getInstance().getThickFurUnlock();
|
public static int thickFurUnlockLevel = AdvancedConfig.getInstance().getThickFurUnlock();
|
||||||
public static double thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
|
public static double thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
|
||||||
|
|
||||||
public static int wolfXp = ExperienceConfig.getInstance().getTamingXPWolf();
|
|
||||||
public static int ocelotXp = ExperienceConfig.getInstance().getTamingXPOcelot();
|
|
||||||
public static int horseXp = ExperienceConfig.getInstance().getTamingXPHorse();
|
|
||||||
|
|
||||||
public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
|
public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
|
||||||
return pet.isTamed() && owner instanceof Player && pet instanceof Wolf;
|
return pet.isTamed() && owner instanceof Player && pet instanceof Wolf;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
@ -81,22 +82,7 @@ public class TamingManager extends SkillManager {
|
|||||||
* @param entity The LivingEntity to award XP for
|
* @param entity The LivingEntity to award XP for
|
||||||
*/
|
*/
|
||||||
public void awardTamingXP(LivingEntity entity) {
|
public void awardTamingXP(LivingEntity entity) {
|
||||||
switch (entity.getType()) {
|
applyXpGain(ExperienceConfig.getInstance().getTamingXP(entity.getType()), XPGainReason.PVE);
|
||||||
case HORSE:
|
|
||||||
applyXpGain(Taming.horseXp, XPGainReason.PVE);
|
|
||||||
return;
|
|
||||||
|
|
||||||
case WOLF:
|
|
||||||
applyXpGain(Taming.wolfXp, XPGainReason.PVE);
|
|
||||||
return;
|
|
||||||
|
|
||||||
case OCELOT:
|
|
||||||
applyXpGain(Taming.ocelotXp, XPGainReason.PVE);
|
|
||||||
return;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -477,56 +477,22 @@ public final class CombatUtils {
|
|||||||
else if (target instanceof Monster)
|
else if (target instanceof Monster)
|
||||||
{
|
{
|
||||||
EntityType type = target.getType();
|
EntityType type = target.getType();
|
||||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
|
||||||
|
if (type == EntityType.IRON_GOLEM)
|
||||||
|
{
|
||||||
|
if (!((IronGolem) target).isPlayerCreated()) {
|
||||||
|
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EntityType type = target.getType();
|
baseXP = 1.0;
|
||||||
|
mcMMO.getModManager().addCustomEntity(target);
|
||||||
switch (type) {
|
|
||||||
case BAT:
|
|
||||||
case SQUID:
|
|
||||||
case RABBIT:
|
|
||||||
baseXP = ExperienceConfig.getInstance().getAnimalsXP(type);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BLAZE:
|
|
||||||
case CAVE_SPIDER:
|
|
||||||
case CREEPER:
|
|
||||||
case ENDER_DRAGON:
|
|
||||||
case ENDERMAN:
|
|
||||||
case ENDERMITE:
|
|
||||||
case GHAST:
|
|
||||||
case GIANT:
|
|
||||||
case MAGMA_CUBE:
|
|
||||||
case PIG_ZOMBIE:
|
|
||||||
case SHULKER:
|
|
||||||
case SILVERFISH:
|
|
||||||
case SLIME:
|
|
||||||
case SPIDER:
|
|
||||||
case WITCH:
|
|
||||||
case WITHER:
|
|
||||||
case ZOMBIE_VILLAGER:
|
|
||||||
case ZOMBIE:
|
|
||||||
case GUARDIAN:
|
|
||||||
case ELDER_GUARDIAN:
|
|
||||||
case HUSK:
|
|
||||||
case STRAY:
|
|
||||||
case WITHER_SKELETON:
|
|
||||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IRON_GOLEM:
|
|
||||||
if (!((IronGolem) target).isPlayerCreated()) {
|
|
||||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
baseXP = 1.0;
|
|
||||||
mcMMO.getModManager().addCustomEntity(target);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.hasMetadata(mcMMO.entityMetadataKey)) {
|
if (target.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user