Skip to content

Commit f0ed6ab

Browse files
committed
Give players 10 seconds of resistance to avoid the splat
1 parent 20a7f3c commit f0ed6ab

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/main/kotlin/org/trackedout/Agronet.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import net.minecraft.server.network.ServerPlayNetworkHandler
2727
import net.minecraft.server.network.ServerPlayerEntity
2828
import net.minecraft.util.Formatting
2929
import net.minecraft.util.Identifier
30+
import net.minecraft.entity.effect.StatusEffectInstance
31+
import net.minecraft.entity.effect.StatusEffects
3032
import okhttp3.OkHttpClient
3133
import org.slf4j.LoggerFactory
3234
import org.trackedout.RunContext.dungeonType
@@ -318,6 +320,24 @@ object Agronet : ModInitializer {
318320
}
319321
}
320322

323+
ServerPlayConnectionEvents.JOIN.register { handler, _, _ ->
324+
val player = handler.player
325+
val playerName = handler.player.entityName
326+
327+
logger.info("Giving ${playerName} 10 seconds of resistance to avoid the splat")
328+
329+
player.addStatusEffect(
330+
StatusEffectInstance(
331+
StatusEffects.RESISTANCE,
332+
20 * 10, // 10 seconds
333+
255, // Strength
334+
false,
335+
false,
336+
false
337+
)
338+
)
339+
}
340+
321341
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
322342
dispatcher.register(
323343
literal("send-resource-pack")

0 commit comments

Comments
 (0)