Feat: Make connection data exposed in api less prone to throw errors (#4604)

* Feat: Make connection data exposed in api less prone to throw errors

* address reviews

* review
This commit is contained in:
chris 2024-05-10 23:58:27 +02:00 committed by GitHub
parent 627c2babe9
commit e697eb3ae3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 12 deletions

View file

@ -46,13 +46,35 @@ public final class ConnectionRequestEvent implements Event, Cancellable {
this.proxyIp = proxyIp;
}
/**
* The IP address of the client attempting to connect
*
* @return the IP address of the client attempting to connect
* @deprecated Use {@link #inetSocketAddress()} instead
*/
@NonNull @Deprecated(forRemoval = true)
public InetSocketAddress getInetSocketAddress() {
return ip;
}
/**
* The IP address of the proxy handling the connection. It will return null if there is no proxy.
*
* @return the IP address of the proxy handling the connection
* @deprecated Use {@link #proxyIp()} instead
*/
@Nullable @Deprecated(forRemoval = true)
public InetSocketAddress getProxyIp() {
return proxyIp;
}
/**
* The IP address of the client attempting to connect
*
* @return the IP address of the client attempting to connect
*/
@NonNull
public InetSocketAddress getInetSocketAddress() {
public InetSocketAddress inetSocketAddress() {
return ip;
}
@ -62,7 +84,7 @@ public final class ConnectionRequestEvent implements Event, Cancellable {
* @return the IP address of the proxy handling the connection
*/
@Nullable
public InetSocketAddress getProxyIp() {
public InetSocketAddress proxyIp() {
return proxyIp;
}