|
@@ -11,6 +11,7 @@ import com.gmail.nossr50.mcMMO;
|
|
import com.gmail.nossr50.config.Config;
|
|
import com.gmail.nossr50.config.Config;
|
|
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
|
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
|
import com.gmail.nossr50.skills.SkillManager;
|
|
import com.gmail.nossr50.skills.SkillManager;
|
|
|
|
+import com.gmail.nossr50.skills.utilities.SkillTools;
|
|
import com.gmail.nossr50.skills.utilities.SkillType;
|
|
import com.gmail.nossr50.skills.utilities.SkillType;
|
|
import com.gmail.nossr50.util.Misc;
|
|
import com.gmail.nossr50.util.Misc;
|
|
import com.gmail.nossr50.util.Permissions;
|
|
import com.gmail.nossr50.util.Permissions;
|
|
@@ -25,25 +26,18 @@ public class TamingManager extends SkillManager {
|
|
*
|
|
*
|
|
* @param event The event to award XP for
|
|
* @param event The event to award XP for
|
|
*/
|
|
*/
|
|
- public void awardTamingXP(EntityTameEvent event) {
|
|
|
|
- if (event.getEntity() == null) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- else if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- switch (event.getEntityType()) {
|
|
|
|
|
|
+ public void awardTamingXP(LivingEntity entity) {
|
|
|
|
+ switch (entity.getType()) {
|
|
case WOLF:
|
|
case WOLF:
|
|
- mcMMOPlayer.beginXpGain(SkillType.TAMING, Taming.wolfXp);
|
|
|
|
- break;
|
|
|
|
|
|
+ applyXpGain(Taming.wolfXp);
|
|
|
|
+ return;
|
|
|
|
|
|
case OCELOT:
|
|
case OCELOT:
|
|
- mcMMOPlayer.beginXpGain(SkillType.TAMING, Taming.ocelotXp);
|
|
|
|
- break;
|
|
|
|
|
|
+ applyXpGain(Taming.ocelotXp);
|
|
|
|
+ return;
|
|
|
|
|
|
default:
|
|
default:
|
|
- break;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -54,10 +48,15 @@ public class TamingManager extends SkillManager {
|
|
* @param damage The damage being absorbed by the wolf
|
|
* @param damage The damage being absorbed by the wolf
|
|
*/
|
|
*/
|
|
public void fastFoodService(Wolf wolf, int damage) {
|
|
public void fastFoodService(Wolf wolf, int damage) {
|
|
- if (Misc.getRandom().nextInt(activationChance) < Taming.fastFoodServiceActivationChance) {
|
|
|
|
- FastFoodServiceEventHandler eventHandler = new FastFoodServiceEventHandler(wolf);
|
|
|
|
|
|
+ if (SkillTools.activationSuccessful(getPlayer(), skill, Taming.fastFoodServiceActivationChance)) {
|
|
|
|
+
|
|
|
|
+ int health = wolf.getHealth();
|
|
|
|
+ int maxHealth = wolf.getMaxHealth();
|
|
|
|
|
|
- eventHandler.modifyHealth(damage);
|
|
|
|
|
|
+ if (health < maxHealth) {
|
|
|
|
+ int newHealth = health + damage;
|
|
|
|
+ wolf.setHealth(Math.min(newHealth, maxHealth));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|