Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont load chunk for Pathfinding & Networking opts #14

Merged
merged 4 commits into from
Jan 1, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cache player profile result
HaHaWTH committed Dec 31, 2024

Unverified

This user has not yet uploaded their public signing key.
commit e90bf360dfae2045d48a6bab2fb077bb38205dbe
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -508,6 +508,7 @@ project(':cleanroom') {
installer 'net.openhft:affinity:3.23.3'
installer 'org.slf4j:slf4j-api:2.1.0-alpha1' // Affinity
installer 'org.slf4j:slf4j-simple:2.1.0-alpha1' // Affinity
installer 'com.github.ben-manes.caffeine:caffeine:3.1.8'

/*
forgeGradleMcDeps
Original file line number Diff line number Diff line change
@@ -19,24 +19,27 @@

public class NetHandlerLoginServer implements INetHandlerLoginServer, ITickable
{
@@ -49,6 +54,8 @@
@@ -48,6 +53,11 @@
private final String field_147334_j = "";
private SecretKey field_147335_k;
private EntityPlayerMP field_181025_l;

+ public String hostname = "";
+ private static final com.github.benmanes.caffeine.cache.Cache<String, GameProfile> playerProfileResultCache = com.github.benmanes.caffeine.cache.Caffeine.newBuilder()
+ .expireAfterWrite(catserver.server.CatServer.getConfig().playerProfileResultCacheMinutes, java.util.concurrent.TimeUnit.MINUTES)
+ .build(); // CatRoom - Cache player profile result
+
+ public String hostname = "";

public NetHandlerLoginServer(MinecraftServer p_i45298_1_, NetworkManager p_i45298_2_)
{
this.field_147327_f = p_i45298_1_;
@@ -56,7 +63,6 @@
@@ -56,7 +66,6 @@
field_147329_d.nextBytes(this.field_147330_e);
}

- @Override
public void func_73660_a()
{
if (this.field_147328_g == NetHandlerLoginServer.LoginState.READY_TO_ACCEPT)
@@ -70,16 +76,29 @@
@@ -70,16 +79,29 @@
if (entityplayermp == null)
{
this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
@@ -70,7 +73,7 @@

public void func_194026_b(ITextComponent p_194026_1_)
{
@@ -95,18 +114,48 @@
@@ -95,18 +117,48 @@
}
}

@@ -126,7 +129,7 @@
}
else
{
@@ -133,12 +182,11 @@
@@ -133,12 +185,11 @@
}
else
{
@@ -140,7 +143,7 @@
public void func_147231_a(ITextComponent p_147231_1_)
{
field_147332_c.info("{} lost connection: {}", this.func_147317_d(), p_147231_1_.func_150260_c());
@@ -146,12 +194,9 @@
@@ -146,12 +197,9 @@

public String func_147317_d()
{
@@ -154,7 +157,7 @@
public void func_147316_a(CPacketLoginStart p_147316_1_)
{
Validate.validState(this.field_147328_g == NetHandlerLoginServer.LoginState.HELLO, "Unexpected hello packet");
@@ -164,11 +209,24 @@
@@ -164,11 +212,24 @@
}
else
{
@@ -181,7 +184,7 @@
public void func_147315_a(CPacketEncryptionResponse p_147315_1_)
{
Validate.validState(this.field_147328_g == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet");
@@ -183,32 +241,28 @@
@@ -183,32 +244,39 @@
this.field_147335_k = p_147315_1_.func_149300_a(privatekey);
this.field_147328_g = NetHandlerLoginServer.LoginState.AUTHENTICATING;
this.field_147333_a.func_150727_a(this.field_147335_k);
@@ -208,7 +211,18 @@
- .func_147130_as()
- .hasJoinedServer(new GameProfile(null, gameprofile.getName()), s, this.func_191235_a());
+ String s = (new BigInteger(CryptManager.func_75895_a("", NetHandlerLoginServer.this.field_147327_f.func_71250_E().getPublic(), NetHandlerLoginServer.this.field_147335_k))).toString(16);
+ NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.func_191235_a());
+ // CatRoom start - Cache player profile result
+ if (catserver.server.CatServer.getConfig().cachePlayerProfileResult) {
+ GameProfile gp = playerProfileResultCache.getIfPresent(gameprofile.getName());
+ if (gp == null) {
+ gp = NetHandlerLoginServer.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.func_191235_a());
+ playerProfileResultCache.put(gameprofile.getName(), gp);
+ }
+ NetHandlerLoginServer.this.field_147337_i = gp;
+ } else {
+ NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.func_191235_a());
+ }
+ // CatRoom end - Cache player profile result

if (NetHandlerLoginServer.this.field_147337_i != null)
{
@@ -226,7 +240,7 @@
}
else if (NetHandlerLoginServer.this.field_147327_f.func_71264_H())
{
@@ -218,11 +272,11 @@
@@ -218,11 +286,11 @@
}
else
{
@@ -241,7 +255,7 @@
{
if (NetHandlerLoginServer.this.field_147327_f.func_71264_H())
{
@@ -232,23 +286,67 @@
@@ -232,23 +300,67 @@
}
else
{
4 changes: 4 additions & 0 deletions src/main/java/catserver/server/CatServerConfig.java
Original file line number Diff line number Diff line change
@@ -61,6 +61,8 @@ public class CatServerConfig {
public boolean disableFMLStatusModInfo = false;
public boolean disableAsyncCatchWarn = false;
public boolean versionCheck = true;
public boolean cachePlayerProfileResult = false;
public int playerProfileResultCacheMinutes = 1440;

public boolean callConstructCapabilityEventOnRespawn = false;

@@ -113,6 +115,8 @@ public void loadConfig() {
releaseUseItemThrottle = getOrWriteIntConfig("network.packetLimit.releaseUseItemThrottle", releaseUseItemThrottle);
disableFMLHandshake = getOrWriteBooleanConfig("network.fml.disableHandshake", config.getBoolean("disableFMLHandshake", disableFMLHandshake));
disableFMLStatusModInfo = getOrWriteBooleanConfig("network.fml.disableStatusModInfo", config.getBoolean("disableFMLStatusModInfo", disableFMLStatusModInfo));
cachePlayerProfileResult = getOrWriteBooleanConfig("network.profile.cachePlayerProfileResult", cachePlayerProfileResult);
playerProfileResultCacheMinutes = getOrWriteIntConfig("network.profile.playerProfileResultCacheMinutes", playerProfileResultCacheMinutes);
// event bridge
bridgeForgeExplosionEventToBukkit = getOrWriteBooleanConfig("event-bridge.bridgeForgeExplosionEventToBukkit", bridgeForgeExplosionEventToBukkit);
// compatibility