Mods / Login Protection
Author: Xel
Side: Server
Created: Jun 3rd 2022 at 10:36 PM
Last modified: Sep 4th 2023 at 3:35 PM
Downloads: 1968
Follow Unfollow 32
Latest file for Various v1.18.x:
loginprotection-1.2.0.zip
1-click install
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.
There is also a single config option ProtectionTimeSeconds
. If this is set to a number then the player's protection will expire that many seconds after logging in (this may be before the player can actually see anything. Make sure you set the number high enough).
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();
internal class YourModSystem : ModSystem
{
private System.Func<IPlayer, bool> isPlayerProtected;
public void InjurePlayer (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>;
}
else
{
isPlayerProtected = (IPlayer p) => false;
}
}
if (!isPlayerProtected(player)))
{
ExplodePlayer(player);
}
}
}
}
Version | For Game version | Downloads | Release date | Changelog | Download | 1-click mod install* |
---|---|---|---|---|---|---|
v1.2.0 | 510 | Sep 4th 2023 at 3:35 PM | Show | loginprotection-1.2.0.zip | Install now | |
v1.1.0 | 279 | Jul 26th 2023 at 2:11 AM | Show | loginprotection-1.1.0.zip | Install now | |
v1.0.3 | 285 | Apr 8th 2023 at 12:01 PM | Show | loginprotection-1.0.3.zip | Install now | |
v1.0.2 | 341 | Jun 7th 2022 at 12:54 PM | Show | loginprotection-1.0.2.zip | Install now | |
v1.0.1 | 282 | Jun 4th 2022 at 2:34 PM | Show | loginprotection-1.0.1.zip | Install now | |
v1.0.0 | 271 | Jun 3rd 2022 at 10:39 PM | Show | LoginProtection-1.0.0.dll | Install now |
Tested on multiplayer server version 1.19.3, everything works. You can install and enjoy!
Will the mod be updated to 1.19?
Could you add an 'PING' sound when the game connects or the game finished loading in single player (and pause the game)?
A lot of people like to abuse the login protection in order to be invulnerable and so as long they do not move, they can still hit stuff and maintain invulnerability. Please think seriously about adding a timer on rather how long the protection lasts or make it cancel invulnerability when an attack is performed by the player. Additionally, if you are in the invulnerability state, please make it freeze your present health and food unless you are moving/switching equipment/trying to bring your food/health back up or anything else aside from chatting to seek help in the chat window. Also, if you fell in the water and are technically not moving but your character is sinking, it should not cancel invulnerability unless the player themselves presses a button besides chatting keys. This should greatly reduce invulnerability abuse.
Any chance to make the protection "timed" and configurable?
(like: 30 seconds of protection, 60 seconds or so on)
Xel