diff --git a/gradle.properties b/gradle.properties index 1018dc7..e3cb234 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx1G org.gradle.parallel = true # Mod Properties -mod_version = 0.1.1 +mod_version = 0.1.2 maven_group = ru.pinkgoosik archives_base_name = dimensional-revive diff --git a/src/main/java/ru/pinkgoosik/dimrevive/DimensionalRevive.java b/src/main/java/ru/pinkgoosik/dimrevive/DimensionalRevive.java index fe7e7db..63c59e0 100644 --- a/src/main/java/ru/pinkgoosik/dimrevive/DimensionalRevive.java +++ b/src/main/java/ru/pinkgoosik/dimrevive/DimensionalRevive.java @@ -27,8 +27,11 @@ public void onInitialize() { ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register((player, origin, destination) -> { var visitedDimensions = ((WorldExtension)player.getServer().getOverworld()).getVisitedDimensions().visitedDimensions; - if(player.getServer().isHardcore() && !destination.getRegistryKey().equals(World.OVERWORLD) && !visitedDimensions.contains(destination.getRegistryKey().getValue().toString())) { + if(!player.isSpectator() && player.getServer().isHardcore() && !destination.getRegistryKey().equals(World.OVERWORLD) && !visitedDimensions.contains(destination.getRegistryKey().getValue().toString())) { + player.getServer().getPlayerManager().broadcast(Text.literal("New dimension was discovered: §6" + formatDimensionName(destination.getRegistryKey()) + "§f. All players are revived."), false); + visitedDimensions.add(destination.getRegistryKey().getValue().toString()); + ((WorldExtension)player.getServer().getOverworld()).getVisitedDimensions().setDirty(true); player.getServer().getPlayerManager().getPlayerList().forEach(serverPlayerEntity -> { if(serverPlayerEntity.isSpectator()) { @@ -38,13 +41,9 @@ public void onInitialize() { serverPlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 5, 5, false, true)); serverPlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.SATURATION, 5, 5, false, true)); - serverPlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 5, 255, false, true)); + serverPlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 5, 255, false, true)); } - serverPlayerEntity.sendMessage(Text.literal("New dimension was discovered: §6" + formatDimensionName(destination.getRegistryKey()) + "§f. All players are revived.")); }); - - visitedDimensions.add(destination.getRegistryKey().getValue().toString()); - ((WorldExtension)player.getServer().getOverworld()).getVisitedDimensions().setDirty(true); } }); }