Skip to content

Commit

Permalink
refactor: rename doFirstSpawn to onFullyJoined
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Oct 19, 2024
1 parent 9ea52b1 commit 33eea58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api/src/main/java/org/allaymc/api/server/ServerSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public static class WorldConfig extends OkaeriConfig {
@CustomKey("chunk-sending-strategy")
private ChunkSendingStrategy chunkSendingStrategy = ChunkSendingStrategy.ASYNC;

@CustomKey("do-first-spawn-chunk-threshold")
private int doFirstSpawnChunkThreshold = 56;
@CustomKey("fully-joined-chunk-threshold")
private int fullyJoinedChunkThreshold = 56;

@Comment("Determines how long a chunk without chunk loaders will remain loaded (gt)")
@CustomKey("remove-unneeded-chunk-cycle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.allaymc.api.client.data.LoginData;
import org.allaymc.api.client.storage.PlayerData;
import org.allaymc.api.component.interfaces.ComponentManager;
import org.allaymc.api.container.FullContainerType;
import org.allaymc.api.container.UnopenedContainerId;
Expand All @@ -20,8 +19,6 @@
import org.allaymc.api.item.ItemStack;
import org.allaymc.api.item.recipe.Recipe;
import org.allaymc.api.math.location.Location3f;
import org.allaymc.api.math.location.Location3i;
import org.allaymc.api.math.location.Location3ic;
import org.allaymc.api.pack.Pack;
import org.allaymc.api.registry.Registries;
import org.allaymc.api.server.Server;
Expand Down Expand Up @@ -83,7 +80,7 @@ public class EntityPlayerNetworkComponentImpl implements EntityPlayerNetworkComp
protected boolean networkEncryptionEnabled = false;
@Getter
protected boolean initialized = false;
protected AtomicInteger doFirstSpawnChunkThreshold = new AtomicInteger(Server.SETTINGS.worldSettings().doFirstSpawnChunkThreshold());
protected AtomicInteger fullyJoinedChunkThreshold = new AtomicInteger(Server.SETTINGS.worldSettings().fullyJoinedChunkThreshold());
@Manager
protected ComponentManager manager;
@ComponentedObject
Expand Down Expand Up @@ -172,8 +169,8 @@ public void onDisconnect(String reason) {
}

public void onChunkInRangeSent() {
if (doFirstSpawnChunkThreshold.get() > 0 && doFirstSpawnChunkThreshold.decrementAndGet() == 0) {
doFirstSpawn();
if (fullyJoinedChunkThreshold.get() > 0 && fullyJoinedChunkThreshold.decrementAndGet() == 0) {
onFullyJoined();
}
}

Expand Down Expand Up @@ -216,7 +213,7 @@ public boolean isDisconnected() {
return disconnected.get();
}

protected void doFirstSpawn() {
protected void onFullyJoined() {
var world = thisPlayer.getWorld();
// Load EntityPlayer's NBT
thisPlayer.loadNBT(server.getPlayerStorage().readPlayerData(thisPlayer).getNbt());
Expand Down

0 comments on commit 33eea58

Please sign in to comment.