Yatopia/patches/server/0066-Add-a-way-to-retrieve-vanilla-map-colors.patch
2020-12-26 12:18:16 +02:00

37 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Sat, 26 Dec 2020 12:17:22 +0200
Subject: [PATCH] Add a way to retrieve vanilla map colors
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 201d84401114864ab2f9665bda3fe09c30cc7107..1849b7204f1cbbf25811c9a4efc0a5f02b6507b4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -269,6 +269,7 @@ public final class CraftServer implements Server {
private final List<CraftPlayer> playerView;
public int reloadCount;
public static Exception excessiveVelEx; // Paper - Velocity warnings
+ private java.awt.Color[] vanillaMapColors = null; // Yatopia
static {
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
@@ -2473,4 +2474,17 @@ public final class CraftServer implements Server {
// Purpur end
@Override public java.time.Duration getLastTickTime() { return net.minecraft.server.MinecraftServer.lastTickTime; } // Yatopia
+
+ // Yatopia start
+ @Override
+ public java.awt.Color[] getVanillaMapColors() {
+ if (vanillaMapColors != null) {
+ return vanillaMapColors;
+ }
+ vanillaMapColors = java.util.Arrays.stream(net.minecraft.server.MaterialMapColor.a)
+ .map(c -> new java.awt.Color(c.rgb))
+ .toArray(java.awt.Color[]::new);
+ return vanillaMapColors;
+ }
+ // Yatopia end
}