Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
Don't look up git properties for news handler in development
Dieser Commit ist enthalten in:
Ursprung
469421c481
Commit
096c707a25
@ -228,16 +228,20 @@ public class GeyserConnector {
|
|||||||
|
|
||||||
String branch = "unknown";
|
String branch = "unknown";
|
||||||
int buildNumber = -1;
|
int buildNumber = -1;
|
||||||
try {
|
if (this.isProductionEnvironment()) {
|
||||||
Properties gitProperties = new Properties();
|
try {
|
||||||
gitProperties.load(FileUtils.getResource("git.properties"));
|
Properties gitProperties = new Properties();
|
||||||
branch = gitProperties.getProperty("git.branch");
|
gitProperties.load(FileUtils.getResource("git.properties"));
|
||||||
String build = gitProperties.getProperty("git.build.number");
|
branch = gitProperties.getProperty("git.branch");
|
||||||
if (build != null) {
|
String build = gitProperties.getProperty("git.build.number");
|
||||||
buildNumber = Integer.parseInt(build);
|
if (build != null) {
|
||||||
|
buildNumber = Integer.parseInt(build);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("Failed to read git.properties", e);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} else {
|
||||||
logger.error("Failed to read git.properties", e);
|
logger.debug("Not getting git properties for the news handler as we are in a development environment.");
|
||||||
}
|
}
|
||||||
newsHandler = new NewsHandler(branch, buildNumber);
|
newsHandler = new NewsHandler(branch, buildNumber);
|
||||||
|
|
||||||
@ -526,17 +530,27 @@ public class GeyserConnector {
|
|||||||
return timeSyncer;
|
return timeSyncer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns false if this Geyser instance is running in an IDE. This only needs to be used in cases where files
|
||||||
|
* expected to be in a jarfile are not present.
|
||||||
|
*
|
||||||
|
* @return true if the version number is not 'DEV'.
|
||||||
|
*/
|
||||||
|
public boolean isProductionEnvironment() {
|
||||||
|
//noinspection ConstantConditions - changes in production
|
||||||
|
return !"DEV".equals(GeyserConnector.VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to use XML reflections in the jar or manually find the reflections.
|
* Whether to use XML reflections in the jar or manually find the reflections.
|
||||||
* Will return true if the version number is not 'DEV' and the platform is not Fabric.
|
* Will return true and the platform is not Fabric.
|
||||||
* On Fabric - it complains about being unable to create a default XMLReader.
|
* On Fabric - it complains about being unable to create a default XMLReader.
|
||||||
* On other platforms this should only be true in compiled jars.
|
* On other platforms this should only be true in compiled jars.
|
||||||
*
|
*
|
||||||
* @return whether to use XML reflections
|
* @return whether to use XML reflections
|
||||||
*/
|
*/
|
||||||
public boolean useXmlReflections() {
|
public boolean useXmlReflections() {
|
||||||
//noinspection ConstantConditions
|
return !this.getPlatformType().equals(PlatformType.FABRIC) && isProductionEnvironment();
|
||||||
return !this.getPlatformType().equals(PlatformType.FABRIC) && !"DEV".equals(GeyserConnector.VERSION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GeyserConnector getInstance() {
|
public static GeyserConnector getInstance() {
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package org.geysermc.connector.command.defaults;
|
package org.geysermc.connector.command.defaults;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
|
||||||
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
||||||
import org.geysermc.common.PlatformType;
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
@ -67,8 +66,7 @@ public class VersionCommand extends GeyserCommand {
|
|||||||
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), GeyserConnector.NAME, GeyserConnector.VERSION, GeyserConnector.MINECRAFT_VERSION, bedrockVersions));
|
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), GeyserConnector.NAME, GeyserConnector.VERSION, GeyserConnector.MINECRAFT_VERSION, bedrockVersions));
|
||||||
|
|
||||||
// Disable update checking in dev mode and for players in Geyser Standalone
|
// Disable update checking in dev mode and for players in Geyser Standalone
|
||||||
//noinspection ConstantConditions - changes in production
|
if (GeyserConnector.getInstance().isProductionEnvironment() && !(!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE)) {
|
||||||
if (!GeyserConnector.VERSION.equals("DEV") && !(!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE)) {
|
|
||||||
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale()));
|
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale()));
|
||||||
try {
|
try {
|
||||||
Properties gitProp = new Properties();
|
Properties gitProp = new Properties();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren