Refactor EntityDamageEvents. Adds BUKKIT-1944 & BUKKIT-3684

This commit is contained in:
feildmaster
2013-04-09 22:25:06 -05:00
parent 535a85a5b0
commit 77d1524b3d
8 changed files with 116 additions and 155 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);
}
}