Closed GGMarket closed 1 year ago
Kernius Please change this:
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent e) {
// 1.8 NMS: Damage = 25 / (damage after blocking * (25 - total armour strength))
if (!(e.getEntity() instanceof LivingEntity)) return;
final LivingEntity damagedEntity = (LivingEntity) e.getEntity();
final Map<EntityDamageEvent.DamageModifier, Double> damageModifiers =
Arrays.stream(EntityDamageEvent.DamageModifier.values())
.filter(e::isApplicable)
.collect(Collectors.toMap(m -> m, e::getDamage));
DefenceUtils.calculateDefenceDamageReduction(damagedEntity, damageModifiers, e.getCause());
// Set the modifiers back to the event
damageModifiers.forEach(e::setDamage);
//damageModifiers.forEach((dm, value) -> debug(dm.name() + ": " + value));
}
if (!(e.getEntity() instanceof Player)) return;
Please
@GGMarket surely absorption can also be had by entities other than players? There should be another way of checking that, i.e. the Damageable interface or whether that specific damage type is applicable.
i don't think absorption can be add to another entities, but if you can do this that i said and update to jenkins please?
my idea not work same error
[15:56:44 ERROR]: Could not pass event FakeEntityDamageEvent to OldCombatMechanics v2.0.0BETA
java.lang.UnsupportedOperationException: ABSORPTION is not applicable to CraftPlayer{name=GT500}
at org.bukkit.event.entity.EntityDamageEvent.setDamage(EntityDamageEvent.java:89) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at java.util.HashMap.forEach(HashMap.java:1421) ~[?:?]
at kernitus.plugin.OldCombatMechanics.module.ModuleOldArmourStrength.onEntityDamage(ModuleOldArmourStrength.java:50) ~[OldCombatMechanics NONO.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor532.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:git-Purpur-1845]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:678) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at com.gmail.nossr50.util.skills.CombatUtils.callFakeDamageEvent(CombatUtils.java:600) ~[mcmmo CLASSIC.jar:?]
at com.gmail.nossr50.util.skills.CombatUtils.dealDamage(CombatUtils.java:374) ~[mcmmo CLASSIC.jar:?]
at com.gmail.nossr50.util.skills.CombatUtils.dealDamage(CombatUtils.java:330) ~[mcmmo CLASSIC.jar:?]
at com.gmail.nossr50.runnables.skills.BleedTimerTask.run(BleedTimerTask.java:43) ~[mcmmo CLASSIC.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.19.2.jar:git-Purpur-1845]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[purpur-1.19.2.jar:git-Purpur-1845]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1500) ~[purpur-1.19.2.jar:git-Purpur-1845]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:486) ~[purpur-1.19.2.jar:git-Purpur-1845]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1424) ~[purpur-1.19.2.jar:git-Purpur-1845]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1194) ~[purpur-1.19.2.jar:git-Purpur-1845]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:310) ~[purpur-1.19.2.jar:git-Purpur-1845]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Please fix this
its the only version that work with 1.19.2 without strenght armor bug
I understand the error
[13:18:42 ERROR]: Could not pass event FakeEntityDamageEvent to OldCombatMechanics v2.0.0BETA
java.lang.UnsupportedOperationException: ABSORPTION is not applicable to CraftWarden
at org.bukkit.event.entity.EntityDamageEvent.setDamage(EntityDamageEvent.java:89) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at java.util.HashMap.forEach(HashMap.java:1421) ~[?:?]
at kernitus.plugin.OldCombatMechanics.module.ModuleOldArmourStrength.onEntityDamage(ModuleOldArmourStrength.java:49) ~[OldCombatMechanics BUGADASSO.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor171.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:git-Paper-397]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:672) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at com.gmail.nossr50.util.skills.CombatUtils.callFakeDamageEvent(CombatUtils.java:600) ~[mcmmo CLASSIC.jar:?]
at com.gmail.nossr50.util.skills.CombatUtils.dealDamage(CombatUtils.java:374) ~[mcmmo CLASSIC.jar:?]
at com.gmail.nossr50.util.skills.CombatUtils.dealDamage(CombatUtils.java:330) ~[mcmmo CLASSIC.jar:?]
at com.gmail.nossr50.runnables.skills.BleedTimerTask.run(BleedTimerTask.java:64) ~[mcmmo CLASSIC.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.3.jar:git-Paper-397]
at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.3.jar:git-Paper-397]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1473) ~[paper-1.19.3.jar:git-Paper-397]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.19.3.jar:git-Paper-397]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.3.jar:git-Paper-397]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.3.jar:git-Paper-397]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-397]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[13:18:42 INFO]: Damage: 2.0cause: CUSTOM
The plugin mcmmo add bleeding damage to the entity, and them the error appear I try to fix this way @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void Dmg (EntityDamageEvent e) { if(e.getCause() == DamageCause.CUSTOM) { e.setCancelled(true); } }
but does not work
looks like the issue is that we need to first check that the modifier is present before we attempt to set it:
let me see if I can whip up a quick fix for this
@GGMarket can you see if you still have the issue w this jar? (you'll have to extract it, as github doesn't allow sharing of .jar files directly)
if this fixes it, then I will see about getting #643 merged
@GGMarket please try the test build 135 or newer. The plugin now checks if Absorption is applicable before adding it to the entity.
Information
20:06:54 ERROR]: Could not pass event EntityDamageByEntityEvent to OldCombatMechanics v2.0.0BETA java.lang.UnsupportedOperationException: ABSORPTION is not applicable to CraftArmorStand at org.bukkit.event.entity.EntityDamageEvent.setDamage(EntityDamageEvent.java:89) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at java.util.HashMap.forEach(HashMap.java:1421) ~[?:?] at kernitus.plugin.OldCombatMechanics.module.ModuleOldArmourStrength.onEntityDamage(ModuleOldArmourStrength.java:49) ~[OldCombatMechanics01.jar:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor632.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:git-Purpur-1845] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:678) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.callEvent(CraftEventFactory.java:249) ~[purpur-1.19.2.jar:git-Purpur-1845] at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.callEntityDamageEvent(CraftEventFactory.java:1173) ~[purpur-1.19.2.jar:git-Purpur-1845] at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:1022) ~[purpur-1.19.2.jar:git-Purpur-1845] at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleNonLivingEntityDamageEvent(CraftEventFactory.java:1226) ~[purpur-1.19.2.jar:git-Purpur-1845] at net.minecraft.world.entity.decoration.ArmorStand.hurt(ArmorStand.java:497) ~[?:?] at net.minecraft.world.entity.player.Player.attack(Player.java:1372) ~[?:?] at net.minecraft.server.level.ServerPlayer.attack(ServerPlayer.java:2200) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl$6.a(ServerGamePacketListenerImpl.java:3081) ~[?:?] at net.minecraft.network.protocol.game.ServerboundInteractPacket$1.dispatch(ServerboundInteractPacket.java:24) ~[?:?] at net.minecraft.network.protocol.game.ServerboundInteractPacket.dispatch(ServerboundInteractPacket.java:80) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleInteract(ServerGamePacketListenerImpl.java:3000) ~[?:?] at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:67) ~[?:?] at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:12) ~[?:?] at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:51) ~[?:?] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.19.2.jar:git-Purpur-1845] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1368) ~[purpur-1.19.2.jar:git-Purpur-1845] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[purpur-1.19.2.jar:git-Purpur-1845] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1345) ~[purpur-1.19.2.jar:git-Purpur-1845] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1338) ~[purpur-1.19.2.jar:git-Purpur-1845] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?] at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1316) ~[purpur-1.19.2.jar:git-Purpur-1845] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1204) ~[purpur-1.19.2.jar:git-Purpur-1845] at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:310) ~[purpur-1.19.2.jar:git-Purpur-1845] at java.lang.Thread.run(Thread.java:833) ~[?:?]
Problem Description
The server is crashing because o the bellow errors, the error ModuleOldArmourStrength.java:49
To Reproduce
Steps to reproduce the behavior: 1. 2. 3. ### Expected BehaviourActual Behaviour