1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-21 19:22:59 +01:00

Modified mcMMO's onEntityDamage to have better compatibility.

This commit is contained in:
nossr50
2012-02-13 08:06:46 -08:00
parent 1910b76b13
commit 786a5f9325
3 changed files with 22 additions and 2 deletions

View File

@@ -26,8 +26,10 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.*;
import com.gmail.nossr50.datatypes.FakeEntityDamageEvent;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
import com.gmail.nossr50.datatypes.SkillType;
@@ -144,6 +146,19 @@ public class m
return false; //Return false if something went wrong
}
}
public static boolean EntityDamageEventSimulate(Entity damagee, DamageCause cause, int damage)
{
FakeEntityDamageEvent event = new FakeEntityDamageEvent(damagee, cause, damage);
Bukkit.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled())
{
return true; //Return true if not cancelled
} else {
return false; //Return false if cancelled
}
}
public static void damageTool(Player player, short damage)
{