mirror of
https://github.com/colbster937/originblacklist.git
synced 2026-02-04 02:57:41 +00:00
Compare commits
2 Commits
v2.0.5+50f
...
v2.0.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89311ee6de | ||
|
|
14ffd4eb08 |
@@ -12,9 +12,9 @@ import xyz.jpenilla.runvelocity.task.RunVelocity
|
||||
|
||||
val PLUGIN_NAME = "OriginBlacklist"
|
||||
val PLUGIN_IDEN = "originblacklist"
|
||||
val PLUGIN_DOMN = "xyz.webmc"
|
||||
val PLUGIN_DOMN = "xyz.webmc.$PLUGIN_IDEN"
|
||||
val PLUGIN_DESC = "An eaglercraft client blacklist plugin."
|
||||
val PLUGIN_VERS = "2.0.5"
|
||||
val PLUGIN_VERS = "2.0.6"
|
||||
val PLUGIN_SITE = "https://github.com/WebMCDevelopment/$PLUGIN_IDEN"
|
||||
val PLUGIN_DEPA = listOf("EaglercraftXServer")
|
||||
val PLUGIN_DEPB = listOf("EaglercraftXServer")
|
||||
@@ -148,10 +148,11 @@ tasks.withType<ShadowJar>().configureEach {
|
||||
delete(layout.buildDirectory.dir("libs"))
|
||||
mkdir(layout.buildDirectory.dir("libs"))
|
||||
}
|
||||
relocate("org.bstats", "$PLUGIN_DOMN.$PLUGIN_IDEN.shaded.bstats")
|
||||
relocate("de.marhali.json5", "$PLUGIN_DOMN.$PLUGIN_IDEN.shaded.json5")
|
||||
relocate("org.semver4j.semver4j", "$PLUGIN_DOMN.$PLUGIN_IDEN.shaded.semver4j")
|
||||
// relocate("net.kyori.adventure", "$PLUGIN_DOMN.$PLUGIN_IDEN.shaded.adventure")
|
||||
relocate("inet.ipaddr", "$PLUGIN_DOMN.shaded.ipaddress")
|
||||
relocate("de.marhali.json5", "$PLUGIN_DOMN.shaded.json5")
|
||||
relocate("org.bstats", "$PLUGIN_DOMN.shaded.bstats")
|
||||
relocate("org.semver4j.semver4j", "$PLUGIN_DOMN.shaded.semver4j")
|
||||
// relocate("net.kyori.adventure", "$PLUGIN_DOMN.shaded.adventure")
|
||||
archiveFileName.set("$PLUGIN_NAME-$PLUGIN_VERS.jar")
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
@@ -36,15 +38,17 @@ import inet.ipaddr.IPAddressString;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.lax1dude.eaglercraft.backend.server.api.EnumWebSocketHeader;
|
||||
import net.lax1dude.eaglercraft.backend.server.api.IEaglerLoginConnection;
|
||||
import net.lax1dude.eaglercraft.backend.server.api.query.IMOTDConnection;
|
||||
import org.semver4j.Semver;
|
||||
|
||||
public final class OriginBlacklist {
|
||||
private static final String COMMIT_L = BuildInfo.get("git_cm_hash");
|
||||
private static final String COMMIT_S = COMMIT_L.substring(0, 8);
|
||||
|
||||
public static final Semver REQUIRED_API_VER = new Semver("1.0.2");
|
||||
public static final String GENERIC_STR = "GENERIC";
|
||||
public static final String UNKNOWN_STR = "UNKNOWN";
|
||||
public static final String CENSORED_STR = "CENSORED";
|
||||
public static final String PLUGIN_REPO = "WebMCDevelopment/originblacklist";
|
||||
public static final int BSTATS_ID = 28776;
|
||||
|
||||
@@ -56,7 +60,7 @@ public final class OriginBlacklist {
|
||||
|
||||
public OriginBlacklist(final IOriginBlacklistPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.config = new OriginBlacklistConfig(plugin);
|
||||
this.config = new OriginBlacklistConfig(this);
|
||||
this.http = new OriginBlacklistHTTPServer(this);
|
||||
this.json5 = Json5.builder(builder -> builder.prettyPrinting().indentFactor(0).build());
|
||||
plugin.scheduleRepeat(() -> {
|
||||
@@ -66,7 +70,7 @@ public final class OriginBlacklist {
|
||||
|
||||
public final void init() {
|
||||
this.plugin.log(EnumLogLevel.INFO, "Initialized Plugin");
|
||||
this.plugin.log(EnumLogLevel.DEBUG, "Commit " + BuildInfo.get("git_cm_hash"));
|
||||
this.plugin.log(EnumLogLevel.DEBUG, "Commit " + COMMIT_L);
|
||||
if (this.isHTTPServerEnabled()) {
|
||||
this.http.start();
|
||||
}
|
||||
@@ -75,6 +79,7 @@ public final class OriginBlacklist {
|
||||
public final void shutdown() {
|
||||
this.plugin.log(EnumLogLevel.INFO, "Shutting down...");
|
||||
this.http.stop();
|
||||
this.plugin.shutdown();
|
||||
}
|
||||
|
||||
public final void handleReload() {
|
||||
@@ -108,6 +113,7 @@ public final class OriginBlacklist {
|
||||
final String name = player.getName();
|
||||
if (isNonNull(name)) {
|
||||
this.plugin.log(EnumLogLevel.INFO, "Prevented blacklisted player " + name + " from joining.");
|
||||
this.updateLogFile(event, blacklisted);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,6 +144,10 @@ public final class OriginBlacklist {
|
||||
return this.config.getBoolean("bStats");
|
||||
}
|
||||
|
||||
public final boolean isLogFileEnabled() {
|
||||
return this.config.getBoolean("logFile");
|
||||
}
|
||||
|
||||
public final boolean isHTTPServerEnabled() {
|
||||
return this.config.getBoolean("blacklist_http_share.enabled");
|
||||
}
|
||||
@@ -161,7 +171,7 @@ public final class OriginBlacklist {
|
||||
conn.disconnect();
|
||||
}
|
||||
|
||||
public final void checkForUpdates(Runnable action1, Runnable action2) {
|
||||
public final void checkForUpdates(final Runnable action1, final Runnable action2) {
|
||||
if (this.config.getBoolean("update_checker.enabled")) {
|
||||
this.plugin.runAsync(() -> {
|
||||
this.updateURL = UpdateChecker.checkForUpdates(PLUGIN_REPO, this.plugin.getPluginVersion(),
|
||||
@@ -177,7 +187,7 @@ public final class OriginBlacklist {
|
||||
}
|
||||
}
|
||||
|
||||
public final void updatePlugin(Runnable action1, Runnable action2) {
|
||||
public final void updatePlugin(final Runnable action1, final Runnable action2) {
|
||||
try {
|
||||
final URL url = new URL(this.updateURL);
|
||||
final Path jar = this.plugin.getPluginJarPath();
|
||||
@@ -317,6 +327,10 @@ public final class OriginBlacklist {
|
||||
}
|
||||
}
|
||||
|
||||
public final String getDataDir() {
|
||||
return "plugins/" + plugin.getPluginId();
|
||||
}
|
||||
|
||||
private final Component getBlacklistedComponent(final String type, final String id, final String blockType,
|
||||
final String blockTypeAlt, final String notAllowed, final String notAllowedAlt, final String blockValue,
|
||||
final String action) {
|
||||
@@ -341,13 +355,13 @@ public final class OriginBlacklist {
|
||||
if (this.config.getBoolean("discord.enabled")) {
|
||||
final OPlayer player = event.getPlayer();
|
||||
final EnumConnectionType connType = event.getConnectionType();
|
||||
final String userAgent;
|
||||
/* final String userAgent;
|
||||
if (connType == EnumConnectionType.EAGLER) {
|
||||
final IEaglerLoginConnection loginConn = event.getEaglerEvent().getLoginConnection();
|
||||
userAgent = loginConn.getWebSocketHeader(EnumWebSocketHeader.HEADER_USER_AGENT);
|
||||
} else {
|
||||
userAgent = UNKNOWN_STR;
|
||||
}
|
||||
} */
|
||||
final byte[] payload = String.format(
|
||||
"""
|
||||
{
|
||||
@@ -355,11 +369,11 @@ public final class OriginBlacklist {
|
||||
"embeds": [
|
||||
{
|
||||
"title": "-------- Player Information --------",
|
||||
"description": "**→ Name:** %s\\n**→ Origin:** %s\\n**→ Brand:** %s\\n**→ IP Address:** %s\\n**→ Protocol Version:** %s\\n**→ User Agent:** %s\\n**→ Rewind:** %s\\n**→ Player Type:** %s",
|
||||
"description": "**→ Name:** %s\\n**→ Origin:** %s\\n**→ Brand:** %s\\n**→ IP Address:** %s\\n**→ Protocol Version:** %s\\n**→ Host:** %s\\n**→ Rewind:** %s\\n**→ Player Type:** %s",
|
||||
"color": 15801922,
|
||||
"fields": [],
|
||||
"footer": {
|
||||
"text": "OriginBlacklist v%s",
|
||||
"text": "%s v%s",
|
||||
"icon_url": "https://raw.githubusercontent.com/%s/refs/heads/main/img/icon.png"
|
||||
}
|
||||
}
|
||||
@@ -386,12 +400,14 @@ public final class OriginBlacklist {
|
||||
player.getName().replaceAll("_", "\\_"),
|
||||
player.getOrigin(),
|
||||
player.getBrand(),
|
||||
this.config.getBoolean("discord.send_ips") ? player.getAddr() : "*\\*CENSORED\\**",
|
||||
this.config.getBoolean("discord.send_ips") ? player.getAddr() : CENSORED_STR,
|
||||
player.getPVN(),
|
||||
userAgent,
|
||||
player.getVHost(),
|
||||
// userAgent,
|
||||
player.isRewind() ? "YES" : "NO",
|
||||
connType.toString(),
|
||||
this.plugin.getPluginVersion(),
|
||||
BuildInfo.get("plugin_name"),
|
||||
this.plugin.getPluginVersion() + " • " + COMMIT_S,
|
||||
PLUGIN_REPO,
|
||||
PLUGIN_REPO).getBytes();
|
||||
final Json5Array arr = this.config.get("discord.webhook_urls").getAsJson5Array();
|
||||
@@ -435,6 +451,26 @@ public final class OriginBlacklist {
|
||||
});
|
||||
}
|
||||
|
||||
private final void updateLogFile(final OriginBlacklistLoginEvent event, final EnumBlacklistType type) {
|
||||
if (this.isLogFileEnabled()) {
|
||||
final OPlayer player = event.getPlayer();
|
||||
final String txt = Instant.now() + " - [player=" + player.getName() + "," + "blacklist_reason=" + type.toString() + "]";
|
||||
final Path dir = Paths.get(this.getDataDir());
|
||||
try {
|
||||
Files.createDirectories(dir);
|
||||
Files.writeString(
|
||||
dir.resolve("blacklist.log"),
|
||||
txt + "\n",
|
||||
StandardOpenOption.CREATE,
|
||||
StandardOpenOption.WRITE,
|
||||
StandardOpenOption.APPEND
|
||||
);
|
||||
} catch (final Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final String getComponentString(final Component comp) {
|
||||
return LegacyComponentSerializer.legacySection().serialize(comp);
|
||||
}
|
||||
|
||||
@@ -149,14 +149,14 @@ public class OriginBlacklistCommand implements ICommand {
|
||||
ctx.reply("<aqua>Commands:</aqua>");
|
||||
ctx.reply("<gray> - /originblacklist reload</gray>");
|
||||
ctx.reply("<gray> - /originblacklist update</gray>");
|
||||
ctx.reply("<gray> - /originblacklist add <origin/brand/name/ip> <argB></gray>");
|
||||
ctx.reply("<gray> - /originblacklist remove <origin/brand/name/ip> <argB></gray>");
|
||||
ctx.reply("<gray> - /originblacklist test <argB></gray>");
|
||||
ctx.reply("<gray> - /originblacklist add <origin/brand/name/ip> <arg></gray>");
|
||||
ctx.reply("<gray> - /originblacklist remove <origin/brand/name/ip> <arg></gray>");
|
||||
ctx.reply("<gray> - /originblacklist test <arg></gray>");
|
||||
ctx.reply("<gray> - /originblacklist list</gray>");
|
||||
}
|
||||
|
||||
private final boolean isBlacklisted(final String str) {
|
||||
final OPlayer player = new OPlayer(null, str, null, str, str, -1);
|
||||
final OPlayer player = new OPlayer(null, str, null, str, str, null, -1);
|
||||
return this.plugin.testBlacklist(player) != EnumBlacklistType.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public final class OriginBlacklistConfig {
|
||||
private byte[] icon;
|
||||
private String icon64;
|
||||
|
||||
public OriginBlacklistConfig(final IOriginBlacklistPlugin plugin) {
|
||||
public OriginBlacklistConfig(final OriginBlacklist plugin) {
|
||||
this.json5 = Json5.builder(builder -> builder
|
||||
.quoteless()
|
||||
.quoteSingle()
|
||||
@@ -39,10 +39,10 @@ public final class OriginBlacklistConfig {
|
||||
.writeComments()
|
||||
.prettyPrinting()
|
||||
.build());
|
||||
final String dir = "plugins/" + plugin.getPluginId();
|
||||
this.file = new File(dir + "/config.json5");
|
||||
|
||||
this.file = new File(plugin.getDataDir() + "/config.json5");
|
||||
this.filePath = file.toPath();
|
||||
this.iconFile = new File(dir + "/blacklisted.png");
|
||||
this.iconFile = new File(plugin.getDataDir() + "/blacklisted.png");
|
||||
this.iconPath = iconFile.toPath();
|
||||
this.loadConfig();
|
||||
}
|
||||
@@ -321,6 +321,7 @@ public final class OriginBlacklistConfig {
|
||||
addJSONObj(obj, "blacklist_to_whitelist", Json5Primitive.fromBoolean(false), null);
|
||||
addJSONObj(obj, "block_undefined_origin", Json5Primitive.fromBoolean(false), null);
|
||||
addJSONObj(obj, "bStats", Json5Primitive.fromBoolean(true), null);
|
||||
addJSONObj(obj, "logFile", Json5Primitive.fromBoolean(true), null);
|
||||
addJSONObj(obj, "config_version", Json5Primitive.fromNumber(1), "DO NOT CHANGE");
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -16,16 +16,18 @@ public final class OPlayer {
|
||||
private final String name;
|
||||
private final UUID uuid;
|
||||
private final String brand;
|
||||
private final String vhost;
|
||||
private final boolean rewind;
|
||||
private final int pvn;
|
||||
|
||||
public OPlayer(final IEaglerConnection conn, final String name, final UUID uuid, final String addr,
|
||||
final String brand, final int pvn) {
|
||||
final String brand, final String vhost, final int pvn) {
|
||||
this.name = name;
|
||||
this.uuid = uuid;
|
||||
if (conn != null) {
|
||||
this.origin = conn.getWebSocketHeader(EnumWebSocketHeader.HEADER_ORIGIN);
|
||||
this.addr = formatSocketAddress(conn.getSocketAddress());
|
||||
this.vhost = conn.isWebSocketSecure() ? "wss://" : "ws://" + conn.getWebSocketHost();
|
||||
if (conn instanceof IEaglerLoginConnection) {
|
||||
final IEaglerLoginConnection loginConn = (IEaglerLoginConnection) conn;
|
||||
this.brand = loginConn.getEaglerBrandString();
|
||||
@@ -40,13 +42,14 @@ public final class OPlayer {
|
||||
this.origin = OriginBlacklist.UNKNOWN_STR;
|
||||
this.addr = formatIPAddress(addr);
|
||||
this.brand = brand;
|
||||
this.vhost = vhost;
|
||||
this.rewind = false;
|
||||
this.pvn = pvn;
|
||||
}
|
||||
}
|
||||
|
||||
public OPlayer(final IEaglerConnection conn, final String name, final UUID uuid) {
|
||||
this(conn, name, uuid, null, null, -1);
|
||||
this(conn, name, uuid, null, null, null, -1);
|
||||
}
|
||||
|
||||
public final String getOrigin() {
|
||||
@@ -69,6 +72,10 @@ public final class OPlayer {
|
||||
return this.brand;
|
||||
}
|
||||
|
||||
public final String getVHost() {
|
||||
return this.vhost;
|
||||
}
|
||||
|
||||
public final boolean isRewind() {
|
||||
return this.rewind;
|
||||
}
|
||||
|
||||
@@ -112,15 +112,13 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public final void onJavaLogin(final AsyncPlayerPreLoginEvent event) {
|
||||
final OPlayer player = new OPlayer(null, event.getName(), event.getUniqueId(),
|
||||
event.getAddress() != null ? event.getAddress().toString() : null, OriginBlacklist.UNKNOWN_STR, -1);
|
||||
final OPlayer player = new OPlayer(null, event.getName(), event.getUniqueId(), event.getAddress().toString(), OriginBlacklist.UNKNOWN_STR, OriginBlacklist.UNKNOWN_STR, -1);
|
||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public final void onJavaMOTD(final ServerListPingEvent event) {
|
||||
final OPlayer player = new OPlayer(null, null, null,
|
||||
event.getAddress() != null ? event.getAddress().toString() : null, null, -1);
|
||||
final OPlayer player = new OPlayer(null, null, null, event.getAddress().toString(), null, null, -1);
|
||||
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||
import xyz.webmc.originblacklist.bungee.command.OriginBlacklistCommandBungee;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
@@ -23,6 +24,7 @@ import net.lax1dude.eaglercraft.backend.server.api.bungee.event.EaglercraftLogin
|
||||
import net.lax1dude.eaglercraft.backend.server.api.bungee.event.EaglercraftMOTDEvent;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
import net.md_5.bungee.api.connection.PendingConnection;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.event.PreLoginEvent;
|
||||
@@ -108,21 +110,27 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public final void onJavaLogin(final PostLoginEvent event) {
|
||||
final PendingConnection conn = event.getPlayer().getPendingConnection();
|
||||
final InetSocketAddress vhost = conn.getVirtualHost();
|
||||
final ProxiedPlayer aPlayer = event.getPlayer();
|
||||
final OPlayer bPlayer = new OPlayer(null, aPlayer.getName(), aPlayer.getUniqueId(),
|
||||
aPlayer.getAddress().toString(), aPlayer.getClientBrand(), event.getPlayer().getPendingConnection().getVersion());
|
||||
aPlayer.getAddress().toString(), aPlayer.getClientBrand(), vhost.getHostString() + vhost.getPort(), conn.getVersion());
|
||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, bPlayer));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public final void onJavaHandshake(final PreLoginEvent event) {
|
||||
final OPlayer player = new OPlayer(null, null, null, event.getConnection().getAddress().toString(), OriginBlacklist.UNKNOWN_STR, event.getConnection().getVersion());
|
||||
final PendingConnection conn = event.getConnection();
|
||||
final InetSocketAddress vhost = conn.getVirtualHost();
|
||||
final OPlayer player = new OPlayer(null, null, null, conn.getAddress().toString(), OriginBlacklist.UNKNOWN_STR, vhost.getHostString() + vhost.getPort(), conn.getVersion());
|
||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public final void onJavaMOTD(final ProxyPingEvent event) {
|
||||
final OPlayer player = new OPlayer(null, null, null, event.getConnection().getAddress().toString(), null, -1);
|
||||
final PendingConnection conn = event.getConnection();
|
||||
final InetSocketAddress vhost = conn.getVirtualHost();
|
||||
final OPlayer player = new OPlayer(null, null, null, conn.getAddress().toString(), null, vhost.getHostString() + vhost.getPort(), -1);
|
||||
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||
import xyz.webmc.originblacklist.velocity.command.OriginBlacklistCommandVelocity;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
@@ -26,6 +27,7 @@ import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.event.proxy.ProxyPingEvent;
|
||||
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.proxy.InboundConnection;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.server.ServerPing;
|
||||
@@ -125,24 +127,29 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
||||
|
||||
@Subscribe(order = PostOrder.FIRST)
|
||||
public final void onJavaLogin(final PreLoginEvent event) {
|
||||
final InboundConnection conn = event.getConnection();
|
||||
final InetSocketAddress vhost = conn.getVirtualHost().orElseThrow();
|
||||
final OPlayer player = new OPlayer(null, event.getUsername(), event.getUniqueId(),
|
||||
event.getConnection().getRemoteAddress().toString(), OriginBlacklist.UNKNOWN_STR,
|
||||
event.getConnection().getProtocolVersion().getProtocol());
|
||||
conn.getRemoteAddress().toString(), OriginBlacklist.UNKNOWN_STR, vhost.getHostString() + vhost.getPort(),
|
||||
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 Player aPlayer = (Player) event.getPlayer();
|
||||
final InetSocketAddress vhost = event.getPlayer().getVirtualHost().orElseThrow();
|
||||
final Player aPlayer = event.getPlayer();
|
||||
final OPlayer bPlayer = new OPlayer(null, aPlayer.getUsername(), aPlayer.getUniqueId(),
|
||||
aPlayer.getRemoteAddress().getAddress().toString(), event.getBrand(),
|
||||
aPlayer.getRemoteAddress().getAddress().toString(), event.getBrand(), vhost.getHostString() + vhost.getPort(),
|
||||
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 OPlayer player = new OPlayer(null, null, null, event.getConnection().getRemoteAddress().getHostString(),
|
||||
final InboundConnection conn = event.getConnection();
|
||||
final InetSocketAddress vhost = conn.getVirtualHost().orElseThrow();
|
||||
final OPlayer player = new OPlayer(null, null, null, conn.getRemoteAddress().getHostString(), vhost.getHostString() + vhost.getPort(),
|
||||
null, -1);
|
||||
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user