Hide tablist feature
This commit is contained in:
parent
dd8795a1bf
commit
131cc22248
@ -60,6 +60,7 @@ import fr.xephi.authme.listener.AuthMePlayerListener16;
|
||||
import fr.xephi.authme.listener.AuthMePlayerListener18;
|
||||
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.output.ConsoleFilter;
|
||||
import fr.xephi.authme.output.Log4JFilter;
|
||||
@ -132,6 +133,7 @@ public class AuthMe extends JavaPlugin {
|
||||
public CombatTagPlus combatTagPlus;
|
||||
public AuthMeInventoryPacketAdapter inventoryProtector;
|
||||
public AuthMeTabCompletePacketAdapter tabComplete;
|
||||
public AuthMeTablistPacketAdapter tablistHider;
|
||||
|
||||
/*
|
||||
* Maps and stuff
|
||||
@ -664,10 +666,14 @@ public class AuthMe extends JavaPlugin {
|
||||
inventoryProtector.unregister();
|
||||
inventoryProtector = null;
|
||||
}
|
||||
if (tabComplete == null) {
|
||||
if (tabComplete == null && newSettings.getProperty(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN)) {
|
||||
tabComplete = new AuthMeTabCompletePacketAdapter(this);
|
||||
tabComplete.register();
|
||||
}
|
||||
if (tablistHider == null && newSettings.getProperty(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN)) {
|
||||
tablistHider = new AuthMeTablistPacketAdapter(this);
|
||||
tablistHider.register();
|
||||
}
|
||||
}
|
||||
|
||||
// Save Player Data
|
||||
|
||||
@ -202,7 +202,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (joinMsg == null) {
|
||||
return;
|
||||
}
|
||||
event.setJoinMessage(null);
|
||||
event.setJoinMessage((String)null);
|
||||
joinMessage.put(name, joinMsg);
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if (Settings.delayJoinLeaveMessages && !Utils.checkAuth(player)) {
|
||||
event.setQuitMessage(null);
|
||||
event.setQuitMessage((String)null);
|
||||
}
|
||||
|
||||
plugin.getManagement().performQuit(player, false);
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
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 AuthMeTablistPacketAdapter extends PacketAdapter {
|
||||
|
||||
public AuthMeTablistPacketAdapter(AuthMe plugin) {
|
||||
super(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.PLAYER_INFO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event)
|
||||
{
|
||||
if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {
|
||||
try
|
||||
{
|
||||
if (!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);
|
||||
}
|
||||
}
|
||||
@ -126,10 +126,18 @@ public class RestrictionSettings implements SettingsClass {
|
||||
public static final Property<Boolean> ENABLE_PASSWORD_CONFIRMATION =
|
||||
newProperty("settings.restrictions.enablePasswordConfirmation", true);
|
||||
|
||||
@Comment("Should we protect the player inventory before logging in?")
|
||||
@Comment("Should we protect the player inventory before logging in? Requires ProtocolLib.")
|
||||
public static final Property<Boolean> PROTECT_INVENTORY_BEFORE_LOGIN =
|
||||
newProperty("settings.restrictions.ProtectInventoryBeforeLogIn", true);
|
||||
|
||||
@Comment("Should we deny the tabcomplete feature before logging in? Requires ProtocolLib.")
|
||||
public static final Property<Boolean> DENY_TABCOMPLETE_BEFORE_LOGIN =
|
||||
newProperty("settings.restrictions.DenyTabcompleteBeforeLogin", true);
|
||||
|
||||
@Comment("Should we hide the tablist before logging in? Requires ProtocolLib.")
|
||||
public static final Property<Boolean> HIDE_TABLIST_BEFORE_LOGIN =
|
||||
newProperty("settings.restrictions.HideTablistBeforeLogin", true);
|
||||
|
||||
@Comment({
|
||||
"Should we display all other accounts from a player when he joins?",
|
||||
"permission: /authme.admin.accounts"})
|
||||
|
||||
@ -132,8 +132,12 @@ settings:
|
||||
# when it's true, registration require that kind of command:
|
||||
# /register <password> <confirmPassword>
|
||||
enablePasswordConfirmation: true
|
||||
# Should we protect the player inventory before logging in?
|
||||
# Should we protect the player inventory before logging in? Requires ProtocolLib.
|
||||
ProtectInventoryBeforeLogIn: true
|
||||
# Should we deny the tabcomplete feature before logging in? Requires ProtocolLib.
|
||||
DenyTabcompleteBeforeLogIn: true
|
||||
# Should we hide the tablist before logging in? Requires ProtocolLib.
|
||||
HideTablistBeforeLogIn: true
|
||||
# Should we display all other accounts from a player when he joins?
|
||||
# permission: /authme.admin.accounts
|
||||
displayOtherAccounts: true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user