mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 08:09:39 +01:00
Fixed issues with dealing damage to Entities
This commit is contained in:
parent
71ab678945
commit
89ddf8c4fa
@ -134,6 +134,11 @@ public class EntityListener implements Listener {
|
||||
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
if (defender.hasMetadata(mcMMO.customDamageKey)) {
|
||||
defender.removeMetadata(mcMMO.customDamageKey, plugin);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Misc.isNPCEntity(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) {
|
||||
return;
|
||||
}
|
||||
@ -344,12 +349,12 @@ public class EntityListener implements Listener {
|
||||
|
||||
if (entity.hasMetadata(mcMMO.customNameKey)) {
|
||||
entity.setCustomName(entity.getMetadata(mcMMO.customNameKey).get(0).asString());
|
||||
entity.removeMetadata(mcMMO.customNameKey, mcMMO.p);
|
||||
entity.removeMetadata(mcMMO.customNameKey, plugin);
|
||||
}
|
||||
|
||||
if (entity.hasMetadata(mcMMO.customVisibleKey)) {
|
||||
entity.setCustomNameVisible(entity.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean());
|
||||
entity.removeMetadata(mcMMO.customVisibleKey, mcMMO.p);
|
||||
entity.removeMetadata(mcMMO.customVisibleKey, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,7 @@ public class mcMMO extends JavaPlugin {
|
||||
public final static String infiniteArrowKey = "mcMMO: Infinite Arrow";
|
||||
public final static String bowForceKey = "mcMMO: Bow Force";
|
||||
public final static String arrowDistanceKey = "mcMMO: Arrow Distance";
|
||||
public final static String customDamageKey = "mcMMO: Custom Damage";
|
||||
|
||||
public static FixedMetadataValue metadataValue;
|
||||
|
||||
|
@ -389,7 +389,14 @@ public final class CombatUtils {
|
||||
startGainXp(mcMMOPlayer, target, skill);
|
||||
}
|
||||
|
||||
target.damage(damage);
|
||||
int damageTicks = target.getNoDamageTicks();
|
||||
double lastDamage = target.getLastDamage();
|
||||
|
||||
target.setMetadata(mcMMO.customDamageKey, mcMMO.metadataValue);
|
||||
target.damage(damage, attacker);
|
||||
|
||||
target.setNoDamageTicks(damageTicks);
|
||||
target.setLastDamage(lastDamage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user