Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2953,7 +2953,7 @@ private synchronized QueuedVoteResult vote(String player, String service, boolea
// ===========================
// Send vote(s) to backend(s)
// ===========================
if (getConfig().getSendVotesToAllServers()) {
if (shouldSendVoteToAllServers()) {
for (String s : getAllAvailableServers()) {

boolean forceCache = getConfig().getWaitForUserOnline()
Expand Down Expand Up @@ -3094,6 +3094,15 @@ private synchronized QueuedVoteResult vote(String player, String service, boolea
}
}

/**
* Keeps vote fan-out independent from dedicated-presence routing and backend
* reward-storage settings. The proxy obeys SendVotesToAllServers exactly as
* configured; each backend applies its own reward behavior on receipt.
*/
protected boolean shouldSendVoteToAllServers() {
return getConfig().getSendVotesToAllServers();
}

private static final class PendingPresenceHandoff {
private UUID requestId;
private final UUID playerUuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ void dedicatedVotingProxyDoesNotUsePluginMessagingPresence() {
assertEquals("Server1", votingPluginProxy.getCurrentPlayerServerForVoteRoutingForTest("Player"));
}

@Test
void dedicatedVotingProxyPreservesSendVotesToAllServersSetting() {
Mockito.when(votingPluginProxy.getConfig().getDedicatedVotingProxy()).thenReturn(true);
votingPluginProxy.setMethod(BungeeMethod.MQTT);
Mockito.when(votingPluginProxy.getConfig().getSendVotesToAllServers()).thenReturn(true);
assertTrue(votingPluginProxy.shouldSendVoteToAllServersForTest());

Mockito.when(votingPluginProxy.getConfig().getSendVotesToAllServers()).thenReturn(false);
assertFalse(votingPluginProxy.shouldSendVoteToAllServersForTest());
}

@Test
void dedicatedSnapshotDrainsCachedVotesForConfirmedPlayers() {
Mockito.when(votingPluginProxy.getConfig().getDedicatedVotingProxy()).thenReturn(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ public void processDedicatedSnapshotLoginsForTest(String server, Set<UUID> hando
processDedicatedSnapshotLogins(server, handoffPlayers);
}

public boolean shouldSendVoteToAllServersForTest() {
return shouldSendVoteToAllServers();
}

@Override
public void setVoteCacheLastUpdated() {
// TODO Auto-generated method stub
Expand Down
Loading