mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
add hardcore property to config event (#117)
(cherry picked from commit f5f8e21427
)
This commit is contained in:
parent
06695f71f0
commit
cf8c275cf2
@ -203,6 +203,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
private int permissionLevel;
|
||||
|
||||
private boolean reducedDebugScreenInformation;
|
||||
private boolean hardcore;
|
||||
|
||||
// Abilities
|
||||
private boolean flying;
|
||||
@ -262,10 +263,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -284,7 +286,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
Block a user