TechnicallyCoded / Inventory-Rollback-Plus

Spigot/Bukkit plugin that allows server moderators to restore player items and data from backups.
https://www.spigotmc.org/resources/85811/
Other
78 stars 44 forks source link

There's no backup made after EssentialsX /kill command #85

Closed oskarkk closed 2 years ago

oskarkk commented 2 years ago

Bug description:

No backup is made after killing a player with Essentials' /kill command. The normal vanilla Minecraft command triggers a backup.

Server details:

How to reproduce:

Use /kill command from Essentials on someone and then /ir restore.

What was expected:

Every death triggering a backup, even caused by some plugin.

TechnicallyCoded commented 2 years ago

Essentials needs to use the right methods. Killing a player must also call a damage event prior to such event. Unfortunately, I won't fix this.

oskarkk commented 2 years ago

Are you sure that's the case? I don't know much Java, but it looks to me like Essentials is calling that event:

        final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender.isPlayer() && sender.getPlayer().getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Float.MAX_VALUE);
        server.getPluginManager().callEvent(ede);
        if (ede.isCancelled() && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force")) {
            return;
        }
        ede.getEntity().setLastDamageCause(ede);
        matchPlayer.setHealth(0);

From com/earth2me/essentials/commands/Commandkill.java

If they really got that wrong, then I'll make an issue in Essentials' repo.

TechnicallyCoded commented 2 years ago

Hmm, I'll take a longer look at this, but if the entity damage event is triggered that's what the plugin listens to and therefore should work

TechnicallyCoded commented 2 years ago

Just tested using essentials, it works here. Are you sure you've set the permissions correctly

oskarkk commented 2 years ago

I've just tested it again and it works, I've also tested killing another player (that's when it didn't work for me) and it also works. Maybe it's some weird bug that doesn't happen all the time, maybe some interaction of plugins, maybe my mistake. I'll keep an eye on it and I'll sometimes check if it works, but for now thank you and sorry for wasting your time.