Refactor EntityDamageEvents. Adds BUKKIT-1944 & BUKKIT-3684

By: feildmaster <admin@feildmaster.com>
This commit is contained in:
CraftBukkit/Spigot
2013-04-09 22:25:06 -05:00
parent 76976e4797
commit 868456b95f
2 changed files with 84 additions and 11 deletions

View File

@@ -0,0 +1,31 @@
package org.bukkit.craftbukkit.util;
import net.minecraft.server.DamageSource;
// Util class to create custom DamageSources.
public final class CraftDamageSource extends DamageSource {
public static DamageSource copyOf(final DamageSource original) {
CraftDamageSource newSource = new CraftDamageSource(original.translationIndex);
// Check ignoresArmor
if (original.ignoresArmor()) {
newSource.j();
}
// Check magic
if (original.q()) {
newSource.r();
}
// Check fire
if (original.c()) {
newSource.l();
}
return newSource;
}
private CraftDamageSource(String identifier) {
super(identifier);
}
}