mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-02 16:59:56 +01:00
Allow disableautoheal
This commit is contained in:
parent
1024506f8c
commit
72fc006795
@ -14,6 +14,8 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
|||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.EntityListener;
|
import org.bukkit.event.entity.EntityListener;
|
||||||
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
|
|
||||||
//import org.bukkit.event.entity.ExplosionPrimedEvent;
|
//import org.bukkit.event.entity.ExplosionPrimedEvent;
|
||||||
|
|
||||||
@ -40,6 +42,18 @@ public class MVEntityListener extends EntityListener {
|
|||||||
}
|
}
|
||||||
super.onEntityDeath(event);
|
super.onEntityDeath(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
||||||
|
if(event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RegainReason reason = event.getRegainReason();
|
||||||
|
if(reason == RegainReason.REGEN && this.plugin.configMV.getBoolean("disableautoheal", false)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle Animal/Monster Spawn settings, seems like a more concrete method than using CraftBukkit.
|
* Handle Animal/Monster Spawn settings, seems like a more concrete method than using CraftBukkit.
|
||||||
|
@ -124,7 +124,8 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
pm.registerEvent(Event.Type.PLAYER_KICK, this.playerListener, Priority.Highest, this);
|
pm.registerEvent(Event.Type.PLAYER_KICK, this.playerListener, Priority.Highest, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_RESPAWN, this.playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_RESPAWN, this.playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Priority.Normal, this);
|
||||||
|
|
||||||
|
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, this.entityListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, this.entityListener, Priority.Normal, this); // To Allow/Disallow PVP as well as EnableHealth.
|
pm.registerEvent(Event.Type.ENTITY_DAMAGE, this.entityListener, Priority.Normal, this); // To Allow/Disallow PVP as well as EnableHealth.
|
||||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, this.entityListener, Priority.Normal, this); // To prevent all or certain animals/monsters from spawning.
|
pm.registerEvent(Event.Type.CREATURE_SPAWN, this.entityListener, Priority.Normal, this); // To prevent all or certain animals/monsters from spawning.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user