-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use caffeine cache kickPermission instead of using google.common.cache
- Loading branch information
1 parent
0c93068
commit cca79a7
Showing
2 changed files
with
38 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
patches/server/0077-Use-caffeine-cache-kickPermission-instead-of-using-g.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> | ||
Date: Sun, 23 Jun 2024 11:26:20 +0800 | ||
Subject: [PATCH] Use caffeine cache kickPermission instead of using | ||
google.common.cache | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java | ||
index 1dcf131335fbeb19f6e01dee921587075df1231c..8b0578423b7107fb9152cc258fd082cf13aa9ab9 100644 | ||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java | ||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java | ||
@@ -338,17 +338,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl | ||
// CraftBukkit end | ||
|
||
// Purpur start | ||
- private final com.google.common.cache.LoadingCache<CraftPlayer, Boolean> kickPermissionCache = com.google.common.cache.CacheBuilder.newBuilder() | ||
+ // Leaf start - Use caffeine cache kickPermission instead of using google.common.cache | ||
+ private final com.github.benmanes.caffeine.cache.Cache<CraftPlayer, Boolean> kickPermissionCache = com.github.benmanes.caffeine.cache.Caffeine.newBuilder() | ||
.maximumSize(1000) | ||
.expireAfterWrite(1, java.util.concurrent.TimeUnit.MINUTES) | ||
- .build( | ||
- new com.google.common.cache.CacheLoader<>() { | ||
- @Override | ||
- public Boolean load(CraftPlayer player) { | ||
- return player.hasPermission("purpur.bypassIdleKick"); | ||
- } | ||
- } | ||
- ); | ||
+ .build(player -> player.hasPermission("purpur.bypassIdleKick")); | ||
+ // Leaf - Use caffeine cache kickPermission instead of using google.common.cache | ||
// Purpur end | ||
|
||
@Override |