mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
A huge flaw on my side
This commit is contained in:
parent
152b512ea3
commit
38774b583f
@ -395,13 +395,17 @@ public class Combat
|
|||||||
* @param attacker Entity to pass to event as damager
|
* @param attacker Entity to pass to event as damager
|
||||||
*/
|
*/
|
||||||
public static void dealDamage(LivingEntity target, int dmg, DamageCause cause, Entity attacker) {
|
public static void dealDamage(LivingEntity target, int dmg, DamageCause cause, Entity attacker) {
|
||||||
EntityDamageEvent ede = new EntityDamageByEntityEvent(attacker, target, cause, dmg);
|
EntityDamageEvent event;
|
||||||
Bukkit.getPluginManager().callEvent(ede);
|
if (attacker == null) {
|
||||||
target.damage(ede.getDamage());
|
event = new EntityDamageEvent(target, cause, dmg);
|
||||||
|
} else {
|
||||||
|
event = new EntityDamageByEntityEvent(attacker, target, cause, dmg);
|
||||||
|
}
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
target.damage(event.getDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean pvpAllowed(EntityDamageByEntityEvent event, World world)
|
public static boolean pvpAllowed(EntityDamageByEntityEvent event, World world) {
|
||||||
{
|
|
||||||
if(!((world == null)?event.getEntity().getWorld():world).getPVP()) { return false; }
|
if(!((world == null)?event.getEntity().getWorld():world).getPVP()) { return false; }
|
||||||
//If it made it this far, pvp is enabled
|
//If it made it this far, pvp is enabled
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user