mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 10:35:16 +01:00
Fix exception when a player joins the server on fabric-1.20
This commit is contained in:
parent
90a8f2c20f
commit
967261a98a
@ -189,7 +189,7 @@ public Optional<Path> getModsFolder() {
|
|||||||
public void onPlayerJoin(MinecraftServer server, ServerPlayerEntity playerInstance) {
|
public void onPlayerJoin(MinecraftServer server, ServerPlayerEntity playerInstance) {
|
||||||
if (this.serverInstance != server) return;
|
if (this.serverInstance != server) return;
|
||||||
|
|
||||||
FabricPlayer player = new FabricPlayer(playerInstance.getUuid(), this);
|
FabricPlayer player = new FabricPlayer(playerInstance, this);
|
||||||
onlinePlayerMap.put(player.getUuid(), player);
|
onlinePlayerMap.put(player.getUuid(), player);
|
||||||
onlinePlayerList.add(player);
|
onlinePlayerList.add(player);
|
||||||
}
|
}
|
||||||
|
@ -64,11 +64,11 @@ public class FabricPlayer implements Player {
|
|||||||
|
|
||||||
private final FabricMod mod;
|
private final FabricMod mod;
|
||||||
|
|
||||||
public FabricPlayer(UUID playerUuid, FabricMod mod) {
|
public FabricPlayer(ServerPlayerEntity player, FabricMod mod) {
|
||||||
this.uuid = playerUuid;
|
this.uuid = player.getUuid();
|
||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
|
|
||||||
update();
|
update(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -131,6 +131,10 @@ public void update() {
|
|||||||
ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
|
ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
|
||||||
|
update(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(ServerPlayerEntity player) {
|
||||||
this.gamemode = GAMEMODE_MAP.get(player.interactionManager.getGameMode());
|
this.gamemode = GAMEMODE_MAP.get(player.interactionManager.getGameMode());
|
||||||
if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL;
|
if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user