mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +01:00
Small TamingManager changes. Halting the rest of the major changes for
now to prepare for 1.4.00 release.
This commit is contained in:
parent
fbd016f86d
commit
bbbba12e95
@ -439,7 +439,11 @@ public class EntityListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillManagerStore.getInstance().getTamingManager(player.getName()).awardTamingXP(event);
|
LivingEntity entity = event.getEntity();
|
||||||
|
|
||||||
|
if (entity != null && !entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||||
|
SkillManagerStore.getInstance().getTamingManager(player.getName()).awardTamingXP(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
@ -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) {
|
public void awardTamingXP(LivingEntity entity) {
|
||||||
if (event.getEntity() == null) {
|
switch (entity.getType()) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (event.getEntityType()) {
|
|
||||||
case WOLF:
|
case WOLF:
|
||||||
mcMMOPlayer.beginXpGain(SkillType.TAMING, Taming.wolfXp);
|
applyXpGain(Taming.wolfXp);
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case OCELOT:
|
case OCELOT:
|
||||||
mcMMOPlayer.beginXpGain(SkillType.TAMING, Taming.ocelotXp);
|
applyXpGain(Taming.ocelotXp);
|
||||||
break;
|
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) {
|
if (SkillTools.activationSuccessful(getPlayer(), skill, Taming.fastFoodServiceActivationChance)) {
|
||||||
FastFoodServiceEventHandler eventHandler = new FastFoodServiceEventHandler(wolf);
|
|
||||||
|
|
||||||
eventHandler.modifyHealth(damage);
|
int health = wolf.getHealth();
|
||||||
|
int maxHealth = wolf.getMaxHealth();
|
||||||
|
|
||||||
|
if (health < maxHealth) {
|
||||||
|
int newHealth = health + damage;
|
||||||
|
wolf.setHealth(Math.min(newHealth, maxHealth));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user