Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- public void onRespawn(PlayerRespawnEvent event) {
- PlayerEntity player = event.getPlayer();
- player.getCapability(HealthCapability.HEALTH_CAPABILITY).ifPresent(health -> {
- if (player.getMaxHealth() >= 2.0F && player.getMaxHealth() <= 20.0F) {
- player.setHealth(health.getMaxHealth());
- player.getAttribute(Attributes.MAX_HEALTH).setBaseValue(health.getMaxHealth());
- } if (player.getMaxHealth() >= 22.0F) {
- player.setGameMode(GameType.SPECTATOR);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement