Mods / Login Protection

Category: #QoL #Tweak #Utility
Author: Xel
Side: Server
Created: Jun 3rd at 10:36 PM
Last modified: Jun 7th at 12:54 PM
Downloads: 274
Follow Unfollow 3

Tired of dying when logging into a server?

Login Protection prevents the player from taking damage when they join a server because the server thinks the player is ready even though their client is still loading.

Once the player moves or does anything, they are considered "active" and no longer protected. Players standing in lava or on fire will also not be protected.


Exposes a single serverside method to check if a player is protected or not, as well as 3 events:

var loginProtection = Api.ModLoader.GetModSystem<LoginProtectionModSystem>();
loginProtection.OnLoginProtectionStart += player => doSomething(player);
loginProtection.OnLoginProtectionStop += player => doSomething(player);
loginProtection.OnShouldProtect += player => shouldProtect(player);
if (wouldDoSomething && loginProtection.IsPlayerProtected(player)) Dont();
Full code example using reflection:
internal class YourModSystem : ModSystem
  private System.Func<IPlayer, bool> isPlayerProtected;

  public void ConsumePlayerAir (IPlayer player)
    if (_api.IsServerSide())
      if (isPlayerProtected == null)
        var loginProtection = _api.ModLoader.GetModSystem("LoginProtection.LoginProtectionModSystem");
        if (loginProtection != null)
          var isPlayerProtectedMethod = loginProtection.GetType().GetMethod("IsPlayerProtected");
          isPlayerProtected = isPlayerProtectedMethod.CreateDelegate(typeof(System.Func<IPlayer, bool>), loginProtection) as System.Func<IPlayer, bool>;
          isPlayerProtected = (IPlayer p) => false;
      if (!isPlayerProtected(player)))


Version For Game version Downloads Release date Changelog Download
v1.0.2 124 Jun 7th at 12:54 PM Show
v1.0.1 81 Jun 4th at 2:34 PM Show
v1.0.0 69 Jun 3rd at 10:39 PM Show LoginProtection-1.0.0.dll

0 Comments (oldest first | newest first)

(edit comment delete)