fix: fixed context loading sequence
This commit is contained in:
parent
49b5ad6db4
commit
a305d1806d
@ -92,17 +92,16 @@ public final class ServerBootstrap {
|
||||
|
||||
compileResourcePack();
|
||||
initializer.onResourcePackCompiled(Resources.getResourcePack());
|
||||
|
||||
initPlayerContextManager();
|
||||
initDefaultSkins();
|
||||
initDefaultDialogActionsAndConditions();
|
||||
NPCClickEvent.init();
|
||||
DebugCommands.init();
|
||||
}
|
||||
|
||||
private void initDefaultModules() {
|
||||
ItemUtil.init();
|
||||
PickableItem.registerEvent();
|
||||
initPlayerContextManager();
|
||||
initDefaultSkins();
|
||||
initDefaultDialogActionsAndConditions();
|
||||
NPCClickEvent.init();
|
||||
DebugCommands.init();
|
||||
}
|
||||
|
||||
private void compileResourcePack() {
|
||||
@ -180,7 +179,7 @@ public final class ServerBootstrap {
|
||||
}).addListener(PlayerSpawnEvent.class, event -> {
|
||||
var player = (MsbPlayer) event.getPlayer();
|
||||
|
||||
player.emitSpawnSignalForContexts();
|
||||
if (event.isFirstSpawn()) player.emitSpawnSignalForContexts();
|
||||
}).addListener(PlayerDisconnectEvent.class, event -> {
|
||||
var player = (MsbPlayer) event.getPlayer();
|
||||
|
||||
|
||||
@ -8,12 +8,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
import ru.dragonestia.msb3.api.util.UncheckedRunnable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MsbPlayer extends Player {
|
||||
|
||||
private final Map<String, PlayerContext> contexts = new HashMap<>();
|
||||
private final Map<String, PlayerContext> contexts = new LinkedHashMap<>();
|
||||
@Getter private final Instant startSessionTime = Instant.now();
|
||||
|
||||
public MsbPlayer(@NotNull PlayerConnection playerConnection, @NotNull GameProfile gameProfile) {
|
||||
|
||||
@ -7,7 +7,7 @@ import net.minestom.server.network.player.GameProfile;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@ -15,7 +15,7 @@ import java.util.function.Function;
|
||||
@UtilityClass
|
||||
public class PlayerContextManager {
|
||||
|
||||
private final Map<String, Function<MsbPlayer, ? extends PlayerContext>> contexts = new HashMap<>();
|
||||
private final Map<String, Function<MsbPlayer, ? extends PlayerContext>> contexts = new LinkedHashMap<>();
|
||||
|
||||
public MsbPlayer create(@NotNull PlayerConnection playerConnection, @NotNull GameProfile gameProfile) {
|
||||
var player = new MsbPlayer(playerConnection, gameProfile);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user