-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fixed reconnection loop if not servers are available
fixed #5
- Loading branch information
Showing
9 changed files
with
170 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/test/java/me/dreamerzero/kickredirect/builder/RequestBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package me.dreamerzero.kickredirect.builder; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
import com.velocitypowered.api.proxy.ConnectionRequestBuilder; | ||
import com.velocitypowered.api.proxy.ConnectionRequestBuilder.Result; | ||
import com.velocitypowered.api.proxy.server.RegisteredServer; | ||
|
||
import net.kyori.adventure.builder.AbstractBuilder; | ||
|
||
public class RequestBuilder implements AbstractBuilder<ConnectionRequestBuilder> { | ||
private RegisteredServer server; | ||
private Result result; | ||
private boolean indicationResult; | ||
|
||
public static RequestBuilder builder() { | ||
return new RequestBuilder(); | ||
} | ||
|
||
public RequestBuilder server(RegisteredServer server) { | ||
this.server = server; | ||
return this; | ||
} | ||
|
||
public RequestBuilder result(Result result) { | ||
this.result = result; | ||
return this; | ||
} | ||
|
||
public RequestBuilder result(boolean result) { | ||
this.indicationResult = result; | ||
return this; | ||
} | ||
|
||
@Override | ||
public ConnectionRequestBuilder build() { | ||
return new ConnectionRequestBuilder() { | ||
|
||
@Override | ||
public RegisteredServer getServer() { | ||
return server; | ||
} | ||
|
||
@Override | ||
public CompletableFuture<Result> connect() { | ||
return CompletableFuture.completedFuture(result); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<Boolean> connectWithIndication() { | ||
return CompletableFuture.completedFuture(indicationResult); | ||
} | ||
|
||
@Override | ||
public void fireAndForget() { | ||
} | ||
|
||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters