1

I help run a modded FTB Direwolf20 1.10.2 server (Forge 12.18.3.2185). I'd like to give players a short duration of immunity after logging in, e.g. 20 seconds, to make up for the lag/logging in time which often results in deaths before the player actually logs in.

How do I do this? Adding a new mod is okay, but I'd prefer a vanilla solution if possible. I have FTP and multicraft access to the server (not root access).

Thank you!

1
  • I don't think there is a way in pure vanilla, but there might be something in the base forge server that configures this. I'm not sure.
    – user170887
    Commented Jan 31, 2017 at 13:45

2 Answers 2

1

This is highly theoretical but, you could create a scoreboard dummy objective that counts how many seconds (or ticks) a player has been online using /scoreboard objectives add NAME dummy DISPLAYNAME then have a command block add a score of 1 for each player on that objective once every tick or second (however long you want it to be) using /scoreboard players add @a NAME 1. Sorry if the commands may be slightly off, I am away from my computer... Next, to apply the invulnerable effect (either absorption or regeneration of high levels) try putting this in a repeating command block effect @a[score_max_NAME=20] blahblah with the duration set to 1 if you want it to last however many seconds are defined by the max value which in this case is 20. But then the question arises, how do I make their score reset to zero when they either logout or join? That is where my expertise is at its end. I suggest creating a new thread asking how to detect when a player logs out, then performs an action on that SPECIFIC player. Hope this helped!

0

You can use scoreboard...
There is a criteria called stat.leaveGame, you can use this to detect when the player rejoins the server, and run effect command to those players score higher or equal to 1. After that, you can set the score to be 0 and wait for the next time


edit:

Add scoreboard objective(detect leave game) /scoreboard objectives add leaveGame stat.leaveGame

Give effect to the player who joined the game(has left before) /effect @a[score_leaveGame_min=1] minecraft:resistance <time> 4

Clear their score /scoreboard players set @a leaveGame 0

1
  • 1
    hey there, could you elaborate on this answer? How do i implement this in multicraft? thanks
    – Aralox
    Commented Feb 20, 2017 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.