From 34447ef8748755680a99e53c9390cf2f73a27104 Mon Sep 17 00:00:00 2001 From: isokissa3 Date: Mon, 25 Apr 2016 18:47:15 +0300 Subject: [PATCH 1/3] Exploit fix, turning spawned pigs into zombie pigmans using lightning stike allows you gain XP --- .../com/gmail/nossr50/listeners/EntityListener.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index be758edce..4d31f9bba 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -31,6 +31,7 @@ import org.bukkit.event.entity.EntityTameEvent; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.entity.PigZapEvent; import org.bukkit.event.entity.PotionSplashEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; 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); + } + } } From 6b031080521fc2b8c381eedd7532f36b57272676 Mon Sep 17 00:00:00 2001 From: isokissa3 Date: Tue, 26 Apr 2016 15:26:50 +0300 Subject: [PATCH 2/3] Fixed formatting --- .../java/com/gmail/nossr50/listeners/EntityListener.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 4d31f9bba..d16b48b90 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -705,10 +705,8 @@ public class EntityListener implements Listener { } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPigZapEvent(PigZapEvent event) - { - if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) - { + public void onPigZapEvent(PigZapEvent event) { + if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) { event.getPigZombie().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); } } From d0e8bb3174e54ec77e8a82c8f88da2710b5a11f8 Mon Sep 17 00:00:00 2001 From: isokissa3 Date: Wed, 27 Apr 2016 13:45:26 +0300 Subject: [PATCH 3/3] Fixed spacing --- .../java/com/gmail/nossr50/listeners/EntityListener.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index d16b48b90..c626c8f7c 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -706,8 +706,8 @@ 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); - } + if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) { + event.getPigZombie().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); + } } }