mirror of https://github.com/Minestom/Minestom.git
add hardcore property to config event (#117)
This commit is contained in:
parent
e7b0e702f6
commit
f5f8e21427
|
@ -204,6 +204,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||
private int permissionLevel;
|
||||
|
||||
private boolean reducedDebugScreenInformation;
|
||||
private boolean hardcore;
|
||||
|
||||
// Abilities
|
||||
private boolean flying;
|
||||
|
@ -263,10 +264,11 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public void setPendingInstance(@NotNull Instance pendingInstance) {
|
||||
public void setPendingOptions(@NotNull Instance pendingInstance, boolean hardcore) {
|
||||
// I(mattw) am not a big fan of this function, but somehow we need to store
|
||||
// the instance and i didn't like a record in ConnectionManager either.
|
||||
this.pendingInstance = pendingInstance;
|
||||
this.hardcore = hardcore;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,7 +287,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||
this.dimensionType = spawnInstance.getDimensionType();
|
||||
|
||||
final JoinGamePacket joinGamePacket = new JoinGamePacket(
|
||||
getEntityId(), false, List.of(), 0,
|
||||
getEntityId(), this.hardcore, List.of(), 0,
|
||||
MinecraftServer.getChunkViewDistance(), MinecraftServer.getChunkViewDistance(),
|
||||
false, true, false, dimensionType.toString(), spawnInstance.getDimensionName(),
|
||||
0, gameMode, null, false, levelFlat, deathLocation, portalCooldown);
|
||||
|
|
|
@ -19,6 +19,7 @@ public class AsyncPlayerConfigurationEvent implements PlayerEvent {
|
|||
private final Player player;
|
||||
private final boolean isFirstConfig;
|
||||
|
||||
private boolean hardcore;
|
||||
private boolean sendRegistryData;
|
||||
private Instance spawningInstance;
|
||||
|
||||
|
@ -26,6 +27,7 @@ public class AsyncPlayerConfigurationEvent implements PlayerEvent {
|
|||
this.player = player;
|
||||
this.isFirstConfig = isFirstConfig;
|
||||
|
||||
this.hardcore = false;
|
||||
this.sendRegistryData = isFirstConfig;
|
||||
this.spawningInstance = null;
|
||||
}
|
||||
|
@ -42,6 +44,14 @@ public class AsyncPlayerConfigurationEvent implements PlayerEvent {
|
|||
return isFirstConfig;
|
||||
}
|
||||
|
||||
public boolean isHardcore() {
|
||||
return this.hardcore;
|
||||
}
|
||||
|
||||
public void setHardcore(boolean hardcore) {
|
||||
this.hardcore = hardcore;
|
||||
}
|
||||
|
||||
public boolean willSendRegistryData() {
|
||||
return sendRegistryData;
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ public final class ConnectionManager {
|
|||
if (packFuture != null) packFuture.join();
|
||||
|
||||
keepAlivePlayers.remove(player);
|
||||
player.setPendingInstance(spawningInstance);
|
||||
player.setPendingOptions(spawningInstance, event.isHardcore());
|
||||
player.sendPacket(new FinishConfigurationPacket());
|
||||
});
|
||||
if (DebugUtils.INSIDE_TEST) configFuture.join();
|
||||
|
|
Loading…
Reference in New Issue