This commit is contained in:
nossr50 2024-02-14 13:11:32 -08:00
parent 5bfca3c218
commit 85f27fdbdb
5 changed files with 79 additions and 28 deletions

View File

@ -1,7 +1,11 @@
Version 2.1.228 Version 2.1.228
Fixed stack trace due to Spigot API break on EntityDamageEvent and EntityDamageByEntity event Fixed a stack trace due to Spigot API break on EntityDamageEvent and EntityDamageByEntity event
(API) - Removed FakeEntityDamageEvent and FakeEntityDamageByEntityEvent, you can use our metadata constant to check if damage is from mcMMO instead (API) - Removed FakeEntityDamageEvent and FakeEntityDamageByEntityEvent
(API) - Temporarily removed McMMOEntityDamageByRuptureEvent, this needs to be reworked for the new spigot API changes (API) - Reworked McMMOEntityDamageByRuptureEvent, this no longer extends EntityDamageByEntityEvent, instead it extends EntityEvent
Notes:
Some care went into keeping mcMMO compatible with older versions despite a big API break from Spigot, this may introduce some new bugs, so please report them if you run into any.
Version 2.1.227 Version 2.1.227
Fixed bug where some text would not be displayed to players (Adventure dependency update) Fixed bug where some text would not be displayed to players (Adventure dependency update)
Repair sound effect from mcMMO can now be adjusted in Minecraft sound options (Thanks MithicSpirit) Repair sound effect from mcMMO can now be adjusted in Minecraft sound options (Thanks MithicSpirit)

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>2.1.228-SNAPSHOT</version> <version>2.1.228</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm> <scm>

View File

@ -1,19 +1,57 @@
//package com.gmail.nossr50.events.skills.rupture; package com.gmail.nossr50.events.skills.rupture;
//
//import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
//import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
//import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.Cancellable;
//import org.jetbrains.annotations.NotNull; import org.bukkit.event.HandlerList;
// import org.bukkit.event.entity.EntityEvent;
//public class McMMOEntityDamageByRuptureEvent extends EntityDamageByEntityEvent { import org.jetbrains.annotations.NotNull;
// private final McMMOPlayer mcMMODamager;
// public class McMMOEntityDamageByRuptureEvent extends EntityEvent implements Cancellable {
// public McMMOEntityDamageByRuptureEvent(@NotNull McMMOPlayer damager, @NotNull Entity damagee, double damage) { private final McMMOPlayer damager;
// this.mcMMODamager = damager; private final Entity damagee;
// } private double damage;
// private boolean isCancelled = false;
// @NotNull private static final HandlerList handlers = new HandlerList();
// public McMMOPlayer getMcMMODamager() {
// return mcMMODamager; public McMMOEntityDamageByRuptureEvent(@NotNull McMMOPlayer damager, @NotNull Entity damagee, double damage) {
// } super(damagee);
//} this.damager = damager;
this.damagee = damagee;
this.damage = damage;
}
@NotNull
@Deprecated
public McMMOPlayer getMcMMODamager() {
return damager;
}
public McMMOPlayer getDamager() {
return damager;
}
public double getDamage() {
return damage;
}
public void setDamage(double damage) {
this.damage = Math.max(0, damage);
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancel) {
isCancelled = cancel;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,9 +1,12 @@
package com.gmail.nossr50.runnables.skills; package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.MobHealthbarUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -82,15 +85,21 @@ public class RuptureTask extends CancellableRunnable {
//Ensure victim has health //Ensure victim has health
if (healthBeforeRuptureIsApplied > 0.01) { if (healthBeforeRuptureIsApplied > 0.01) {
// TODO: Needs updating for new spigot API //Send a fake damage event
double damage = calculateAdjustedTickDamage(); //Use raw damage for Rupture McMMOEntityDamageByRuptureEvent event =
new McMMOEntityDamageByRuptureEvent(ruptureSource, targetEntity, calculateAdjustedTickDamage());
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (damage <= 0 || healthBeforeRuptureIsApplied - damage <= 0) { //Ensure the event wasn't cancelled and damage is still greater than 0
double damage = event.getDamage(); //Use raw damage for Rupture
if (event.isCancelled() || damage <= 0 || healthBeforeRuptureIsApplied - damage <= 0)
return true; return true;
}
double damagedHealth = healthBeforeRuptureIsApplied - damage; double damagedHealth = healthBeforeRuptureIsApplied - damage;
targetEntity.setHealth(damagedHealth); //Hurt entity without the unwanted side effects of damage()} targetEntity.setHealth(damagedHealth); //Hurt entity without the unwanted side effects of damage()}
MobHealthbarUtils.handleMobHealthbars(targetEntity, damage, mcMMO.p);
} }
return false; return false;

View File

@ -39,7 +39,7 @@ public final class MobHealthbarUtils {
return; return;
} }
if (isBoss(target)) { if (isBoss(target) || target instanceof Player) {
return; return;
} }