fix: Teleport Invulnerability oversight & incorrect values on Sponge (#671)

This commit is contained in:
Preva1l authored and GitHub committed 2024-08-09 10:25:14 +01:00
1 parent 0eeab972e4
commit afae073ab7
9 files changed
+41 -2

No files matched your search

@@ -370,6 +370,19 @@ public interface HuskHomes extends Task.Supplier, EventDispatcher, SafetyResolve
return this.getCurrentlyOnWarmup().contains(userUuid);
}
@NotNull
Set<UUID> getCurrentlyInvulnerable();
/**
* Returns if the given user is currently invulnerable and if it should be removed.
*
* @param uuid the user to check.
* @return if the user is currently invulnerable.
*/
default boolean isInvulnerable(@NotNull UUID uuid) {
return this.getCurrentlyInvulnerable().contains(uuid);
}
@NotNull
default UpdateChecker getUpdateChecker() {
return UpdateChecker.builder()
@@ -101,6 +101,7 @@ public class EventListener {
* @param onlineUser the leaving {@link OnlineUser}
*/
protected final void handlePlayerLeave(@NotNull OnlineUser onlineUser) {
onlineUser.removeInvulnerabilityIfPermitted();
plugin.runAsync(() -> {
// Set offline position
plugin.getDatabase().setOfflinePosition(onlineUser, onlineUser.getPosition());
@@ -220,6 +220,8 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs
*/
public abstract void handleInvulnerability();
public abstract void removeInvulnerabilityIfPermitted();
/**
* Get the maximum number of homes this user may set.
*