Configurable send delay
This commit is contained in:
parent
73c1116047
commit
54cef57ea5
@ -19,6 +19,7 @@ import fr.xephi.authme.service.bungeecord.BungeeSender;
|
|||||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||||
import fr.xephi.authme.service.velocity.VMessageType;
|
import fr.xephi.authme.service.velocity.VMessageType;
|
||||||
import fr.xephi.authme.service.velocity.VelocitySender;
|
import fr.xephi.authme.service.velocity.VelocitySender;
|
||||||
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
||||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
@ -47,6 +48,9 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private Server server;
|
private Server server;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Settings settings;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private DataSource database;
|
private DataSource database;
|
||||||
|
|
||||||
@ -157,11 +161,11 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
|||||||
// As described at https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
|
// As described at https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
|
||||||
// "Keep in mind that you can't send plugin messages directly after a player joins."
|
// "Keep in mind that you can't send plugin messages directly after a player joins."
|
||||||
bukkitService.scheduleSyncDelayedTask(() ->
|
bukkitService.scheduleSyncDelayedTask(() ->
|
||||||
bungeeSender.sendAuthMeBungeecordMessage(player, MessageType.LOGIN), 5L);
|
bungeeSender.sendAuthMeBungeecordMessage(player, MessageType.LOGIN), settings.getProperty(HooksSettings.PROXY_SEND_DELAY));
|
||||||
}
|
}
|
||||||
if (velocitySender.isEnabled()) {
|
if (velocitySender.isEnabled()) {
|
||||||
bukkitService.scheduleSyncDelayedTask(() ->
|
bukkitService.scheduleSyncDelayedTask(() ->
|
||||||
velocitySender.sendAuthMeVelocityMessage(player, VMessageType.LOGIN), 10L);
|
velocitySender.sendAuthMeVelocityMessage(player, VMessageType.LOGIN), settings.getProperty(HooksSettings.PROXY_SEND_DELAY));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import fr.xephi.authme.service.bungeecord.BungeeSender;
|
|||||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||||
import fr.xephi.authme.service.velocity.VMessageType;
|
import fr.xephi.authme.service.velocity.VMessageType;
|
||||||
import fr.xephi.authme.service.velocity.VelocitySender;
|
import fr.xephi.authme.service.velocity.VelocitySender;
|
||||||
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
@ -83,7 +84,8 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SessionService sessionService;
|
private SessionService sessionService;
|
||||||
|
@Inject
|
||||||
|
private Settings settings;
|
||||||
@Inject
|
@Inject
|
||||||
private BungeeSender bungeeSender;
|
private BungeeSender bungeeSender;
|
||||||
@Inject
|
@Inject
|
||||||
@ -310,11 +312,11 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
|||||||
// As described at https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
|
// As described at https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
|
||||||
// "Keep in mind that you can't send plugin messages directly after a player joins."
|
// "Keep in mind that you can't send plugin messages directly after a player joins."
|
||||||
bukkitService.scheduleSyncDelayedTask(() ->
|
bukkitService.scheduleSyncDelayedTask(() ->
|
||||||
bungeeSender.sendAuthMeBungeecordMessage(player, MessageType.LOGIN), 5L);
|
bungeeSender.sendAuthMeBungeecordMessage(player, MessageType.LOGIN), settings.getProperty(HooksSettings.PROXY_SEND_DELAY));
|
||||||
}
|
}
|
||||||
if (velocitySender.isEnabled()) {
|
if (velocitySender.isEnabled()) {
|
||||||
bukkitService.scheduleSyncDelayedTask(() ->
|
bukkitService.scheduleSyncDelayedTask(() ->
|
||||||
velocitySender.sendAuthMeVelocityMessage(player, VMessageType.LOGIN), 10L);
|
velocitySender.sendAuthMeVelocityMessage(player, VMessageType.LOGIN), settings.getProperty(HooksSettings.PROXY_SEND_DELAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
// As the scheduling executes the Task most likely after the current
|
// As the scheduling executes the Task most likely after the current
|
||||||
|
|||||||
@ -22,6 +22,12 @@ public final class HooksSettings implements SettingsHolder {
|
|||||||
public static final Property<Boolean> VELOCITY =
|
public static final Property<Boolean> VELOCITY =
|
||||||
newProperty("Hooks.velocity", false);
|
newProperty("Hooks.velocity", false);
|
||||||
|
|
||||||
|
@Comment({"How many ticks should we wait before sending login info to proxy?",
|
||||||
|
"Change this to higher if your player has high ping.",
|
||||||
|
"See: https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/"})
|
||||||
|
public static final Property<Long> PROXY_SEND_DELAY =
|
||||||
|
newProperty("Hooks.proxySendDelay", 10L);
|
||||||
|
|
||||||
@Comment({"Hook into floodgate.",
|
@Comment({"Hook into floodgate.",
|
||||||
"This must be true if you want to use other bedrock features."
|
"This must be true if you want to use other bedrock features."
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user