#604 - Move ProtocolLib adapters to new package and add ProtocolLibService

This commit is contained in:
Gnat008 2016-06-27 15:38:43 -04:00
parent 1361174892
commit 23836cda6a
10 changed files with 188 additions and 109 deletions

View File

@ -21,13 +21,10 @@ import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.initialization.MetricsStarter; import fr.xephi.authme.initialization.MetricsStarter;
import fr.xephi.authme.listener.AuthMeBlockListener; import fr.xephi.authme.listener.AuthMeBlockListener;
import fr.xephi.authme.listener.AuthMeEntityListener; import fr.xephi.authme.listener.AuthMeEntityListener;
import fr.xephi.authme.listener.AuthMeInventoryPacketAdapter;
import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.listener.AuthMePlayerListener;
import fr.xephi.authme.listener.AuthMePlayerListener16; import fr.xephi.authme.listener.AuthMePlayerListener16;
import fr.xephi.authme.listener.AuthMePlayerListener18; import fr.xephi.authme.listener.AuthMePlayerListener18;
import fr.xephi.authme.listener.AuthMeServerListener; import fr.xephi.authme.listener.AuthMeServerListener;
import fr.xephi.authme.listener.AuthMeTabCompletePacketAdapter;
import fr.xephi.authme.listener.AuthMeTablistPacketAdapter;
import fr.xephi.authme.mail.SendMailSSL; import fr.xephi.authme.mail.SendMailSSL;
import fr.xephi.authme.output.ConsoleFilter; import fr.xephi.authme.output.ConsoleFilter;
import fr.xephi.authme.output.Log4JFilter; import fr.xephi.authme.output.Log4JFilter;
@ -121,9 +118,6 @@ public class AuthMe extends JavaPlugin {
* Private instances (mail and ProtocolLib) * Private instances (mail and ProtocolLib)
*/ */
private SendMailSSL mail; private SendMailSSL mail;
private AuthMeInventoryPacketAdapter inventoryProtector;
private AuthMeTabCompletePacketAdapter tabComplete;
private AuthMeTablistPacketAdapter tablistHider;
/** /**
* Constructor. * Constructor.
@ -260,9 +254,6 @@ public class AuthMe extends JavaPlugin {
// Set up the mail API // Set up the mail API
setupMailApi(); setupMailApi();
// Check if the ProtocolLib is available
checkProtocolLib();
// Do a backup on start // Do a backup on start
// TODO: maybe create a backup manager? // TODO: maybe create a backup manager?
new PerformBackup(this, newSettings).doBackup(PerformBackup.BackupCause.START); new PerformBackup(this, newSettings).doBackup(PerformBackup.BackupCause.START);
@ -571,41 +562,6 @@ public class AuthMe extends JavaPlugin {
logger.addFilter(new Log4JFilter()); logger.addFilter(new Log4JFilter());
} }
// Check the presence of the ProtocolLib plugin
public void checkProtocolLib() {
if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
if (newSettings.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN)) {
ConsoleLogger.showError("WARNING! The protectInventory feature requires ProtocolLib! Disabling it...");
Settings.protectInventoryBeforeLogInEnabled = false;
newSettings.setProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN, false);
newSettings.save();
}
return;
}
if (newSettings.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN) && inventoryProtector == null) {
inventoryProtector = new AuthMeInventoryPacketAdapter(this);
inventoryProtector.register();
} else if (inventoryProtector != null) {
inventoryProtector.unregister();
inventoryProtector = null;
}
if (newSettings.getProperty(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN) && tabComplete == null) {
tabComplete = new AuthMeTabCompletePacketAdapter(this);
tabComplete.register();
} else if (tabComplete != null) {
tabComplete.unregister();
tabComplete = null;
}
if (newSettings.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN) && tablistHider == null) {
tablistHider = new AuthMeTablistPacketAdapter(this, bukkitService);
tablistHider.register();
} else if (tablistHider != null) {
tablistHider.unregister();
tablistHider = null;
}
}
// Save Player Data // Save Player Data
private void savePlayer(Player player, LimboCache limboCache) { private void savePlayer(Player player, LimboCache limboCache) {
if (safeIsNpc(player) || Utils.isUnrestricted(player)) { if (safeIsNpc(player) || Utils.isUnrestricted(player)) {
@ -714,42 +670,6 @@ public class AuthMe extends JavaPlugin {
return this.mail; return this.mail;
} }
/**
* Get the ProtocolLib inventory packet adapter.
*
* @return The inventory packet adapter.
*/
public AuthMeInventoryPacketAdapter getInventoryProtector() {
return inventoryProtector;
}
/**
* Get the ProtocolLib tab complete packet adapter.
*
* @return The tab complete packet adapter.
*/
public AuthMeTabCompletePacketAdapter getTabComplete() {
return tabComplete;
}
/**
* Get the ProtocolLib tab list packet adapter.
*
* @return The tab list packet adapter.
*/
public AuthMeTablistPacketAdapter getTablistHider() {
return tablistHider;
}
/**
* Disables instances should the ProtocolLib plugin be disabled on the server.
*/
public void disableProtocolLib() {
this.inventoryProtector = null;
this.tablistHider = null;
this.tabComplete = null;
}
// ------------- // -------------
// Service getters (deprecated) // Service getters (deprecated)
// Use @Inject fields instead // Use @Inject fields instead

View File

@ -3,6 +3,7 @@ package fr.xephi.authme.listener;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.hooks.PluginHooks; import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages; import fr.xephi.authme.output.Messages;
import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PermissionsManager;
@ -34,6 +35,8 @@ public class AuthMeServerListener implements Listener {
@Inject @Inject
private SpawnLoader spawnLoader; private SpawnLoader spawnLoader;
@Inject @Inject
private ProtocolLibService protocolLibService;
@Inject
private ValidationService validationService; private ValidationService validationService;
@Inject @Inject
private PermissionsManager permissionsManager; private PermissionsManager permissionsManager;
@ -75,8 +78,8 @@ public class AuthMeServerListener implements Listener {
} }
if (pluginName.equalsIgnoreCase("ProtocolLib")) { if (pluginName.equalsIgnoreCase("ProtocolLib")) {
plugin.disableProtocolLib(); protocolLibService.disable();
ConsoleLogger.showError("ProtocolLib has been disabled, unhook packet inventory protection!"); ConsoleLogger.showError("ProtocolLib has been disabled, unhooking packet adapters!");
} }
} }
@ -103,7 +106,7 @@ public class AuthMeServerListener implements Listener {
} }
if (pluginName.equalsIgnoreCase("ProtocolLib")) { if (pluginName.equalsIgnoreCase("ProtocolLib")) {
plugin.checkProtocolLib(); protocolLibService.setup();
} }
} }
} }

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package fr.xephi.authme.listener; package fr.xephi.authme.listener.protocollib;
import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolLibrary;
@ -22,22 +22,19 @@ import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import org.apache.commons.lang.reflect.MethodUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Collections;
import java.util.logging.Level;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.apache.commons.lang.reflect.MethodUtils; import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Collections;
import java.util.logging.Level;
public class AuthMeInventoryPacketAdapter extends PacketAdapter { public class AuthMeInventoryPacketAdapter extends PacketAdapter {

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.listener; package fr.xephi.authme.listener.protocollib;
import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolLibrary;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme.listener; package fr.xephi.authme.listener.protocollib;
import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolLibrary;
@ -14,12 +14,14 @@ import com.comphenix.protocol.wrappers.PlayerInfoData;
import com.comphenix.protocol.wrappers.WrappedChatComponent; import com.comphenix.protocol.wrappers.WrappedChatComponent;
import com.comphenix.protocol.wrappers.WrappedGameProfile; import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
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.cache.auth.PlayerCache;
import fr.xephi.authme.util.BukkitService; import fr.xephi.authme.util.BukkitService;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import javax.inject.Inject;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
@ -27,11 +29,6 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
import javax.inject.Inject;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class AuthMeTablistPacketAdapter extends PacketAdapter { public class AuthMeTablistPacketAdapter extends PacketAdapter {
private final BukkitService bukkitService; private final BukkitService bukkitService;

View File

@ -0,0 +1,146 @@
package fr.xephi.authme.listener.protocollib;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.initialization.SettingsDependent;
import fr.xephi.authme.settings.NewSetting;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.util.BukkitService;
import org.bukkit.entity.Player;
import javax.inject.Inject;
public class ProtocolLibService implements SettingsDependent {
/* Packet Adapters */
private AuthMeInventoryPacketAdapter inventoryPacketAdapter;
private AuthMeTabCompletePacketAdapter tabCompletePacketAdapter;
private AuthMeTablistPacketAdapter tablistPacketAdapter;
/* Settings */
private boolean protectInvBeforeLogin;
private boolean denyTabCompleteBeforeLogin;
private boolean hideTablistBeforeLogin;
/* Service */
private boolean isEnabled;
private AuthMe plugin;
private BukkitService bukkitService;
@Inject
ProtocolLibService(AuthMe plugin, BukkitService bukkitService, NewSetting settings) {
this.plugin = plugin;
this.bukkitService = bukkitService;
loadSettings(settings);
setup();
}
/**
* Set up the ProtocolLib packet adapters.
*/
public void setup() {
// Check if ProtocolLib is enabled on the server.
if (!plugin.getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
if (protectInvBeforeLogin) {
ConsoleLogger.showError("WARNING! The protectInventory feature requires ProtocolLib! Disabling it...");
}
if (denyTabCompleteBeforeLogin) {
ConsoleLogger.showError("WARNING! The denyTabComplete feature requires ProtocolLib! Disabling it...");
}
if (hideTablistBeforeLogin) {
ConsoleLogger.showError("WARNING! The hideTablist feature requires ProtocolLib! Disabling it...");
}
this.isEnabled = false;
return;
}
// Set up packet adapters
if (protectInvBeforeLogin && inventoryPacketAdapter == null) {
inventoryPacketAdapter = new AuthMeInventoryPacketAdapter(plugin);
inventoryPacketAdapter.register();
} else if (inventoryPacketAdapter != null) {
inventoryPacketAdapter.unregister();
inventoryPacketAdapter = null;
}
if (denyTabCompleteBeforeLogin && tabCompletePacketAdapter == null) {
tabCompletePacketAdapter = new AuthMeTabCompletePacketAdapter(plugin);
tabCompletePacketAdapter.register();
} else if (tabCompletePacketAdapter != null) {
tabCompletePacketAdapter.unregister();
tabCompletePacketAdapter = null;
}
if (hideTablistBeforeLogin && tablistPacketAdapter == null) {
tablistPacketAdapter = new AuthMeTablistPacketAdapter(plugin, bukkitService);
tablistPacketAdapter.register();
} else if (tablistPacketAdapter != null) {
tablistPacketAdapter.unregister();
tablistPacketAdapter = null;
}
this.isEnabled = true;
}
public void disable() {
isEnabled = false;
if (inventoryPacketAdapter != null) {
inventoryPacketAdapter.unregister();
inventoryPacketAdapter = null;
}
if (tabCompletePacketAdapter != null) {
tabCompletePacketAdapter.unregister();
tabCompletePacketAdapter = null;
}
if (tablistPacketAdapter != null) {
tablistPacketAdapter.unregister();
tablistPacketAdapter = null;
}
}
/**
* Send a packet to the player to give them an inventory.
*
* @param player The player to send the packet to.
*/
public void sendInventoryPacket(Player player) {
if (!isEnabled || inventoryPacketAdapter == null) {
return;
}
inventoryPacketAdapter.sendInventoryPacket(player);
}
/**
* Send a packet to the player to give them a blank inventory.
*
* @param player The player to send the packet to.
*/
public void sendBlankInventoryPacket(Player player) {
if (!isEnabled || inventoryPacketAdapter == null) {
return;
}
inventoryPacketAdapter.sendBlankInventoryPacket(player);
}
/**
* Send a tab list packet to a player.
*
* @param player The player to send the packet to.
*/
public void sendTabList(Player player) {
if (!isEnabled || tablistPacketAdapter == null) {
return;
}
tablistPacketAdapter.sendTablist(player);
}
@Override
public void loadSettings(NewSetting settings) {
this.protectInvBeforeLogin = settings.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN);
this.denyTabCompleteBeforeLogin = settings.getProperty(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN);
this.hideTablistBeforeLogin = settings.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN);
}
}

View File

@ -9,6 +9,7 @@ import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.ProtectInventoryEvent; import fr.xephi.authme.events.ProtectInventoryEvent;
import fr.xephi.authme.hooks.PluginHooks; import fr.xephi.authme.hooks.PluginHooks;
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.permission.AuthGroupType; import fr.xephi.authme.permission.AuthGroupType;
import fr.xephi.authme.permission.PlayerStatePermission; import fr.xephi.authme.permission.PlayerStatePermission;
@ -68,6 +69,9 @@ public class AsynchronousJoin implements AsynchronousProcess {
@Inject @Inject
private BukkitService bukkitService; private BukkitService bukkitService;
@Inject
private ProtocolLibService protocolLibService;
@Inject @Inject
private LimboPlayerTaskManager limboPlayerTaskManager; private LimboPlayerTaskManager limboPlayerTaskManager;
@ -126,11 +130,11 @@ public class AsynchronousJoin implements AsynchronousProcess {
limboCache.updateLimboPlayer(player); limboCache.updateLimboPlayer(player);
// Protect inventory // Protect inventory
if (service.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN) && plugin.getInventoryProtector() != null) { if (service.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) {
ProtectInventoryEvent ev = new ProtectInventoryEvent(player); ProtectInventoryEvent ev = new ProtectInventoryEvent(player);
bukkitService.callEvent(ev); bukkitService.callEvent(ev);
if (ev.isCancelled()) { if (ev.isCancelled()) {
plugin.getInventoryProtector().sendInventoryPacket(player); protocolLibService.sendInventoryPacket(player);
if (!service.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) { if (!service.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + "..."); ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + "...");
} }

View File

@ -10,6 +10,7 @@ import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.LoginEvent; import fr.xephi.authme.events.LoginEvent;
import fr.xephi.authme.events.RestoreInventoryEvent; import fr.xephi.authme.events.RestoreInventoryEvent;
import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.listener.AuthMePlayerListener;
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
import fr.xephi.authme.permission.AuthGroupType; import fr.xephi.authme.permission.AuthGroupType;
import fr.xephi.authme.process.ProcessService; import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.process.SynchronousProcess; import fr.xephi.authme.process.SynchronousProcess;
@ -50,6 +51,9 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
@Inject @Inject
private BukkitService bukkitService; private BukkitService bukkitService;
@Inject
private ProtocolLibService protocolLibService;
@Inject @Inject
private PluginManager pluginManager; private PluginManager pluginManager;
@ -106,8 +110,8 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
restoreInventory(player); restoreInventory(player);
} }
if (service.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN) && plugin.getTablistHider() != null) { if (service.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN)) {
plugin.getTablistHider().sendTablist(player); protocolLibService.sendTabList(player);
} }
// Clean up no longer used temporary data // Clean up no longer used temporary data

View File

@ -6,6 +6,7 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.SessionManager; import fr.xephi.authme.cache.SessionManager;
import fr.xephi.authme.events.LogoutEvent; import fr.xephi.authme.events.LogoutEvent;
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.process.ProcessService; import fr.xephi.authme.process.ProcessService;
import fr.xephi.authme.process.SynchronousProcess; import fr.xephi.authme.process.SynchronousProcess;
@ -34,6 +35,9 @@ public class ProcessSynchronousPlayerLogout implements SynchronousProcess {
@Inject @Inject
private BukkitService bukkitService; private BukkitService bukkitService;
@Inject
private ProtocolLibService protocolLibService;
@Inject @Inject
private LimboPlayerTaskManager limboPlayerTaskManager; private LimboPlayerTaskManager limboPlayerTaskManager;
@ -66,7 +70,7 @@ public class ProcessSynchronousPlayerLogout implements SynchronousProcess {
sessionManager.cancelSession(name); sessionManager.cancelSession(name);
} }
if (service.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN)) { if (service.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN)) {
plugin.getInventoryProtector().sendBlankInventoryPacket(player); protocolLibService.sendBlankInventoryPacket(player);
} }
limboPlayerTaskManager.registerTimeoutTask(player); limboPlayerTaskManager.registerTimeoutTask(player);

