Files
Purpur/patches/server/0111-Async-recalc-perms-and-command-map.patch
2020-04-12 16:39:52 -05:00

56 lines
2.2 KiB
Diff

From 89cadb880367ca553254aaee8372031eaa1eef5b 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 0d985b83d8..e0004fb644 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -760,6 +760,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().execute(new java.util.concurrent.RecursiveAction() {
+ protected void compute() {
+ recalculatePermsAndCommands(entityplayer, i);
+ }
+ });
+ } else
+ // Purpur end
this.a(entityplayer, i);
}
@@ -893,6 +902,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 e09cc77785..9ef407f346 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -208,4 +208,9 @@ public class PurpurConfig {
enchantment.setMaxLevel(maxLevel);
}
}
+
+ public static boolean updatePermsAndCommandsAsync = false;
+ private static void updatePermsAndCommandsAsync() {
+ updatePermsAndCommandsAsync = getBoolean("settings.update-permissions-and-commands-async", updatePermsAndCommandsAsync);
+ }
}
--
2.24.0