Merge branch 'master' of https://github.com/AuthMe-Team/AuthMeReloaded into 358-encryptn-mthd-refactor

This commit is contained in:
ljacqu 2015-12-30 13:53:53 +01:00
commit ce6951bcfe
3 changed files with 52 additions and 3 deletions

View File

@ -31,6 +31,7 @@ import fr.xephi.authme.listener.AuthMePlayerListener16;
import fr.xephi.authme.listener.AuthMePlayerListener18;
import fr.xephi.authme.listener.AuthMeServerListener;
import fr.xephi.authme.listener.AuthMeServerStop;
import fr.xephi.authme.listener.AuthMeTabCompletePacketAdapter;
import fr.xephi.authme.mail.SendMailSSL;
import fr.xephi.authme.modules.ModuleManager;
import fr.xephi.authme.output.ConsoleFilter;
@ -119,6 +120,7 @@ public class AuthMe extends JavaPlugin {
public MultiverseCore multiverse;
public CombatTagPlus combatTagPlus;
public AuthMeInventoryPacketAdapter inventoryProtector;
public AuthMeTabCompletePacketAdapter tabComplete;
/*
* Maps and stuff
@ -708,6 +710,11 @@ public class AuthMe extends JavaPlugin {
inventoryProtector = null;
}
}
if (tabComplete == null)
{
tabComplete = new AuthMeTabCompletePacketAdapter(this);
tabComplete.register();
}
}
// Save Player Data

View File

@ -0,0 +1,45 @@
package fr.xephi.authme.listener;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
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;
public class AuthMeTabCompletePacketAdapter extends PacketAdapter {
public AuthMeTabCompletePacketAdapter(AuthMe plugin) {
super(plugin, ListenerPriority.NORMAL, PacketType.Play.Client.TAB_COMPLETE);
}
@Override
public void onPacketReceiving(PacketEvent event)
{
if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE) {
try
{
String message = ((String)event.getPacket().getSpecificModifier(String.class).read(0)).toLowerCase();
if ((message.startsWith("")) && (!message.contains(" ")) && !PlayerCache.getInstance().isAuthenticated(event.getPlayer().getName().toLowerCase())) {
event.setCancelled(true);
}
}
catch (FieldAccessException e)
{
ConsoleLogger.showError("Couldn't access field.");
}
}
}
public void register() {
ProtocolLibrary.getProtocolManager().addPacketListener(this);
}
public void unregister() {
ProtocolLibrary.getProtocolManager().removePacketListener(this);
}
}

View File

@ -8,9 +8,6 @@ TimVisee - Developer
games647 - Developer
Gabriele C. (sgdc3) - Project Manager, Contributor
AuthMeBridge staff:
CryLegend - Main developer, We need to contact him!
Retired staff:
Maxetto - Ticket Manager, IT translator
darkwarriors (d4rkwarriors) - Original AuthMeReloaded Author (Inactive)