Skip to content
Permalink
Browse files

Add debug, fix a hole in old logic

  • Loading branch information...
mcmonkey4eva committed Aug 27, 2017
1 parent 2f15b1c commit 003be537ec1d1855180ec59500f61ff0421bfe0a
Showing with 22 additions and 0 deletions.
  1. +22 −0 src/main/java/org/mcmonkey/sentinel/SentinelTrait.java
@@ -265,6 +265,15 @@ public void whenAttacksAreHappening(EntityDamageByEntityEvent event) {
if (SentinelPlugin.instance.getConfig().getBoolean("random.enforce damage", false)) {
if (canEnforce) {
((LivingEntity) event.getEntity()).damage(event.getFinalDamage());
canEnforce = false;
if (SentinelPlugin.debugMe) {
SentinelPlugin.instance.getLogger().info("Sentinel: enforce damage value to " + event.getFinalDamage());
}
}
else {
if (SentinelPlugin.debugMe) {
SentinelPlugin.instance.getLogger().info("Sentinel: refuse damage enforcement");
}
}
event.setCancelled(true);
return;
@@ -277,6 +286,15 @@ public void whenAttacksAreHappening(EntityDamageByEntityEvent event) {
if (SentinelPlugin.instance.getConfig().getBoolean("random.enforce damage", false)) {
if (canEnforce) {
((LivingEntity) event.getEntity()).damage(getDamage());
canEnforce = false;
if (SentinelPlugin.debugMe) {
SentinelPlugin.instance.getLogger().info("Sentinel: enforce damage value to " + getDamage());
}
}
else {
if (SentinelPlugin.debugMe) {
SentinelPlugin.instance.getLogger().info("Sentinel: refuse damage enforcement");
}
}
event.setCancelled(true);
return;
@@ -752,6 +770,10 @@ public void punch(LivingEntity entity) {
swingWeapon();
stats_punches++;
if (SentinelPlugin.instance.getConfig().getBoolean("random.workaround damage", false)) {
if (SentinelPlugin.debugMe) {
SentinelPlugin.instance.getLogger().info("Sentinel: workaround damage value at " + getDamage() + " yields "
+ ((getDamage() * (1.0 - getArmor(entity)))));
}
entity.damage(getDamage() * (1.0 - getArmor(entity)));
Vector relative = entity.getLocation().toVector().subtract(getLivingEntity().getLocation().toVector());
relative = relative.normalize();

0 comments on commit 003be53

Please sign in to comment.
You can’t perform that action at this time.