2

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!

  • 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. – XeroOl Jan 31 '17 at 13:45
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!

| improve this answer | |
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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.