mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 12:45:57 +01:00
Restore the inventory on disabling inventoryProtect on reload
(Fixes #818)
This commit is contained in:
parent
8f5817883e
commit
ed6ba3ac8d
@ -2,6 +2,7 @@ package fr.xephi.authme.listener.protocollib;
|
|||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.initialization.SettingsDependent;
|
import fr.xephi.authme.initialization.SettingsDependent;
|
||||||
import fr.xephi.authme.settings.NewSetting;
|
import fr.xephi.authme.settings.NewSetting;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
@ -107,7 +108,18 @@ public class ProtocolLibService implements SettingsDependent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadSettings(NewSetting settings) {
|
public void loadSettings(NewSetting settings) {
|
||||||
|
boolean oldProtectInventory = this.protectInvBeforeLogin;
|
||||||
|
|
||||||
this.protectInvBeforeLogin = settings.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN);
|
this.protectInvBeforeLogin = settings.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN);
|
||||||
this.denyTabCompleteBeforeLogin = settings.getProperty(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN);
|
this.denyTabCompleteBeforeLogin = settings.getProperty(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN);
|
||||||
|
|
||||||
|
//it was true and will be deactivated now, so we need to restore the inventory for every player
|
||||||
|
if (oldProtectInventory && !protectInvBeforeLogin) {
|
||||||
|
for (Player onlinePlayer : bukkitService.getOnlinePlayers()) {
|
||||||
|
if (!PlayerCache.getInstance().isAuthenticated(onlinePlayer.getName())) {
|
||||||
|
sendInventoryPacket(onlinePlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user