diff --git a/bukkit/src/main/java/net/william278/husksync/BukkitHuskSync.java b/bukkit/src/main/java/net/william278/husksync/BukkitHuskSync.java index 9eb0f268..89b28b92 100644 --- a/bukkit/src/main/java/net/william278/husksync/BukkitHuskSync.java +++ b/bukkit/src/main/java/net/william278/husksync/BukkitHuskSync.java @@ -307,6 +307,11 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync { return audiences; } + @Override + public Set getLockedPlayers() { + return this.eventListener.getLockedPlayers(); + } + @Override public CompletableFuture reload() { return CompletableFuture.supplyAsync(() -> { diff --git a/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java b/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java index 54fb75f5..16a49027 100644 --- a/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java +++ b/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java @@ -675,4 +675,9 @@ public class BukkitPlayer extends OnlineUser { return maxHealth; } + @Override + public boolean isLocked() { + return BukkitHuskSync.getInstance().getLockedPlayers().contains(player.getUniqueId()); + } + } diff --git a/common/src/main/java/net/william278/husksync/HuskSync.java b/common/src/main/java/net/william278/husksync/HuskSync.java index 24bf9530..6560b3d4 100644 --- a/common/src/main/java/net/william278/husksync/HuskSync.java +++ b/common/src/main/java/net/william278/husksync/HuskSync.java @@ -165,4 +165,6 @@ public interface HuskSync { */ CompletableFuture reload(); + Set getLockedPlayers(); + } diff --git a/common/src/main/java/net/william278/husksync/listener/EventListener.java b/common/src/main/java/net/william278/husksync/listener/EventListener.java index 2123034c..a4178448 100644 --- a/common/src/main/java/net/william278/husksync/listener/EventListener.java +++ b/common/src/main/java/net/william278/husksync/listener/EventListener.java @@ -236,4 +236,8 @@ public abstract class EventListener { plugin.getRedisManager().close(); } + public final Set getLockedPlayers() { + return this.lockedPlayers; + } + } diff --git a/common/src/main/java/net/william278/husksync/player/OnlineUser.java b/common/src/main/java/net/william278/husksync/player/OnlineUser.java index 36196fca..1f76d806 100644 --- a/common/src/main/java/net/william278/husksync/player/OnlineUser.java +++ b/common/src/main/java/net/william278/husksync/player/OnlineUser.java @@ -371,4 +371,10 @@ public abstract class OnlineUser extends User { }); } + /** + * Get if the player is locked + * + * @return the player's locked status + */ + public abstract boolean isLocked(); }