mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
Fix slime spawner exploit
This commit is contained in:
parent
8c2848a3e7
commit
68388c0288
@ -45,6 +45,8 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static com.gmail.nossr50.util.MobMetadataUtils.*;
|
import static com.gmail.nossr50.util.MobMetadataUtils.*;
|
||||||
|
|
||||||
public class EntityListener implements Listener {
|
public class EntityListener implements Listener {
|
||||||
@ -72,6 +74,11 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear the original slime/magma cubes metadata - it's dead.
|
||||||
|
if (Arrays.asList(EntityType.SLIME, EntityType.MAGMA_CUBE).contains(livingEntity.getType())) {
|
||||||
|
mcMMO.getTransientMetadataTools().cleanLivingEntityMetadata(livingEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,7 +659,14 @@ public class EntityListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onEntityDeathLowest(EntityDeathEvent event) {
|
public void onEntityDeathLowest(EntityDeathEvent event) {
|
||||||
mcMMO.getTransientMetadataTools().cleanLivingEntityMetadata(event.getEntity());
|
LivingEntity entity = event.getEntity();
|
||||||
|
|
||||||
|
// Clear metadata for Slimes/Magma Cubes after transformation events take place, otherwise small spawned slimes will not have any tags
|
||||||
|
if (Arrays.asList(EntityType.SLIME, EntityType.MAGMA_CUBE).contains(entity.getType())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mcMMO.getTransientMetadataTools().cleanLivingEntityMetadata(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user