From acc3a8222ac1e90e3b70c67df8db8ac3773674de Mon Sep 17 00:00:00 2001 From: Tim203 Date: Tue, 8 Jun 2021 12:53:00 +0200 Subject: [PATCH] Check if item is active and added global items --- .../src/main/java/org/geysermc/floodgate/news/NewsItem.java | 4 ++++ .../main/java/org/geysermc/connector/utils/NewsHandler.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/org/geysermc/floodgate/news/NewsItem.java b/common/src/main/java/org/geysermc/floodgate/news/NewsItem.java index 2f6bb4852..be0634a6d 100644 --- a/common/src/main/java/org/geysermc/floodgate/news/NewsItem.java +++ b/common/src/main/java/org/geysermc/floodgate/news/NewsItem.java @@ -100,6 +100,10 @@ public final class NewsItem { return project; } + public boolean isGlobal() { + return "all".equals(getProject()); + } + public boolean isActive() { return active; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java b/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java index aa8fe2efc..fb945edc6 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java +++ b/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java @@ -142,7 +142,11 @@ public class NewsHandler { return; } - if (!Constants.NEWS_PROJECT_LIST.contains(item.getProject())) { + if (!item.isActive()) { + return; + } + + if (!item.isGlobal() && !Constants.NEWS_PROJECT_LIST.contains(item.getProject())) { return; }