mirror of
https://github.com/PaperMC/Paper.git
synced 2025-05-19 05:30:23 -07:00
Allow Server#getDefaultGameMode before worlds are initialized (#12490)
This commit is contained in:
parent
1db3785307
commit
d1810f241c
@ -40,6 +40,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.imageio.ImageIO;
|
||||
import net.minecraft.Optionull;
|
||||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
@ -2261,7 +2262,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public GameMode getDefaultGameMode() {
|
||||
return GameMode.getByValue(this.console.getLevel(net.minecraft.world.level.Level.OVERWORLD).serverLevelData.getGameType().getId());
|
||||
return GameMode.getByValue(Optionull.mapOrDefault(
|
||||
this.console.getLevel(net.minecraft.world.level.Level.OVERWORLD),
|
||||
l -> l.serverLevelData.getGameType(),
|
||||
this.console.getProperties().gamemode
|
||||
).getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user