Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Jun 17, 2024
1 parent 90362de commit 0965f6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 5 additions & 6 deletions src/main/java/ru/pinkgoosik/dimrevive/DimensionalRevive.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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);
}
});
}
Expand Down

0 comments on commit 0965f6e

Please sign in to comment.