diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitSessionManager.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitSessionManager.java index 4db0f4b3..6fee1f11 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitSessionManager.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitSessionManager.java @@ -1,5 +1,6 @@ package com.github.games647.fastlogin.bukkit; +import com.github.games647.fastlogin.bukkit.auth.BukkitLoginSession; import com.github.games647.fastlogin.core.SessionManager; import java.net.InetSocketAddress; diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java index 0439b70e..03a55720 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java @@ -1,6 +1,6 @@ package com.github.games647.fastlogin.bukkit; -import com.github.games647.fastlogin.bukkit.auth.bungee.BungeeManager; +import com.github.games647.fastlogin.bukkit.auth.proxy.ProxyManager; import com.github.games647.fastlogin.bukkit.auth.protocollib.ProtocolLibListener; import com.github.games647.fastlogin.bukkit.auth.protocolsupport.ProtocolSupportListener; import com.github.games647.fastlogin.bukkit.command.CrackedCommand; @@ -40,7 +40,7 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin proxyIds; private final FastLoginBukkit plugin; @@ -38,7 +38,7 @@ public class BungeeManager { private final Set firedJoinEvents = new HashSet<>(); - public BungeeManager(FastLoginBukkit plugin) { + public ProxyManager(FastLoginBukkit plugin) { this.plugin = plugin; } @@ -63,23 +63,23 @@ public class BungeeManager { public void initialize() { try { - enabled = detectBungeeCord(); + enabled = detectProxy(); } catch (Exception ex) { - plugin.getLog().warn("Cannot check bungeecord support. Fallback to non-bungee mode", ex); + plugin.getLog().warn("Cannot check proxy support. Fallback to non-proxy mode", ex); } if (enabled) { - proxyIds = loadBungeeCordIds(); + proxyIds = loadProxyIds(); registerPluginChannels(); } } - private boolean detectBungeeCord() throws Exception { + private boolean detectProxy() throws Exception { try { enabled = Class.forName("org.spigotmc.SpigotConfig").getDeclaredField("bungee").getBoolean(null); return enabled; } catch (ClassNotFoundException notFoundEx) { - //ignore server has no bungee support + //ignore server has no proxy support return false; } catch (Exception ex) { throw ex; @@ -89,10 +89,10 @@ public class BungeeManager { private void registerPluginChannels() { Server server = Bukkit.getServer(); - // check for incoming messages from the bungeecord version of this plugin + // check for incoming messages from the proxy version of this plugin String groupId = plugin.getName(); String forceChannel = NamespaceKey.getCombined(groupId, LoginActionMessage.FORCE_CHANNEL); - server.getMessenger().registerIncomingPluginChannel(plugin, forceChannel, new BungeeMessagingListener(plugin)); + server.getMessenger().registerIncomingPluginChannel(plugin, forceChannel, new ProxyMessagingListener(plugin)); // outgoing String successChannel = new NamespaceKey(groupId, SUCCESS_CHANNEL).getCombinedName(); @@ -101,7 +101,7 @@ public class BungeeManager { server.getMessenger().registerOutgoingPluginChannel(plugin, changeChannel); } - private Set loadBungeeCordIds() { + private Set loadProxyIds() { Path proxiesFile = plugin.getPluginFolder().resolve(FILE_NAME); Path legacyFile = plugin.getPluginFolder().resolve(LEGACY_FILE_NAME); try { @@ -124,7 +124,7 @@ public class BungeeManager { } catch (IOException ex) { plugin.getLog().error("Failed to read proxies", ex); } catch (Exception ex) { - plugin.getLog().error("Failed to retrieve proxy Id. Disabling BungeeCord support", ex); + plugin.getLog().error("Failed to retrieve proxy Id. Disabling proxy support", ex); } return Collections.emptySet(); @@ -145,7 +145,7 @@ public class BungeeManager { /** * Check if the event fired including with the task delay. This necessary to restore the order of processing the - * BungeeCord messages after the PlayerJoinEvent fires including the delay. + * proxy messages after the PlayerJoinEvent fires including the delay. * * If the join event fired, the delay exceeded, but it ran earlier and couldn't find the recently started login * session. If not fired, we can start a new force login task. This will still match the requirement that we wait diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/bungee/BungeeMessagingListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyMessagingListener.java similarity index 87% rename from bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/bungee/BungeeMessagingListener.java rename to bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyMessagingListener.java index 72d91511..5b8725f5 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/bungee/BungeeMessagingListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyMessagingListener.java @@ -1,6 +1,6 @@ -package com.github.games647.fastlogin.bukkit.auth.bungee; +package com.github.games647.fastlogin.bukkit.auth.proxy; -import com.github.games647.fastlogin.bukkit.BukkitLoginSession; +import com.github.games647.fastlogin.bukkit.auth.BukkitLoginSession; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; import com.github.games647.fastlogin.bukkit.ForceLoginTask; import com.github.games647.fastlogin.core.PremiumStatus; @@ -18,16 +18,16 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; /** - * Responsible for receiving messages from a BungeeCord instance. + * Responsible for receiving messages from a proxy instance. * - * This class also receives the plugin message from the bungeecord version of this plugin in order to get notified if + * This class also receives the plugin message from the proxy version of this plugin in order to get notified if * the connection is in online mode. */ -public class BungeeMessagingListener implements PluginMessageListener { +public class ProxyMessagingListener implements PluginMessageListener { private final FastLoginBukkit plugin; - protected BungeeMessagingListener(FastLoginBukkit plugin) { + protected ProxyMessagingListener(FastLoginBukkit plugin) { this.plugin = plugin; } @@ -50,12 +50,12 @@ public class BungeeMessagingListener implements PluginMessageListener { return; } - // fail if target player is blocked because already authenticated or wrong bungeecord id + // fail if target player is blocked because already authenticated or wrong proxy id if (targetPlayer.hasMetadata(plugin.getName())) { plugin.getLog().warn("Received message {} from a blocked player {}", loginMessage, targetPlayer); } else { UUID sourceId = loginMessage.getProxyId(); - if (plugin.getBungeeManager().isProxyAllowed(sourceId)) { + if (plugin.getProxyManager().isProxyAllowed(sourceId)) { readMessage(targetPlayer, loginMessage); } else { plugin.getLog().warn("Received proxy id: {} that doesn't exist in the proxy file", sourceId); @@ -104,7 +104,7 @@ public class BungeeMessagingListener implements PluginMessageListener { plugin.getSessionManager().startLoginSession(player.getAddress(), session); // only start a new login task if the join event fired earlier. This event then didn - boolean result = plugin.getBungeeManager().didJoinEventFired(player); + boolean result = plugin.getProxyManager().didJoinEventFired(player); plugin.getLog().info("Delaying force login until join event fired?: {}", result); if (result) { Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session); diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/CrackedCommand.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/CrackedCommand.java index 7e16d2d7..125e81f1 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/CrackedCommand.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/CrackedCommand.java @@ -35,8 +35,8 @@ public class CrackedCommand extends ToggleCommand { return; } - if (plugin.getBungeeManager().isEnabled()) { - sendBungeeActivateMessage(sender, sender.getName(), false); + if (plugin.getProxyManager().isEnabled()) { + sendProxyActivateMessage(sender, sender.getName(), false); plugin.getCore().sendLocaleMessage("wait-on-proxy", sender); } else { //todo: load async if @@ -89,6 +89,6 @@ public class CrackedCommand extends ToggleCommand { } private boolean forwardCrackedCommand(CommandSender sender, String target) { - return forwardBungeeCommand(sender, target, false); + return forwardProxyCommand(sender, target, false); } } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/PremiumCommand.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/PremiumCommand.java index 2c95393f..5ab7a544 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/PremiumCommand.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/PremiumCommand.java @@ -2,11 +2,11 @@ package com.github.games647.fastlogin.bukkit.command; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; import com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPremiumToggleEvent; +import com.github.games647.fastlogin.core.shared.event.FastLoginPremiumToggleEvent.PremiumToggleReason; import com.github.games647.fastlogin.core.storage.StoredProfile; import java.util.UUID; -import com.github.games647.fastlogin.core.shared.event.FastLoginPremiumToggleEvent.PremiumToggleReason; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -99,6 +99,6 @@ public class PremiumCommand extends ToggleCommand { } private boolean forwardPremiumCommand(CommandSender sender, String target) { - return forwardBungeeCommand(sender, target, true); + return forwardProxyCommand(sender, target, true); } } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/ToggleCommand.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/ToggleCommand.java index 427bd655..09e4e064 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/ToggleCommand.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/ToggleCommand.java @@ -30,9 +30,9 @@ public abstract class ToggleCommand implements CommandExecutor { return true; } - protected boolean forwardBungeeCommand(CommandSender sender, String target, boolean activate) { - if (plugin.getBungeeManager().isEnabled()) { - sendBungeeActivateMessage(sender, target, activate); + protected boolean forwardProxyCommand(CommandSender sender, String target, boolean activate) { + if (plugin.getProxyManager().isEnabled()) { + sendProxyActivateMessage(sender, target, activate); plugin.getCore().sendLocaleMessage("wait-on-proxy", sender); return true; } @@ -50,10 +50,10 @@ public abstract class ToggleCommand implements CommandExecutor { return true; } - protected void sendBungeeActivateMessage(CommandSender invoker, String target, boolean activate) { + protected void sendProxyActivateMessage(CommandSender invoker, String target, boolean activate) { if (invoker instanceof PluginMessageRecipient) { ChannelMessage message = new ChangePremiumMessage(target, activate, true); - plugin.getBungeeManager().sendPluginMessage((PluginMessageRecipient) invoker, message); + plugin.getProxyManager().sendPluginMessage((PluginMessageRecipient) invoker, message); } else { Optional optPlayer = Bukkit.getServer().getOnlinePlayers().stream().findFirst(); if (!optPlayer.isPresent()) { @@ -63,7 +63,7 @@ public abstract class ToggleCommand implements CommandExecutor { Player sender = optPlayer.get(); ChannelMessage message = new ChangePremiumMessage(target, activate, false); - plugin.getBungeeManager().sendPluginMessage(sender, message); + plugin.getProxyManager().sendPluginMessage(sender, message); } } } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hook/DelayedAuthHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hook/DelayedAuthHook.java index 1fab0dce..a82d8f2e 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hook/DelayedAuthHook.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hook/DelayedAuthHook.java @@ -22,12 +22,12 @@ public class DelayedAuthHook implements Runnable { @Override public void run() { boolean hookFound = isHookFound(); - if (plugin.getBungeeManager().isEnabled()) { - plugin.getLog().info("BungeeCord setting detected. No auth plugin is required"); + if (plugin.getProxyManager().isEnabled()) { + plugin.getLog().info("Proxy setting detected. No auth plugin is required"); } else if (!hookFound) { plugin.getLog().warn("No auth plugin were found by this plugin " + "(other plugins could hook into this after the initialization of this plugin)" - + "and BungeeCord is deactivated. " + + "and BungeeCord (or similar proxies) is deactivated. " + "Either one or both of the checks have to pass in order to use this plugin"); } } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java index 87b137f0..80c2d40b 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java @@ -1,6 +1,6 @@ package com.github.games647.fastlogin.bukkit.listener; -import com.github.games647.fastlogin.bukkit.BukkitLoginSession; +import com.github.games647.fastlogin.bukkit.auth.BukkitLoginSession; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; import com.github.games647.fastlogin.bukkit.ForceLoginTask; @@ -38,7 +38,7 @@ public class ConnectionListener implements Listener { Bukkit.getScheduler().runTaskLater(plugin, () -> { // session exists so the player is ready for force login - // cases: Paper (firing BungeeCord message before PlayerJoinEvent) or not running BungeeCord and already + // cases: Paper (firing proxy message before PlayerJoinEvent) or not running proxy and already // having the login session from the login process BukkitLoginSession session = plugin.getSessionManager().getLoginSession(player.getAddress()); if (session != null) { @@ -46,7 +46,7 @@ public class ConnectionListener implements Listener { Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask); } - plugin.getBungeeManager().markJoinEventFired(player); + plugin.getProxyManager().markJoinEventFired(player); // delay the login process to let auth plugins initialize the player // Magic number however as there is no direct event from those plugins }, DELAY_LOGIN); @@ -59,7 +59,7 @@ public class ConnectionListener implements Listener { removeBlockedStatus(player); plugin.getCore().getPendingConfirms().remove(player.getUniqueId()); plugin.getPremiumPlayers().remove(player.getUniqueId()); - plugin.getBungeeManager().cleanup(player); + plugin.getProxyManager().cleanup(player); } private void removeBlockedStatus(Player player) { diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperPreLoginListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperPreLoginListener.java index f27a604a..b256b8d7 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperPreLoginListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperPreLoginListener.java @@ -2,7 +2,7 @@ package com.github.games647.fastlogin.bukkit.listener; import com.destroystokyo.paper.profile.ProfileProperty; import com.github.games647.craftapi.model.skin.Textures; -import com.github.games647.fastlogin.bukkit.BukkitLoginSession; +import com.github.games647.fastlogin.bukkit.auth.BukkitLoginSession; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; import org.bukkit.event.EventHandler;