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: 2778
Follow Unfollow 42
Latest release (for Vintage Story 1.18.8 and 1.18.9 - 1.18.10, outdated):
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);
}
}
}
}
| Mod Version | Mod Identifier | For Game version | Downloads | Released | Changelog | Download | 1-click mod install* |
|---|---|---|---|---|---|---|---|
| 1.2.0 | loginprotection | 949 | Sep 4th 2023 at 3:35 PM | loginprotection-1.2.0.zip | 1-click install | ||
| |||||||
| 1.1.0 | loginprotection | 342 | Jul 26th 2023 at 2:11 AM | loginprotection-1.1.0.zip | 1-click install | ||
| |||||||
| 1.0.3 | loginprotection | 339 | Apr 8th 2023 at 12:01 PM | loginprotection-1.0.3.zip | 1-click install | ||
|
- recompile for 1.18 | |||||||
| 1.0.2 | loginprotection | 395 | Jun 7th 2022 at 12:54 PM | loginprotection-1.0.2.zip | 1-click install | ||
|
Add a new event | |||||||
| 1.0.1 | loginprotection | 341 | Jun 4th 2022 at 2:34 PM | loginprotection-1.0.1.zip | 1-click install | ||
| |||||||
| 1.0.0 | loginprotection | 412 | Jun 3rd 2022 at 10:39 PM | Empty | LoginProtection-1.0.0.dll | 1-click install | |
Xel would this still work with 1.20.9?
Bit hesitant to load it on a live server currently but we do have a few people with weak connection, so it would help a lot.
Thanks in advance :)
Thalius just tested it and it is working as of 1.20.4
Is this working for 1.20.x?
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