Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 20:43:04 +02:00
'on server started' should only work during the first check
Dieser Commit ist enthalten in:
Ursprung
acc3a8222a
Commit
f0b8870a47
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren