9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-26 18:39:23 +00:00
Files
Leaf/patches/server/0039-Faster-Random-for-xaeroMapServerID-generation.patch
2024-05-25 17:06:00 +08:00

28 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Mon, 9 Oct 2023 21:33:08 -0400
Subject: [PATCH] Faster Random for xaeroMapServerID generation
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 3113970b5cb5d9b1a18c7f82b44c29afe89a0730..4974ba174afe8cfd30e4dbbd59d4e88f62f45380 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -2,6 +2,7 @@ package org.dreeam.leaf;
import com.google.common.collect.ImmutableMap;
import net.minecraft.core.registries.BuiltInRegistries;
+import java.util.concurrent.ThreadLocalRandom;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.entity.EntityType;
import org.bukkit.Bukkit;
@@ -275,7 +276,7 @@ public class LeafConfig {
public static boolean jadeProtocol = false;
public static boolean appleskinProtocol = false;
public static boolean xaeroMapProtocol = false;
- public static int xaeroMapServerID = new Random().nextInt();
+ public static int xaeroMapServerID = ThreadLocalRandom.current().nextInt(); // Leaf - Faster Random
private static void network() {
jadeProtocol = getBoolean("network.protocol.jade-protocol", jadeProtocol);
appleskinProtocol = getBoolean("network.protocol.appleskin-protocol", appleskinProtocol);