[Purpur Changes] PlazmaMC/Purpur@ceeec1c: work PlazmaMC/Purpur@e8f8f93: Updated Upstream (Paper, Pufferfish) [Paper Changes] PaperMC/Paper@f175193: Expose server build information (#10729) PaperMC/Paper@d8d59e0: Fix NPE sending resource pack without prompt PaperMC/Paper@5a9afbe: Fixes issues in the suppress dismount cancellation patch (#10735) PaperMC/Paper@0ad09de: Make PaperSimplePluginClassLoader show class which is not found PaperMC/Paper@b3b3406: fix CompassMeta not being correct (#10737) PaperMC/Paper@591521e: Check for more correct profile validation (#10730) PaperMC/Paper@7d2e5c3: Add an 'empty' RecipeChoice for certain ingredient slots (#10710) PaperMC/Paper@9bf4855: Add a better warning message than "Server performance will be affected" for CommandRegisteredEvent use (#10754) PaperMC/Paper@66cb880: Remove ThreadedWorldUpgrader patch PaperMC/Paper@980cff9: Fix compile PaperMC/Paper@d3ffa62: fix default item attributes PaperMC/Paper@b149584: Always show command exception stack traces in logs (#10766) PaperMC/Paper@a9201d4: [ci skip] Move logic in our patches to ItemType/BlockType (#10772) PaperMC/Paper@3de408e: Fix equipment slot and group API (#10767) PaperMC/Paper@d408381: Print CommandRegisteredEvent deprecation warnings again (#10756) PaperMC/Paper@6de7a1f: Improve default item attributes API (#10765) PaperMC/Paper@2a90732: Remove incorrect logic for Fireball#setVelocity (#10764) PaperMC/Paper@5e7b65a: Allow using PluginLoader classpath API from Bukkit plugins (#10758) PaperMC/Paper@3004717: Do not re-wrap vanilla goals (#10751) PaperMC/Paper@377733d: Use getter/setter on Mob for equipment drop chances (#10780) PaperMC/Paper@dff591d: Allow to define new map cursor types (#10782) PaperMC/Paper@4fd3ac0: [ci skip] Update Player#getListeningPluginChannels Jdoc (#10778) PaperMC/Paper@535dca5: Fix a few issues with ItemMeta (#10740) PaperMC/Paper@26e90b9: Fix CraftMetaBlockState for data components (#10731) PaperMC/Paper@f0bd0cc: Expose anvil cost in the API (#10682) PaperMC/Paper@41bee55: Fix NPE for color-related metas PaperMC/Paper@4e10fad: reset meta block state on BlockStateMeta#setBlockState
82 lines
4.3 KiB
Diff
82 lines
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: AlphaKR93 <dev@alpha93.kr>
|
|
Date: Mon, 6 May 2024 13:40:48 +0900
|
|
Subject: [PATCH] Use Plazma logo instead if server favicon doesn't exist
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index f926376ee95b28a9c09a1ad87223f89f1c28f50e..cf13166d1fdd663f1f99fd6d00a5296631276511 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1555,29 +1555,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
private Optional<ServerStatus.Favicon> loadStatusIcon() {
|
|
- Optional<Path> optional = Optional.of(this.getFile("server-icon.png").toPath()).filter((path) -> {
|
|
- return Files.isRegularFile(path, new LinkOption[0]);
|
|
- }).or(() -> {
|
|
- return this.storageSource.getIconFile().filter((path) -> {
|
|
- return Files.isRegularFile(path, new LinkOption[0]);
|
|
- });
|
|
- });
|
|
-
|
|
- return optional.flatMap((path) -> {
|
|
- try {
|
|
- BufferedImage bufferedimage = ImageIO.read(path.toFile());
|
|
-
|
|
- Preconditions.checkState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide");
|
|
- Preconditions.checkState(bufferedimage.getHeight() == 64, "Must be 64 pixels high");
|
|
- ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
|
|
-
|
|
- ImageIO.write(bufferedimage, "PNG", bytearrayoutputstream);
|
|
- return Optional.of(new ServerStatus.Favicon(bytearrayoutputstream.toByteArray()));
|
|
- } catch (Exception exception) {
|
|
- MinecraftServer.LOGGER.error("Couldn't load server icon", exception);
|
|
- return Optional.empty();
|
|
- }
|
|
- });
|
|
+ // Plazma start - Use Plazma logo instead if server favicon doesn't exist
|
|
+ @Nullable File file = Optional.of(this.getFile("server-icon.png").toPath()).filter(Files::isRegularFile)
|
|
+ .or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile)).map(Path::toFile).orElse(null);
|
|
+
|
|
+ try (
|
|
+ java.io.InputStream stream = (file != null)
|
|
+ ? new java.io.FileInputStream(file)
|
|
+ : (
|
|
+ org.plazmamc.plazma.Options.VANILLA_ICO
|
|
+ ? null
|
|
+ : MinecraftServer.class.getResourceAsStream("logo.png")
|
|
+ )
|
|
+ ) {
|
|
+ if (stream == null) return Optional.empty();
|
|
+ if (file == null && !org.plazmamc.plazma.Options.VANILLA_ICO)
|
|
+ LOGGER.info("No server icon found, using the logo instead.");
|
|
+
|
|
+ BufferedImage bufferedimage = ImageIO.read(stream);
|
|
+
|
|
+ Preconditions.checkState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide");
|
|
+ Preconditions.checkState(bufferedimage.getHeight() == 64, "Must be 64 pixels high");
|
|
+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
|
|
+
|
|
+ ImageIO.write(bufferedimage, "PNG", bytearrayoutputstream);
|
|
+ return Optional.of(new ServerStatus.Favicon(bytearrayoutputstream.toByteArray()));
|
|
+ } catch (Exception exception) {
|
|
+ MinecraftServer.LOGGER.error("Couldn't load server icon", exception);
|
|
+ return Optional.empty();
|
|
+ }
|
|
+ // Plazma end - Use Plazma logo instead if server favicon doesn't exist
|
|
}
|
|
|
|
public Optional<Path> getWorldScreenshotFile() {
|
|
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
|
index 1fe9af0ffc91626c712847df94ea31e19bb3c8a0..f446d1a793514ab19a4428294540d16c2f160a77 100644
|
|
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
|
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
|
@@ -9,5 +9,6 @@ public interface Options {
|
|
boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
|
boolean VANILLAIZE = Boolean.getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
|
boolean USE_VANILLA = Boolean.getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
|
+ boolean VANILLA_ICO = Boolean.getBoolean("Plazma.useVanillaFavicon");
|
|
|
|
}
|