View File

@ -8,6 +8,7 @@ import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.cache.limbo.LimboPlayer;
import fr.xephi.authme.events.LoginEvent; import fr.xephi.authme.events.LoginEvent;
import fr.xephi.authme.events.RestoreInventoryEvent; import fr.xephi.authme.events.RestoreInventoryEvent;
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.permission.AuthGroupType; import fr.xephi.authme.permission.AuthGroupType;
import fr.xephi.authme.process.ProcessService; import fr.xephi.authme.process.ProcessService;
@ -42,6 +43,9 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
@Inject @Inject
private BukkitService bukkitService; private BukkitService bukkitService;
@Inject
private ProtocolLibService protocolLibService;
@Inject @Inject
private LimboCache limboCache; private LimboCache limboCache;
@ -92,17 +96,17 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
final String name = player.getName().toLowerCase(); final String name = player.getName().toLowerCase();
LimboPlayer limbo = limboCache.getLimboPlayer(name); LimboPlayer limbo = limboCache.getLimboPlayer(name);
if (limbo != null) { if (limbo != null) {
if (service.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN) && plugin.getTablistHider() != null) { if (service.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN)) {
plugin.getTablistHider().sendTablist(player); protocolLibService.sendTabList(player);
} }
Utils.teleportToSpawn(player); Utils.teleportToSpawn(player);
if (service.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN) && plugin.getInventoryProtector() != null) { if (service.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) {
RestoreInventoryEvent event = new RestoreInventoryEvent(player); RestoreInventoryEvent event = new RestoreInventoryEvent(player);
bukkitService.callEvent(event); bukkitService.callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
plugin.getInventoryProtector().sendInventoryPacket(player); protocolLibService.sendInventoryPacket(player);
} }
} }