mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 14:38:53 +00:00
Handle death event update async (#774)
This commit is contained in:
1 parent
5ebd4322b5
commit
dd4b300f0f
1 file changed
+4
-1
@@ -219,10 +219,13 @@ public abstract class EventListener {
|
|||||||
* @param onlineUser the {@link OnlineUser} who died
|
* @param onlineUser the {@link OnlineUser} who died
|
||||||
*/
|
*/
|
||||||
protected final void handlePlayerDeath(@NotNull OnlineUser onlineUser) {
|
protected final void handlePlayerDeath(@NotNull OnlineUser onlineUser) {
|
||||||
|
final Position lastPosition = onlineUser.getPosition();
|
||||||
|
plugin.runAsync(() -> {
|
||||||
if (plugin.getSettings().getGeneral().getBackCommand().isReturnByDeath() && plugin.getCommand(BackCommand.class)
|
if (plugin.getSettings().getGeneral().getBackCommand().isReturnByDeath() && plugin.getCommand(BackCommand.class)
|
||||||
.map(Command::getPermission).map(onlineUser::hasPermission).orElse(false)) {
|
.map(Command::getPermission).map(onlineUser::hasPermission).orElse(false)) {
|
||||||
plugin.getDatabase().setLastPosition(onlineUser, onlineUser.getPosition());
|
plugin.getDatabase().setLastPosition(onlineUser, lastPosition);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user