mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-09-16 08:57:59 +02:00
more ProtocolLib reload support.
This commit is contained in:
parent
fd12efa2c0
commit
757f231ceb
@ -677,13 +677,19 @@ public class AuthMe extends JavaPlugin {
|
||||
inventoryProtector.unregister();
|
||||
inventoryProtector = null;
|
||||
}
|
||||
if (tabComplete == null && newSettings.getProperty(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN)) {
|
||||
if (newSettings.getProperty(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN) && tabComplete == null) {
|
||||
tabComplete = new AuthMeTabCompletePacketAdapter(this);
|
||||
tabComplete.register();
|
||||
} else if (inventoryProtector != null) {
|
||||
tabComplete.unregister();
|
||||
tabComplete = null;
|
||||
}
|
||||
if (tablistHider == null && newSettings.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN)) {
|
||||
if (newSettings.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN) && tablistHider == null) {
|
||||
tablistHider = new AuthMeTablistPacketAdapter(this);
|
||||
tablistHider.register();
|
||||
} else if (inventoryProtector != null) {
|
||||
tablistHider.unregister();
|
||||
tablistHider = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,8 @@ public class AuthMeServerListener implements Listener {
|
||||
}
|
||||
if (pluginName.equalsIgnoreCase("ProtocolLib")) {
|
||||
plugin.inventoryProtector = null;
|
||||
plugin.tablistHider = null;
|
||||
plugin.tabComplete = null;
|
||||
ConsoleLogger.showError("ProtocolLib has been disabled, unhook packet inventory protection!");
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.reflect.FieldAccessException;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
@ -18,17 +17,13 @@ public class AuthMeTabCompletePacketAdapter extends PacketAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event)
|
||||
{
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
if (!PlayerCache.getInstance().isAuthenticated(event.getPlayer().getName().toLowerCase())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
catch (FieldAccessException e)
|
||||
{
|
||||
} catch (FieldAccessException e) {
|
||||
ConsoleLogger.showError("Couldn't access field.");
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.reflect.FieldAccessException;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
@ -18,17 +17,13 @@ public class AuthMeTablistPacketAdapter extends PacketAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event)
|
||||
{
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
if (!PlayerCache.getInstance().isAuthenticated(event.getPlayer().getName().toLowerCase())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
catch (FieldAccessException e)
|
||||
{
|
||||
} catch (FieldAccessException e) {
|
||||
ConsoleLogger.showError("Couldn't access field.");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user