Skip to content

Commit

Permalink
Don't send autoqueue message when not being autoqueued
Browse files Browse the repository at this point in the history
  • Loading branch information
Warriorrrr committed Aug 3, 2023
1 parent 296f733 commit b6c6726
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/net/earthmc/queue/QueuePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,18 @@ public void onChooseInitialServer(PlayerChooseInitialServerEvent event) {
public void processAutoQueue(ServerConnectedEvent event, QueuedPlayer player) {
final UUID uuid = event.getPlayer().getUniqueId();

if (player.isAutoQueueDisabled()) {
player.sendMessage(Component.text("Auto queue is currently disabled, use /joinqueue " + player.getLastJoinedServer().orElse(config.autoQueueSettings().defaultTarget()) + " to manually join or /queue auto to re-enable auto queue.", NamedTextColor.GRAY));
return;
}

if (
scheduledTasks.containsKey(uuid) // There's already a scheduled auto queue task for this player
|| event.getPlayer().getPermissionValue("queue.autoqueue") == Tristate.FALSE // The player has the auto queue permission explicitly set to false
|| !config.autoQueueSettings().autoQueueServers().contains(event.getServer().getServerInfo().getName().toLowerCase(Locale.ROOT)) // The player isn't on one of the auto queue servers.
)
return;

if (player.isAutoQueueDisabled()) {
player.sendMessage(Component.text("Auto queue is currently disabled, use /joinqueue " + player.getLastJoinedServer().orElse(config.autoQueueSettings().defaultTarget()) + " to manually join or /queue auto to re-enable auto queue.", NamedTextColor.GRAY));
return;
}

scheduledTasks.put(uuid, proxy().getScheduler().buildTask(this, () -> {
scheduledTasks.remove(uuid);

Expand Down

0 comments on commit b6c6726

Please sign in to comment.