Skip to content

Commit

Permalink
Added code to check if the map contains the entity (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
lclc98 authored and GirafiStudios committed May 26, 2019
1 parent 1caf2fc commit e0b7f5e
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,10 @@ protected void onStun(EntityLivingBase target) {

@SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
if (stun.isEmpty()) return;
if (stun.isEmpty() || !stun.containsKey(event.getEntityLiving())) return;
ModifiableAttributeInstance attribute = (ModifiableAttributeInstance) event.getEntityLiving().getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
if (attribute.hasModifier(STUN)) {
EntityLivingBase entity = event.getEntityLiving();
if(!stun.containsKey(entity)){
attribute.removeModifier(STUN);
return;
}

int stunTime = stun.get(entity);
if (stunTime <= 1) {
stun.remove(entity);
Expand Down

0 comments on commit e0b7f5e

Please sign in to comment.