mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-23 18:55:11 +01:00
Fix ProtocolLib services are disabling after authme reload
Using the previous else branch we would always call unregister if the feature was enabled before.
This commit is contained in:
parent
930f5609bf
commit
914c4adc0b
@ -5,9 +5,9 @@ import fr.xephi.authme.AuthMe;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.initialization.SettingsDependent;
|
import fr.xephi.authme.initialization.SettingsDependent;
|
||||||
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -56,16 +56,21 @@ public class ProtocolLibService implements SettingsDependent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up packet adapters
|
// Set up packet adapters
|
||||||
if (protectInvBeforeLogin && inventoryPacketAdapter == null) {
|
if (protectInvBeforeLogin) {
|
||||||
inventoryPacketAdapter = new InventoryPacketAdapter(plugin, playerCache);
|
if (inventoryPacketAdapter == null) {
|
||||||
inventoryPacketAdapter.register();
|
inventoryPacketAdapter = new InventoryPacketAdapter(plugin, playerCache);
|
||||||
|
inventoryPacketAdapter.register();
|
||||||
|
}
|
||||||
} else if (inventoryPacketAdapter != null) {
|
} else if (inventoryPacketAdapter != null) {
|
||||||
inventoryPacketAdapter.unregister();
|
inventoryPacketAdapter.unregister();
|
||||||
inventoryPacketAdapter = null;
|
inventoryPacketAdapter = null;
|
||||||
}
|
}
|
||||||
if (denyTabCompleteBeforeLogin && tabCompletePacketAdapter == null) {
|
|
||||||
tabCompletePacketAdapter = new TabCompletePacketAdapter(plugin, playerCache);
|
if (denyTabCompleteBeforeLogin) {
|
||||||
tabCompletePacketAdapter.register();
|
if (tabCompletePacketAdapter == null) {
|
||||||
|
tabCompletePacketAdapter = new TabCompletePacketAdapter(plugin, playerCache);
|
||||||
|
tabCompletePacketAdapter.register();
|
||||||
|
}
|
||||||
} else if (tabCompletePacketAdapter != null) {
|
} else if (tabCompletePacketAdapter != null) {
|
||||||
tabCompletePacketAdapter.unregister();
|
tabCompletePacketAdapter.unregister();
|
||||||
tabCompletePacketAdapter = null;
|
tabCompletePacketAdapter = null;
|
||||||
@ -106,7 +111,7 @@ public class ProtocolLibService implements SettingsDependent {
|
|||||||
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
|
//it was true and will be deactivated now, so we need to restore the inventory for every player
|
||||||
if (oldProtectInventory && !protectInvBeforeLogin) {
|
if (oldProtectInventory && !protectInvBeforeLogin && inventoryPacketAdapter != null) {
|
||||||
inventoryPacketAdapter.unregister();
|
inventoryPacketAdapter.unregister();
|
||||||
for (Player onlinePlayer : bukkitService.getOnlinePlayers()) {
|
for (Player onlinePlayer : bukkitService.getOnlinePlayers()) {
|
||||||
if (!playerCache.isAuthenticated(onlinePlayer.getName())) {
|
if (!playerCache.isAuthenticated(onlinePlayer.getName())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user