9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-25 17:49:20 +00:00

Properly synchronise player death states

This commit is contained in:
William
2022-07-13 12:21:38 +01:00
parent 268c351a95
commit 10b3eb5a43
5 changed files with 8 additions and 28 deletions

View File

@@ -50,9 +50,6 @@ public abstract class EventListener {
* @param user The {@link OnlineUser} to handle
*/
protected final void handlePlayerJoin(@NotNull OnlineUser user) {
if (user.isDead()) {
return;
}
usersAwaitingSync.add(user.uuid);
CompletableFuture.runAsync(() -> {
try {

View File

@@ -148,13 +148,6 @@ public abstract class OnlineUser extends User {
*/
public abstract CompletableFuture<Void> setPersistentDataContainer(@NotNull PersistentDataContainerData persistentDataContainerData);
/**
* Indicates if the player is currently dead
*
* @return {@code true} if the player is dead ({@code health <= 0}); {@code false} otherwise
*/
public abstract boolean isDead();
/**
* Indicates if the player has gone offline
*
@@ -191,7 +184,7 @@ public abstract class OnlineUser extends User {
final PreSyncEvent preSyncEvent = (PreSyncEvent) eventCannon.firePreSyncEvent(this, data).join();
final UserData finalData = preSyncEvent.getUserData();
final List<CompletableFuture<Void>> dataSetOperations = new ArrayList<>() {{
if (!isOffline() && !isDead() && !preSyncEvent.isCancelled()) {
if (!isOffline() && !preSyncEvent.isCancelled()) {
if (settings.getBooleanValue(Settings.ConfigOption.SYNCHRONIZATION_SYNC_INVENTORIES)) {
add(setInventory(finalData.getInventoryData()));
}