|
@@ -2,6 +2,7 @@ package com.gmail.nossr50.listeners;
|
|
|
|
|
|
import com.gmail.nossr50.config.AdvancedConfig;
|
|
import com.gmail.nossr50.config.AdvancedConfig;
|
|
import com.gmail.nossr50.config.Config;
|
|
import com.gmail.nossr50.config.Config;
|
|
|
|
+import com.gmail.nossr50.config.WorldBlacklist;
|
|
import com.gmail.nossr50.datatypes.meta.OldName;
|
|
import com.gmail.nossr50.datatypes.meta.OldName;
|
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|
@@ -53,6 +54,10 @@ public class EntityListener implements Listener {
|
|
|
|
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
public void onEntityShootBow(EntityShootBowEvent event) {
|
|
public void onEntityShootBow(EntityShootBowEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
Entity projectile = event.getProjectile();
|
|
Entity projectile = event.getProjectile();
|
|
|
|
|
|
if (!(projectile instanceof Arrow)) {
|
|
if (!(projectile instanceof Arrow)) {
|
|
@@ -71,6 +76,10 @@ public class EntityListener implements Listener {
|
|
|
|
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
|
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
Projectile projectile = event.getEntity();
|
|
Projectile projectile = event.getEntity();
|
|
|
|
|
|
if (!(projectile instanceof Arrow) || projectile.hasMetadata(mcMMO.bowForceKey)) {
|
|
if (!(projectile instanceof Arrow) || projectile.hasMetadata(mcMMO.bowForceKey)) {
|
|
@@ -89,6 +98,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
|
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
Block block = event.getBlock();
|
|
Block block = event.getBlock();
|
|
|
|
|
|
// When the event is fired for the falling block that changes back to a
|
|
// When the event is fired for the falling block that changes back to a
|
|
@@ -128,6 +141,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
|
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
if (event instanceof FakeEntityDamageByEntityEvent) {
|
|
if (event instanceof FakeEntityDamageByEntityEvent) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -263,6 +280,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
public void onEntityDamage(EntityDamageEvent event) {
|
|
public void onEntityDamage(EntityDamageEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Process Registered Interactions
|
|
* Process Registered Interactions
|
|
*/
|
|
*/
|
|
@@ -403,6 +424,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.LOWEST)
|
|
@EventHandler(priority = EventPriority.LOWEST)
|
|
public void onEntityDeathLowest(EntityDeathEvent event) {
|
|
public void onEntityDeathLowest(EntityDeathEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
LivingEntity entity = event.getEntity();
|
|
LivingEntity entity = event.getEntity();
|
|
|
|
|
|
if (Misc.isNPCEntity(entity)) {
|
|
if (Misc.isNPCEntity(entity)) {
|
|
@@ -432,6 +457,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.MONITOR)
|
|
@EventHandler(priority = EventPriority.MONITOR)
|
|
public void onEntityDeath(EntityDeathEvent event) {
|
|
public void onEntityDeath(EntityDeathEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
LivingEntity entity = event.getEntity();
|
|
LivingEntity entity = event.getEntity();
|
|
|
|
|
|
if (Misc.isNPCEntity(entity)) {
|
|
if (Misc.isNPCEntity(entity)) {
|
|
@@ -450,6 +479,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
|
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
LivingEntity entity = event.getEntity();
|
|
LivingEntity entity = event.getEntity();
|
|
|
|
|
|
switch (event.getSpawnReason()) {
|
|
switch (event.getSpawnReason()) {
|
|
@@ -482,6 +515,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
|
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
Entity entity = event.getEntity();
|
|
Entity entity = event.getEntity();
|
|
|
|
|
|
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
|
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
|
@@ -511,6 +548,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
public void onEnitityExplode(EntityExplodeEvent event) {
|
|
public void onEnitityExplode(EntityExplodeEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
Entity entity = event.getEntity();
|
|
Entity entity = event.getEntity();
|
|
|
|
|
|
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
|
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
|
@@ -541,6 +582,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
|
public void onEntityExplodeMonitor(EntityExplodeEvent event) {
|
|
public void onEntityExplodeMonitor(EntityExplodeEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
Entity entity = event.getEntity();
|
|
Entity entity = event.getEntity();
|
|
|
|
|
|
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntsafeMetadataKey)) {
|
|
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntsafeMetadataKey)) {
|
|
@@ -558,6 +603,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
Entity entity = event.getEntity();
|
|
Entity entity = event.getEntity();
|
|
|
|
|
|
if (!(entity instanceof Player)) {
|
|
if (!(entity instanceof Player)) {
|
|
@@ -651,6 +700,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
public void onEntityTame(EntityTameEvent event) {
|
|
public void onEntityTame(EntityTameEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
if (event instanceof FakeEntityTameEvent) {
|
|
if (event instanceof FakeEntityTameEvent) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -674,6 +727,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
public void onEntityTarget(EntityTargetEvent event) {
|
|
public void onEntityTarget(EntityTargetEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
Entity entity = event.getEntity();
|
|
Entity entity = event.getEntity();
|
|
Entity target = event.getTarget();
|
|
Entity target = event.getTarget();
|
|
|
|
|
|
@@ -705,6 +762,10 @@ public class EntityListener implements Listener {
|
|
*/
|
|
*/
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
public void onPotionSplash(PotionSplashEvent event) {
|
|
public void onPotionSplash(PotionSplashEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
for (PotionEffect effect : ((PotionMeta) event.getPotion().getItem().getItemMeta()).getCustomEffects()) {
|
|
for (PotionEffect effect : ((PotionMeta) event.getPotion().getItem().getItemMeta()).getCustomEffects()) {
|
|
if (!effect.getType().equals(PotionEffectType.SATURATION)) {
|
|
if (!effect.getType().equals(PotionEffectType.SATURATION)) {
|
|
return;
|
|
return;
|
|
@@ -719,6 +780,10 @@ public class EntityListener implements Listener {
|
|
|
|
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
public void onPigZapEvent(PigZapEvent event) {
|
|
public void onPigZapEvent(PigZapEvent event) {
|
|
|
|
+ /* WORLD BLACKLIST CHECK */
|
|
|
|
+ if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
|
|
|
+ return;
|
|
|
|
+
|
|
if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) {
|
|
if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) {
|
|
event.getPigZombie().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
|
event.getPigZombie().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
|
}
|
|
}
|