mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Async recalc perms and command map
This commit is contained in:
55
patches/server/0126-Async-recalc-perms-and-command-map.patch
Normal file
55
patches/server/0126-Async-recalc-perms-and-command-map.patch
Normal file
@@ -0,0 +1,55 @@
|
||||
From 91fb88a18fbf6235e8a4aa3e486c02c7631cf81c Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Wed, 8 Apr 2020 23:01:20 -0500
|
||||
Subject: [PATCH] Async recalc perms and command map
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/PlayerList.java | 10 ++++++++++
|
||||
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
|
||||
2 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 67228329bd..df6fe980b0 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -759,6 +759,15 @@ public abstract class PlayerList {
|
||||
GameProfile gameprofile = entityplayer.getProfile();
|
||||
int i = this.server.b(gameprofile);
|
||||
|
||||
+ // Purpur start
|
||||
+ if (net.pl3x.purpur.PurpurConfig.updatePermsAndCommandsAsync) {
|
||||
+ java.util.concurrent.ForkJoinPool.commonPool().invoke(new java.util.concurrent.RecursiveAction() {
|
||||
+ protected void compute() {
|
||||
+ recalculatePermsAndCommands(entityplayer, i);
|
||||
+ }
|
||||
+ });
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
this.a(entityplayer, i);
|
||||
}
|
||||
|
||||
@@ -892,6 +901,7 @@ public abstract class PlayerList {
|
||||
|
||||
}
|
||||
|
||||
+ private void recalculatePermsAndCommands(EntityPlayer entityplayer, int i) { a(entityplayer, i); } // Purpur - OBFHELPER
|
||||
private void a(EntityPlayer entityplayer, int i) {
|
||||
if (entityplayer.playerConnection != null) {
|
||||
byte b0;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 46be1f205d..1d472dd144 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -218,4 +218,9 @@ public class PurpurConfig {
|
||||
TicketType.DELAYED_UNLOAD.loadPeriod = delayChunkUnloadsBy;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public static boolean updatePermsAndCommandsAsync = false;
|
||||
+ private static void updatePermsAndCommandsAsync() {
|
||||
+ updatePermsAndCommandsAsync = getBoolean("settings.update-permissions-and-commands-async", updatePermsAndCommandsAsync);
|
||||
+ }
|
||||
}
|
||||
--
|
||||
2.24.0
|
||||
|
||||
Reference in New Issue
Block a user