mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Add ConnectionRequestEvent (#4533)
* Add ConnectionRequestEvent and implement it * Add debug message and use InetSocketAddress instead of string * Provide both proxy and real client ip And add some minor javadocs * Make ProxyIp nullable * Apply changes from pr Co-authored-by: rtm516 <rtm516@users.noreply.github.com> * Apply changes from pr Co-authored-by: rtm516 <rtm516@users.noreply.github.com> * Apply changes from pr Co-authored-by: rtm516 <rtm516@users.noreply.github.com> * Bump API version * Dont JiJ common on mod platforms --------- Co-authored-by: rtm516 <rtm516@users.noreply.github.com> Co-authored-by: Kas-tle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
parent
c9ca4c82f7
commit
fa441f1c7b
5 changed files with 101 additions and 2 deletions
|
@ -49,6 +49,7 @@ import org.cloudburstmc.netty.handler.codec.raknet.server.RakServerOfflineHandle
|
|||
import org.cloudburstmc.netty.handler.codec.raknet.server.RakServerRateLimiter;
|
||||
import org.cloudburstmc.protocol.bedrock.BedrockPong;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.event.connection.ConnectionRequestEvent;
|
||||
import org.geysermc.geyser.command.defaults.ConnectionTestCommand;
|
||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||
import org.geysermc.geyser.event.type.GeyserBedrockPingEventImpl;
|
||||
|
@ -261,6 +262,14 @@ public final class GeyserServer {
|
|||
} else {
|
||||
ip = "<IP address withheld>";
|
||||
}
|
||||
|
||||
ConnectionRequestEvent requestEvent = new ConnectionRequestEvent(inetSocketAddress, this.proxiedAddresses.get(inetSocketAddress));
|
||||
geyser.eventBus().fire(requestEvent);
|
||||
if (requestEvent.isCancelled()) {
|
||||
geyser.getLogger().debug("Connection request from " + ip + " was cancelled using the API!");
|
||||
return false;
|
||||
}
|
||||
|
||||
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.attempt_connect", ip));
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue