mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-22 17:18:40 +01:00
Properly log fabric deaths where killer is null (#2184)
Affects issues: - Fixed #2182
This commit is contained in:
parent
2dadf249f0
commit
f096d456c6
@ -16,12 +16,14 @@
|
||||
*/
|
||||
package net.playeranalytics.plan.gathering.listeners.events.mixin;
|
||||
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.world.GameMode;
|
||||
import net.playeranalytics.plan.gathering.listeners.events.PlanFabricEvents;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ServerPlayerEntity.class)
|
||||
@ -32,4 +34,11 @@ public class ServerPlayerEntityMixin {
|
||||
PlanFabricEvents.ON_GAMEMODE_CHANGE.invoker().onGameModeChange((ServerPlayerEntity) (Object) this, gameMode);
|
||||
}
|
||||
|
||||
@Inject(method = "onDeath", at = @At(value = "TAIL"))
|
||||
public void onKillSelf(DamageSource source, CallbackInfo ci) {
|
||||
if (source.getAttacker() == null) {
|
||||
PlanFabricEvents.ON_KILLED.invoker().onKilled((ServerPlayerEntity) (Object) this, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user