Exploit fix, turning spawned pigs into zombie pigmans using lightning stike allows you gain XP

This commit is contained in:
isokissa3 2016-04-25 18:47:15 +03:00
parent dcd79e87e1
commit 34447ef874

View File

@ -31,6 +31,7 @@ import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.PigZapEvent;
import org.bukkit.event.entity.PotionSplashEvent; import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -702,4 +703,13 @@ public class EntityListener implements Listener {
} }
} }
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPigZapEvent(PigZapEvent event)
{
if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey))
{
event.getPigZombie().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
}
}
} }