Skip to content
Merged
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 @@ -94,8 +94,9 @@ public final void onJavaLogin(final PostLoginEvent event) {
final PendingConnection conn = event.getPlayer().getPendingConnection();
final InetSocketAddress vhost = conn.getVirtualHost();
final ProxiedPlayer aPlayer = event.getPlayer();
final String origin = vhost != null ? vhost.getHostString() + vhost.getPort() : OriginBlacklist.UNKNOWN_STR;
final OPlayer bPlayer = new OPlayer(null, aPlayer.getName(), aPlayer.getUniqueId(),
aPlayer.getAddress().toString(), aPlayer.getClientBrand(), vhost.getHostString() + vhost.getPort(),
aPlayer.getAddress().toString(), aPlayer.getClientBrand(), origin,
conn.getVersion());
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, bPlayer));
}
Expand All @@ -104,17 +105,19 @@ public final void onJavaLogin(final PostLoginEvent event) {
public final void onJavaHandshake(final PreLoginEvent event) {
final PendingConnection conn = event.getConnection();
final InetSocketAddress vhost = conn.getVirtualHost();
final String origin = vhost != null ? vhost.getHostString() + vhost.getPort() : OriginBlacklist.UNKNOWN_STR;
final OPlayer player = new OPlayer(null, null, null, conn.getAddress().toString(), OriginBlacklist.UNKNOWN_STR,
vhost.getHostString() + vhost.getPort(), conn.getVersion());
origin, conn.getVersion());
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
}

@EventHandler(priority = EventPriority.LOWEST)
public final void onJavaMOTD(final ProxyPingEvent event) {
final PendingConnection conn = event.getConnection();
final InetSocketAddress vhost = conn.getVirtualHost();
final String origin = vhost != null ? vhost.getHostString() + vhost.getPort() : OriginBlacklist.UNKNOWN_STR;
final OPlayer player = new OPlayer(null, null, null, conn.getAddress().toString(), null,
vhost.getHostString() + vhost.getPort(), -1);
origin, -1);
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,30 +108,32 @@ public final void onEaglerMOTD(final EaglercraftMOTDEvent event) {
@Subscribe(order = PostOrder.FIRST)
public final void onJavaLogin(final PreLoginEvent event) {
final InboundConnection conn = event.getConnection();
final InetSocketAddress vhost = conn.getVirtualHost().orElseThrow();
final InetSocketAddress vhost = conn.getVirtualHost().orElse(null);
final String origin = vhost != null ? vhost.getHostString() + vhost.getPort() : OriginBlacklist.UNKNOWN_STR;
final OPlayer player = new OPlayer(null, event.getUsername(), event.getUniqueId(),
conn.getRemoteAddress().toString(), OriginBlacklist.UNKNOWN_STR, vhost.getHostString() + vhost.getPort(),
conn.getRemoteAddress().toString(), OriginBlacklist.UNKNOWN_STR, origin,
conn.getProtocolVersion().getProtocol());
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
}

@Subscribe(order = PostOrder.FIRST)
public final void onJavaHandshake(final PlayerClientBrandEvent event) {
final InetSocketAddress vhost = event.getPlayer().getVirtualHost().orElseThrow();
final InetSocketAddress vhost = event.getPlayer().getVirtualHost().orElse(null);
final String origin = vhost != null ? vhost.getHostString() + vhost.getPort() : OriginBlacklist.UNKNOWN_STR;
final Player aPlayer = event.getPlayer();
final OPlayer bPlayer = new OPlayer(null, aPlayer.getUsername(), aPlayer.getUniqueId(),
aPlayer.getRemoteAddress().getAddress().toString(), event.getBrand(), vhost.getHostString() + vhost.getPort(),
aPlayer.getRemoteAddress().getAddress().toString(), event.getBrand(), origin,
event.getPlayer().getProtocolVersion().getProtocol());
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, bPlayer));
}

@Subscribe(order = PostOrder.LAST)
public final void onJavaMOTD(final ProxyPingEvent event) {
final InboundConnection conn = event.getConnection();
final InetSocketAddress vhost = conn.getVirtualHost().orElseThrow();
final InetSocketAddress vhost = conn.getVirtualHost().orElse(null);
final String origin = vhost != null ? vhost.getHostString() + vhost.getPort() : OriginBlacklist.UNKNOWN_STR;
final OPlayer player = new OPlayer(null, null, null, conn.getRemoteAddress().getHostString(),
vhost.getHostString() + vhost.getPort(),
null, -1);
null, origin, -1);
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
}

Expand Down