Async recalc perms and command map

This commit is contained in:
William Blake Galbreath
2020-04-08 23:03:02 -05:00
parent caf7dcb545
commit 891673a2a0
9 changed files with 92 additions and 84 deletions

View 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