3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 15:50:14 +01:00

'on server started' should only work during the first check

Dieser Commit ist enthalten in:
Tim203 2021-06-08 13:21:22 +02:00
Ursprung acc3a8222a
Commit f0b8870a47
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 064EE9F5BF7C3EE8
2 geänderte Dateien mit 5 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -27,16 +27,13 @@ package org.geysermc.connector.utils;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.Set;
public final class Constants {
public static final URI GLOBAL_API_WS_URI;
public static final String NTP_SERVER = "time.cloudflare.com";
public static final Set<String> NEWS_PROJECT_LIST = Collections.singleton("geyser");
public static final String NEWS_OVERVIEW_URL = "https://api.geysermc.org/v1/news";
public static final String NEWS_PROJECT_NAME = "geyser";
static {
URI wsUri = null;

Datei anzeigen

@ -52,7 +52,7 @@ public class NewsHandler {
private final String branch;
private final int build;
private boolean geyserStarted;
private boolean firstCheck = true;
public NewsHandler(String branch, int build) {
this.branch = branch;
@ -77,6 +77,7 @@ public class NewsHandler {
addNews(newsItem);
}
}
firstCheck = false;
} catch (Exception e) {
if (logger.isDebug()) {
logger.error("Error while reading news item", e);
@ -85,10 +86,6 @@ public class NewsHandler {
} catch (JsonSyntaxException ignored) {}
}
public void setGeyserStarted() {
geyserStarted = true;
}
public void handleNews(GeyserSession session, NewsItemAction action) {
for (NewsItem news : getActiveNews(action)) {
handleNewsItem(session, news, action);
@ -98,7 +95,7 @@ public class NewsHandler {
private void handleNewsItem(GeyserSession session, NewsItem news, NewsItemAction action) {
switch (action) {
case ON_SERVER_STARTED:
if (!geyserStarted) {
if (!firstCheck) {
return;
}
case BROADCAST_TO_CONSOLE:
@ -146,7 +143,7 @@ public class NewsHandler {
return;
}
if (!item.isGlobal() && !Constants.NEWS_PROJECT_LIST.contains(item.getProject())) {
if (!item.isGlobal() && !Constants.NEWS_PROJECT_NAME.equals(item.getProject())) {
return;
}