Velocity queueing solution
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Tell the backend server when a player is waiting to allow proactive freeing of slots

James Lyne ec6c1739 67cdaa74

+15
+13
src/main/java/uk/co/notnull/proxyqueues/ProxyQueuesImpl.java
··· 35 35 import com.velocitypowered.api.event.ResultedEvent; 36 36 import com.velocitypowered.api.event.Subscribe; 37 37 import com.velocitypowered.api.event.connection.LoginEvent; 38 + import com.velocitypowered.api.event.connection.PluginMessageEvent; 38 39 import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; 39 40 import com.velocitypowered.api.plugin.annotation.DataDirectory; 40 41 import com.velocitypowered.api.proxy.ProxyServer; 42 + import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; 41 43 import com.velocitypowered.api.proxy.server.RegisteredServer; 42 44 import net.kyori.adventure.text.ComponentLike; 43 45 import net.kyori.adventure.text.minimessage.MiniMessage; ··· 66 68 import java.util.function.Function; 67 69 68 70 public final class ProxyQueuesImpl implements ProxyQueues { 71 + public static final MinecraftChannelIdentifier playerWaitingIdentifier = 72 + MinecraftChannelIdentifier.create("proxyqueues", "player_waiting"); 69 73 70 74 private static ProxyQueuesImpl instance; 71 75 private final SettingsHandler settingsHandler; ··· 124 128 new ProxyDiscordHandler(this); 125 129 } 126 130 131 + proxyServer.getChannelRegistrar().register(playerWaitingIdentifier); 127 132 new SuperVanishBridgeHelper(proxyServer); 128 133 } 129 134 ··· 132 137 if(playerLimit > -1 && proxyServer.getPlayerCount() >= playerLimit && 133 138 !event.getPlayer().hasPermission("proxyqueues.bypass-limit")) { 134 139 event.setResult(ResultedEvent.ComponentResult.denied(Messages.getComponent("errors.player-limit"))); 140 + } 141 + } 142 + 143 + @Subscribe 144 + public void onPluginMessageFromPlayer(PluginMessageEvent event) { 145 + // Don't allow spoofing of plugin messages 146 + if (playerWaitingIdentifier.equals(event.getIdentifier())) { 147 + event.setResult(PluginMessageEvent.ForwardResult.handled()); 135 148 } 136 149 } 137 150
+2
src/main/java/uk/co/notnull/proxyqueues/tasks/QueueMoveTask.java
··· 94 94 95 95 // Check if the max amount of players on the server are the max slots 96 96 if (queue.isServerFull(targetPlayer.getQueueType())) { 97 + // Tell the backend server a player is waiting to allow proactive freeing of slots 98 + queue.getServer().sendPluginMessage(ProxyQueuesImpl.playerWaitingIdentifier, new byte[0]); 97 99 return; 98 100 } 99 101