9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-29 11:59:21 +00:00

fix: hidden flags being added async causing error

This commit is contained in:
LoJoSho
2024-02-25 17:51:06 -06:00
parent add72e66c9
commit e13c3fccb4
2 changed files with 9 additions and 1 deletions

View File

@@ -99,7 +99,7 @@ public abstract class Data {
MessagesUtil.sendDebugMessages("Hidden Reason: " + hiddenReason);
// if else this, if else that, if else I got to deal with this anymore i'll lose my mind
if (!hiddenReason.isEmpty()) {
for (CosmeticUser.HiddenReason reason : hiddenReason) user.hideCosmetics(reason);
for (CosmeticUser.HiddenReason reason : hiddenReason) user.silentlyAddHideFlag(reason);
} else {
Bukkit.getScheduler().runTask(HMCCosmeticsPlugin.getInstance(), () -> {
// Handle gamemode check

View File

@@ -525,6 +525,14 @@ public class CosmeticUser {
MessagesUtil.sendDebugMessages("HideCosmetics");
}
/**
* This is used to silently add a hidden flag to the user. This will not trigger any events or checks, nor do anything else
* @param reason
*/
public void silentlyAddHideFlag(HiddenReason reason) {
if (!hiddenReason.contains(reason)) hiddenReason.add(reason);
}
public void showCosmetics(HiddenReason reason) {
if (hiddenReason.isEmpty()) return;