mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Async recalc perms and command map
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
From 212be812f3e565dfd27838cb38d93c23054f7a63 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Fri, 12 Jul 2019 07:59:35 -0500
|
||||
Subject: [PATCH] PaperPR - Don't recalculate permissions for players on world
|
||||
change
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/PlayerList.java | 9 +++++----
|
||||
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
|
||||
2 files changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 67228329bd..39b33d9d72 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -32,13 +32,10 @@ import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
-import org.bukkit.event.player.PlayerPortalEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
-import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
-import org.bukkit.util.Vector;
|
||||
import org.spigotmc.event.player.PlayerSpawnLocationEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -712,7 +709,9 @@ public abstract class PlayerList {
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel));
|
||||
this.a(entityplayer1, worldserver);
|
||||
+ movedToWorld = true; // Purpur
|
||||
this.d(entityplayer1);
|
||||
+ movedToWorld = false; // Purpur
|
||||
if (!entityplayer.playerConnection.isDisconnected()) {
|
||||
worldserver.addPlayerRespawn(entityplayer1);
|
||||
this.players.add(entityplayer1);
|
||||
@@ -908,10 +907,12 @@ public abstract class PlayerList {
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
- entityplayer.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
||||
+ if (!(movedToWorld && !net.pl3x.purpur.PurpurConfig.recalculatePermsOnWorldChange)) entityplayer.getBukkitEntity().recalculatePermissions(); // CraftBukkit // Purpur
|
||||
this.server.getCommandDispatcher().a(entityplayer);
|
||||
}
|
||||
|
||||
+ private boolean movedToWorld = false; // Purpur
|
||||
+
|
||||
// Paper start
|
||||
public boolean isWhitelisted(GameProfile gameprofile) {
|
||||
return isWhitelisted(gameprofile, null);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 7699b81dad..bb5ba4f137 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -193,6 +193,11 @@ public class PurpurConfig {
|
||||
slimeBlocksNotPushable = getBoolean("settings.blocks.slime.not-movable-by-piston", slimeBlocksNotPushable);
|
||||
}
|
||||
|
||||
+ public static boolean recalculatePermsOnWorldChange = true;
|
||||
+ private static void updatePermissionsOnWorldChange() {
|
||||
+ recalculatePermsOnWorldChange = getBoolean("settings.recalculate-perms-on-world-change", recalculatePermsOnWorldChange);
|
||||
+ }
|
||||
+
|
||||
public static String serverModName = "Purpur";
|
||||
private static void serverModName() {
|
||||
serverModName = getString("settings.server-mod-name", serverModName);
|
||||
--
|
||||
2.24.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 5a37b73f23a92389a215265319ffa2f8bdcf5f68 Mon Sep 17 00:00:00 2001
|
||||
From c2c6d54ba01759c277efa80ab822f7ec56c5ced0 Mon Sep 17 00:00:00 2001
|
||||
From: chase <chasewhip20@gmail.com>
|
||||
Date: Sun, 15 Mar 2020 18:32:22 -0600
|
||||
Subject: [PATCH] PaperPR - Per World Spawn limits
|
||||
@@ -9,7 +9,7 @@ Subject: [PATCH] PaperPR - Per World Spawn limits
|
||||
2 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index be0d5f9e3e..718526ac5b 100644
|
||||
index b844b93d77..f1cca7219e 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -307,6 +307,17 @@ public class PurpurWorldConfig {
|
||||
@@ -1,4 +1,4 @@
|
||||
From 148d430731527e5de47f6a22798002dc9ddc9ac3 Mon Sep 17 00:00:00 2001
|
||||
From 6eefb42fb2789465e3680bb21214b229db31bded Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Fri, 25 Oct 2019 02:11:30 -0700
|
||||
Subject: [PATCH] Tuinity - Delay chunk unloads
|
||||
@@ -185,7 +185,7 @@ index 4b87ca2ecb..346e2ebc79 100644
|
||||
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {
|
||||
return new TicketType<>(s, comparator, 0L);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index bb5ba4f137..7a02d4e8a0 100644
|
||||
index 7699b81dad..46be1f205d 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -4,6 +4,7 @@ import com.google.common.base.Throwables;
|
||||
@@ -196,7 +196,7 @@ index bb5ba4f137..7a02d4e8a0 100644
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
@@ -214,4 +215,12 @@ public class PurpurConfig {
|
||||
@@ -209,4 +210,12 @@ public class PurpurConfig {
|
||||
enchantment.setMaxLevel(maxLevel);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
From 49eb2bbc6f28e325be860ceeb25929d56e69b064 Mon Sep 17 00:00:00 2001
|
||||
From 74469e0a48b975cc339b8c1038955bef5255bd6e Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
||||
Date: Thu, 26 Mar 2020 18:34:18 -0700
|
||||
Subject: [PATCH] Tuinity - Don't run entity collision code if not needed
|
||||
@@ -1,4 +1,4 @@
|
||||
From 241b00b7c980cd64bcbb1a439174969e57ee8a7a Mon Sep 17 00:00:00 2001
|
||||
From dc18fa7822bc86a417fa66d150d132cc7b71b58c Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
||||
Date: Fri, 3 Apr 2020 02:21:13 -0700
|
||||
Subject: [PATCH] Tuinity - Always able to execute tasks on the main server
|
||||
@@ -1,4 +1,4 @@
|
||||
From b1709f7987a485e5596ef7a485781ce219a70558 Mon Sep 17 00:00:00 2001
|
||||
From fb456b6e4d20cfe7f567d1210efcb816e8b90611 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Thu, 5 Mar 2020 23:08:01 +0100
|
||||
Subject: [PATCH] YAPFA - Disable mojang profiler
|
||||
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