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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user