mirror of
https://github.com/colbster937/originblacklist.git
synced 2026-02-04 11:07:41 +00:00
Compare commits
7 Commits
50fdbb0c28
...
v2.0.7+f22
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f22e800439 | ||
|
|
f0274ff4d4 | ||
|
|
12f9d669b4 | ||
|
|
c43de8a1c9 | ||
|
|
d8fa2b10c1 | ||
|
|
89311ee6de | ||
|
|
14ffd4eb08 |
@@ -15,6 +15,7 @@
|
|||||||
- [x] Plugin update checker
|
- [x] Plugin update checker
|
||||||
- [x] Send blacklist logs to a webhook
|
- [x] Send blacklist logs to a webhook
|
||||||
- [x] Ingame blacklist management commands
|
- [x] Ingame blacklist management commands
|
||||||
|
- [x] Blacklist sharing via EaglerXServer routes
|
||||||
- [x] Reverse blacklist (whitelist)
|
- [x] Reverse blacklist (whitelist)
|
||||||
- [ ] Subscribe to an auto-updating blacklist
|
- [ ] Subscribe to an auto-updating blacklist
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import xyz.jpenilla.runvelocity.task.RunVelocity
|
|||||||
|
|
||||||
val PLUGIN_NAME = "OriginBlacklist"
|
val PLUGIN_NAME = "OriginBlacklist"
|
||||||
val PLUGIN_IDEN = "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_DESC = "An eaglercraft client blacklist plugin."
|
||||||
val PLUGIN_VERS = "2.0.5"
|
val PLUGIN_VERS = "2.0.7"
|
||||||
val PLUGIN_SITE = "https://github.com/WebMCDevelopment/$PLUGIN_IDEN"
|
val PLUGIN_SITE = "https://github.com/WebMCDevelopment/$PLUGIN_IDEN"
|
||||||
val PLUGIN_DEPA = listOf("EaglercraftXServer")
|
val PLUGIN_DEPA = listOf("EaglercraftXServer")
|
||||||
val PLUGIN_DEPB = listOf("EaglercraftXServer")
|
val PLUGIN_DEPB = listOf("EaglercraftXServer")
|
||||||
@@ -148,10 +148,11 @@ tasks.withType<ShadowJar>().configureEach {
|
|||||||
delete(layout.buildDirectory.dir("libs"))
|
delete(layout.buildDirectory.dir("libs"))
|
||||||
mkdir(layout.buildDirectory.dir("libs"))
|
mkdir(layout.buildDirectory.dir("libs"))
|
||||||
}
|
}
|
||||||
relocate("org.bstats", "$PLUGIN_DOMN.$PLUGIN_IDEN.shaded.bstats")
|
relocate("inet.ipaddr", "$PLUGIN_DOMN.shaded.ipaddress")
|
||||||
relocate("de.marhali.json5", "$PLUGIN_DOMN.$PLUGIN_IDEN.shaded.json5")
|
relocate("de.marhali.json5", "$PLUGIN_DOMN.shaded.json5")
|
||||||
relocate("org.semver4j.semver4j", "$PLUGIN_DOMN.$PLUGIN_IDEN.shaded.semver4j")
|
relocate("org.bstats", "$PLUGIN_DOMN.shaded.bstats")
|
||||||
// relocate("net.kyori.adventure", "$PLUGIN_DOMN.$PLUGIN_IDEN.shaded.adventure")
|
relocate("org.semver4j.semver4j", "$PLUGIN_DOMN.shaded.semver4j")
|
||||||
|
// relocate("net.kyori.adventure", "$PLUGIN_DOMN.shaded.adventure")
|
||||||
archiveFileName.set("$PLUGIN_NAME-$PLUGIN_VERS.jar")
|
archiveFileName.set("$PLUGIN_NAME-$PLUGIN_VERS.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +171,7 @@ tasks.register("printVars") {
|
|||||||
tasks.withType<RunServer>().configureEach {
|
tasks.withType<RunServer>().configureEach {
|
||||||
minecraftVersion("1.12.2")
|
minecraftVersion("1.12.2")
|
||||||
runDirectory.set(layout.projectDirectory.dir("run/paper"))
|
runDirectory.set(layout.projectDirectory.dir("run/paper"))
|
||||||
|
jvmArgs("-Dcom.mojang.eula.agree=true")
|
||||||
downloadPlugins {
|
downloadPlugins {
|
||||||
github("lax1dude", "eaglerxserver", "v" + EAGXS_VER, "EaglerXServer.jar")
|
github("lax1dude", "eaglerxserver", "v" + EAGXS_VER, "EaglerXServer.jar")
|
||||||
modrinth("placeholderapi", "2.11.7")
|
modrinth("placeholderapi", "2.11.7")
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import xyz.webmc.originblacklist.base.enums.EnumConnectionType;
|
|||||||
import xyz.webmc.originblacklist.base.enums.EnumLogLevel;
|
import xyz.webmc.originblacklist.base.enums.EnumLogLevel;
|
||||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistLoginEvent;
|
import xyz.webmc.originblacklist.base.events.OriginBlacklistLoginEvent;
|
||||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistMOTDEvent;
|
import xyz.webmc.originblacklist.base.events.OriginBlacklistMOTDEvent;
|
||||||
import xyz.webmc.originblacklist.base.http.OriginBlacklistHTTPServer;
|
import xyz.webmc.originblacklist.base.http.OriginBlacklistRequestHandler;
|
||||||
import xyz.webmc.originblacklist.base.util.BuildInfo;
|
import xyz.webmc.originblacklist.base.util.BuildInfo;
|
||||||
import xyz.webmc.originblacklist.base.util.IOriginBlacklistPlugin;
|
import xyz.webmc.originblacklist.base.util.IOriginBlacklistPlugin;
|
||||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||||
@@ -22,6 +22,8 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.nio.file.StandardOpenOption;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -36,52 +38,62 @@ import inet.ipaddr.IPAddressString;
|
|||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.EnumWebSocketHeader;
|
import net.lax1dude.eaglercraft.backend.server.api.IEaglerXServerAPI;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.IEaglerLoginConnection;
|
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.query.IMOTDConnection;
|
import net.lax1dude.eaglercraft.backend.server.api.query.IMOTDConnection;
|
||||||
import org.semver4j.Semver;
|
import org.semver4j.Semver;
|
||||||
|
|
||||||
|
@SuppressWarnings({ "rawtypes" })
|
||||||
public final class OriginBlacklist {
|
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 Semver REQUIRED_API_VER = new Semver("1.0.2");
|
||||||
public static final String GENERIC_STR = "GENERIC";
|
public static final String GENERIC_STR = "GENERIC";
|
||||||
public static final String UNKNOWN_STR = "UNKNOWN";
|
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 String PLUGIN_REPO = "WebMCDevelopment/originblacklist";
|
||||||
public static final int BSTATS_ID = 28776;
|
public static final int BSTATS_ID = 28776;
|
||||||
|
|
||||||
private final IOriginBlacklistPlugin plugin;
|
private final IOriginBlacklistPlugin plugin;
|
||||||
private final OriginBlacklistConfig config;
|
private final OriginBlacklistConfig config;
|
||||||
private final OriginBlacklistHTTPServer http;
|
|
||||||
private final Json5 json5;
|
private final Json5 json5;
|
||||||
private String updateURL;
|
private String updateURL;
|
||||||
|
private Path jarFile;
|
||||||
|
|
||||||
public OriginBlacklist(final IOriginBlacklistPlugin plugin) {
|
public OriginBlacklist(final IOriginBlacklistPlugin plugin) {
|
||||||
this.plugin = 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());
|
this.json5 = Json5.builder(builder -> builder.prettyPrinting().indentFactor(0).build());
|
||||||
plugin.scheduleRepeat(() -> {
|
|
||||||
this.checkForUpdates();
|
|
||||||
}, this.config.getInteger("update_checker.check_timer"), TimeUnit.SECONDS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void init() {
|
public final void init() {
|
||||||
this.plugin.log(EnumLogLevel.INFO, "Initialized Plugin");
|
this.jarFile = this.plugin.getPluginJarPath();
|
||||||
this.plugin.log(EnumLogLevel.DEBUG, "Commit " + BuildInfo.get("git_cm_hash"));
|
this.plugin.scheduleRepeat(() -> {
|
||||||
if (this.isHTTPServerEnabled()) {
|
this.checkForUpdates();
|
||||||
this.http.start();
|
}, this.config.getInteger("update_checker.check_timer"), TimeUnit.SECONDS);
|
||||||
|
if (this.isBlacklistAPIEnabled()) {
|
||||||
|
OriginBlacklistRequestHandler.register(this);
|
||||||
}
|
}
|
||||||
|
this.plugin.log(EnumLogLevel.INFO, "Initialized Plugin");
|
||||||
|
this.plugin.log(EnumLogLevel.DEBUG, "Commit " + COMMIT_L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void shutdown() {
|
public final void shutdown() {
|
||||||
this.plugin.log(EnumLogLevel.INFO, "Shutting down...");
|
this.plugin.log(EnumLogLevel.INFO, "Shutting down...");
|
||||||
this.http.stop();
|
if (this.isBlacklistAPIEnabled()) {
|
||||||
|
OriginBlacklistRequestHandler.unRegister(this);
|
||||||
|
}
|
||||||
|
this.plugin.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void handleReload() {
|
public final void handleReload() {
|
||||||
if (this.isHTTPServerEnabled()) {
|
try {
|
||||||
this.http.start();
|
if (this.isBlacklistAPIEnabled()) {
|
||||||
} else {
|
OriginBlacklistRequestHandler.register(this);
|
||||||
this.http.stop();
|
} else {
|
||||||
|
OriginBlacklistRequestHandler.unRegister(this);
|
||||||
|
}
|
||||||
|
} catch (final Throwable t) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +120,7 @@ public final class OriginBlacklist {
|
|||||||
final String name = player.getName();
|
final String name = player.getName();
|
||||||
if (isNonNull(name)) {
|
if (isNonNull(name)) {
|
||||||
this.plugin.log(EnumLogLevel.INFO, "Prevented blacklisted player " + name + " from joining.");
|
this.plugin.log(EnumLogLevel.INFO, "Prevented blacklisted player " + name + " from joining.");
|
||||||
|
this.updateLogFile(event, blacklisted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,8 +151,12 @@ public final class OriginBlacklist {
|
|||||||
return this.config.getBoolean("bStats");
|
return this.config.getBoolean("bStats");
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isHTTPServerEnabled() {
|
public final boolean isLogFileEnabled() {
|
||||||
return this.config.getBoolean("blacklist_http_share.enabled");
|
return this.config.getBoolean("logFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean isBlacklistAPIEnabled() {
|
||||||
|
return this.config.getBoolean("blacklist_http_api");
|
||||||
}
|
}
|
||||||
|
|
||||||
public final OriginBlacklistConfig getConfig() {
|
public final OriginBlacklistConfig getConfig() {
|
||||||
@@ -161,7 +178,7 @@ public final class OriginBlacklist {
|
|||||||
conn.disconnect();
|
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")) {
|
if (this.config.getBoolean("update_checker.enabled")) {
|
||||||
this.plugin.runAsync(() -> {
|
this.plugin.runAsync(() -> {
|
||||||
this.updateURL = UpdateChecker.checkForUpdates(PLUGIN_REPO, this.plugin.getPluginVersion(),
|
this.updateURL = UpdateChecker.checkForUpdates(PLUGIN_REPO, this.plugin.getPluginVersion(),
|
||||||
@@ -177,10 +194,10 @@ public final class OriginBlacklist {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void updatePlugin(Runnable action1, Runnable action2) {
|
public final void updatePlugin(final Runnable action1, final Runnable action2) {
|
||||||
try {
|
try {
|
||||||
final URL url = new URL(this.updateURL);
|
final URL url = new URL(this.updateURL);
|
||||||
final Path jar = this.plugin.getPluginJarPath();
|
final Path jar = this.jarFile;
|
||||||
final Path bak = jar.resolveSibling(jar.getFileName().toString() + ".bak");
|
final Path bak = jar.resolveSibling(jar.getFileName().toString() + ".bak");
|
||||||
final Path upd = jar
|
final Path upd = jar
|
||||||
.resolveSibling(Paths.get(URLDecoder.decode(url.getPath(), StandardCharsets.UTF_8)).getFileName());
|
.resolveSibling(Paths.get(URLDecoder.decode(url.getPath(), StandardCharsets.UTF_8)).getFileName());
|
||||||
@@ -205,6 +222,7 @@ public final class OriginBlacklist {
|
|||||||
}
|
}
|
||||||
Files.delete(jar);
|
Files.delete(jar);
|
||||||
Files.delete(bak);
|
Files.delete(bak);
|
||||||
|
this.jarFile = upd;
|
||||||
action1.run();
|
action1.run();
|
||||||
return;
|
return;
|
||||||
} catch (final Throwable t) {
|
} catch (final Throwable t) {
|
||||||
@@ -303,6 +321,7 @@ public final class OriginBlacklist {
|
|||||||
try {
|
try {
|
||||||
final Json5Object obj = new Json5Object();
|
final Json5Object obj = new Json5Object();
|
||||||
obj.addProperty("plugin_version", this.plugin.getPluginVersion().getVersion());
|
obj.addProperty("plugin_version", this.plugin.getPluginVersion().getVersion());
|
||||||
|
obj.addProperty("git_commit", COMMIT_L);
|
||||||
obj.addProperty("blacklist_to_whitelist", this.config.getBoolean("blacklist_to_whitelist"));
|
obj.addProperty("blacklist_to_whitelist", this.config.getBoolean("blacklist_to_whitelist"));
|
||||||
obj.addProperty("block_undefined_origin", this.config.getBoolean("block_undefined_origin"));
|
obj.addProperty("block_undefined_origin", this.config.getBoolean("block_undefined_origin"));
|
||||||
final Json5Object bObj = new Json5Object();
|
final Json5Object bObj = new Json5Object();
|
||||||
@@ -317,6 +336,14 @@ public final class OriginBlacklist {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final String getDataDir() {
|
||||||
|
return "plugins/" + plugin.getPluginId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final IEaglerXServerAPI getEaglerAPI() {
|
||||||
|
return this.plugin.getEaglerAPI();
|
||||||
|
}
|
||||||
|
|
||||||
private final Component getBlacklistedComponent(final String type, final String id, final String blockType,
|
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 blockTypeAlt, final String notAllowed, final String notAllowedAlt, final String blockValue,
|
||||||
final String action) {
|
final String action) {
|
||||||
@@ -341,13 +368,13 @@ public final class OriginBlacklist {
|
|||||||
if (this.config.getBoolean("discord.enabled")) {
|
if (this.config.getBoolean("discord.enabled")) {
|
||||||
final OPlayer player = event.getPlayer();
|
final OPlayer player = event.getPlayer();
|
||||||
final EnumConnectionType connType = event.getConnectionType();
|
final EnumConnectionType connType = event.getConnectionType();
|
||||||
final String userAgent;
|
/* final String userAgent;
|
||||||
if (connType == EnumConnectionType.EAGLER) {
|
if (connType == EnumConnectionType.EAGLER) {
|
||||||
final IEaglerLoginConnection loginConn = event.getEaglerEvent().getLoginConnection();
|
final IEaglerLoginConnection loginConn = event.getEaglerEvent().getLoginConnection();
|
||||||
userAgent = loginConn.getWebSocketHeader(EnumWebSocketHeader.HEADER_USER_AGENT);
|
userAgent = loginConn.getWebSocketHeader(EnumWebSocketHeader.HEADER_USER_AGENT);
|
||||||
} else {
|
} else {
|
||||||
userAgent = UNKNOWN_STR;
|
userAgent = UNKNOWN_STR;
|
||||||
}
|
} */
|
||||||
final byte[] payload = String.format(
|
final byte[] payload = String.format(
|
||||||
"""
|
"""
|
||||||
{
|
{
|
||||||
@@ -355,11 +382,11 @@ public final class OriginBlacklist {
|
|||||||
"embeds": [
|
"embeds": [
|
||||||
{
|
{
|
||||||
"title": "-------- Player Information --------",
|
"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,
|
"color": 15801922,
|
||||||
"fields": [],
|
"fields": [],
|
||||||
"footer": {
|
"footer": {
|
||||||
"text": "OriginBlacklist v%s",
|
"text": "%s v%s",
|
||||||
"icon_url": "https://raw.githubusercontent.com/%s/refs/heads/main/img/icon.png"
|
"icon_url": "https://raw.githubusercontent.com/%s/refs/heads/main/img/icon.png"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,12 +413,14 @@ public final class OriginBlacklist {
|
|||||||
player.getName().replaceAll("_", "\\_"),
|
player.getName().replaceAll("_", "\\_"),
|
||||||
player.getOrigin(),
|
player.getOrigin(),
|
||||||
player.getBrand(),
|
player.getBrand(),
|
||||||
this.config.getBoolean("discord.send_ips") ? player.getAddr() : "*\\*CENSORED\\**",
|
this.config.getBoolean("discord.send_ips") ? player.getAddr() : CENSORED_STR,
|
||||||
player.getPVN(),
|
player.getPVN(),
|
||||||
userAgent,
|
player.getVHost(),
|
||||||
|
// userAgent,
|
||||||
player.isRewind() ? "YES" : "NO",
|
player.isRewind() ? "YES" : "NO",
|
||||||
connType.toString(),
|
connType.toString(),
|
||||||
this.plugin.getPluginVersion(),
|
BuildInfo.get("plugin_name"),
|
||||||
|
this.plugin.getPluginVersion() + " • " + COMMIT_S,
|
||||||
PLUGIN_REPO,
|
PLUGIN_REPO,
|
||||||
PLUGIN_REPO).getBytes();
|
PLUGIN_REPO).getBytes();
|
||||||
final Json5Array arr = this.config.get("discord.webhook_urls").getAsJson5Array();
|
final Json5Array arr = this.config.get("discord.webhook_urls").getAsJson5Array();
|
||||||
@@ -435,6 +464,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) {
|
public static final String getComponentString(final Component comp) {
|
||||||
return LegacyComponentSerializer.legacySection().serialize(comp);
|
return LegacyComponentSerializer.legacySection().serialize(comp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,14 +149,14 @@ public class OriginBlacklistCommand implements ICommand {
|
|||||||
ctx.reply("<aqua>Commands:</aqua>");
|
ctx.reply("<aqua>Commands:</aqua>");
|
||||||
ctx.reply("<gray> - /originblacklist reload</gray>");
|
ctx.reply("<gray> - /originblacklist reload</gray>");
|
||||||
ctx.reply("<gray> - /originblacklist update</gray>");
|
ctx.reply("<gray> - /originblacklist update</gray>");
|
||||||
ctx.reply("<gray> - /originblacklist add <origin/brand/name/ip> <argB></gray>");
|
ctx.reply("<gray> - /originblacklist add <origin/brand/name/ip> <arg></gray>");
|
||||||
ctx.reply("<gray> - /originblacklist remove <origin/brand/name/ip> <argB></gray>");
|
ctx.reply("<gray> - /originblacklist remove <origin/brand/name/ip> <arg></gray>");
|
||||||
ctx.reply("<gray> - /originblacklist test <argB></gray>");
|
ctx.reply("<gray> - /originblacklist test <arg></gray>");
|
||||||
ctx.reply("<gray> - /originblacklist list</gray>");
|
ctx.reply("<gray> - /originblacklist list</gray>");
|
||||||
}
|
}
|
||||||
|
|
||||||
private final boolean isBlacklisted(final String str) {
|
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;
|
return this.plugin.testBlacklist(player) != EnumBlacklistType.NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package xyz.webmc.originblacklist.base.config;
|
package xyz.webmc.originblacklist.base.config;
|
||||||
|
|
||||||
import xyz.webmc.originblacklist.base.OriginBlacklist;
|
import xyz.webmc.originblacklist.base.OriginBlacklist;
|
||||||
import xyz.webmc.originblacklist.base.util.IOriginBlacklistPlugin;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@@ -12,6 +11,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
@@ -22,6 +22,8 @@ import de.marhali.json5.Json5Object;
|
|||||||
import de.marhali.json5.Json5Primitive;
|
import de.marhali.json5.Json5Primitive;
|
||||||
|
|
||||||
public final class OriginBlacklistConfig {
|
public final class OriginBlacklistConfig {
|
||||||
|
private static final Json5Object DEFAULT_CONFIG = getDefaultConfig();
|
||||||
|
|
||||||
private final Json5 json5;
|
private final Json5 json5;
|
||||||
private final File file;
|
private final File file;
|
||||||
private final Path filePath;
|
private final Path filePath;
|
||||||
@@ -31,7 +33,7 @@ public final class OriginBlacklistConfig {
|
|||||||
private byte[] icon;
|
private byte[] icon;
|
||||||
private String icon64;
|
private String icon64;
|
||||||
|
|
||||||
public OriginBlacklistConfig(final IOriginBlacklistPlugin plugin) {
|
public OriginBlacklistConfig(final OriginBlacklist plugin) {
|
||||||
this.json5 = Json5.builder(builder -> builder
|
this.json5 = Json5.builder(builder -> builder
|
||||||
.quoteless()
|
.quoteless()
|
||||||
.quoteSingle()
|
.quoteSingle()
|
||||||
@@ -39,10 +41,10 @@ public final class OriginBlacklistConfig {
|
|||||||
.writeComments()
|
.writeComments()
|
||||||
.prettyPrinting()
|
.prettyPrinting()
|
||||||
.build());
|
.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.filePath = file.toPath();
|
||||||
this.iconFile = new File(dir + "/blacklisted.png");
|
this.iconFile = new File(plugin.getDataDir() + "/blacklisted.png");
|
||||||
this.iconPath = iconFile.toPath();
|
this.iconPath = iconFile.toPath();
|
||||||
this.loadConfig();
|
this.loadConfig();
|
||||||
}
|
}
|
||||||
@@ -71,16 +73,14 @@ public final class OriginBlacklistConfig {
|
|||||||
Json5Element parsed = this.json5.parse(text);
|
Json5Element parsed = this.json5.parse(text);
|
||||||
if (parsed instanceof Json5Object) {
|
if (parsed instanceof Json5Object) {
|
||||||
this.config = (Json5Object) parsed;
|
this.config = (Json5Object) parsed;
|
||||||
if (merge(this.config, getDefaultConfig())) {
|
merge(this.config, DEFAULT_CONFIG);
|
||||||
this.saveConfig();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("Config must be an object!");
|
throw new IOException("Config must be an object!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.config = getDefaultConfig();
|
this.config = DEFAULT_CONFIG;
|
||||||
this.saveConfig();
|
|
||||||
}
|
}
|
||||||
|
this.saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void reloadIconImage() {
|
private final void reloadIconImage() {
|
||||||
@@ -207,7 +207,6 @@ public final class OriginBlacklistConfig {
|
|||||||
} else {
|
} else {
|
||||||
element = null;
|
element = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element == null) {
|
if (element == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -313,36 +312,166 @@ public final class OriginBlacklistConfig {
|
|||||||
addJSONObj(uObj, "check_timer", Json5Primitive.fromNumber(3600), null);
|
addJSONObj(uObj, "check_timer", Json5Primitive.fromNumber(3600), null);
|
||||||
addJSONObj(uObj, "auto_update", Json5Primitive.fromBoolean(true), null);
|
addJSONObj(uObj, "auto_update", Json5Primitive.fromBoolean(true), null);
|
||||||
addJSONObj(obj, "update_checker", uObj, null);
|
addJSONObj(obj, "update_checker", uObj, null);
|
||||||
final Json5Object hObj = new Json5Object();
|
addJSONObj(obj, "blacklist_http_api", Json5Primitive.fromBoolean(false), null);
|
||||||
addJSONObj(hObj, "enabled", Json5Primitive.fromBoolean(false), null);
|
|
||||||
addJSONObj(hObj, "http_port", Json5Primitive.fromNumber(8080), null);
|
|
||||||
addJSONObj(hObj, "listen_addr", Json5Primitive.fromString("0.0.0.0"), null);
|
|
||||||
addJSONObj(obj, "blacklist_http_share", hObj, null);
|
|
||||||
addJSONObj(obj, "blacklist_to_whitelist", Json5Primitive.fromBoolean(false), null);
|
addJSONObj(obj, "blacklist_to_whitelist", Json5Primitive.fromBoolean(false), null);
|
||||||
addJSONObj(obj, "block_undefined_origin", Json5Primitive.fromBoolean(false), null);
|
addJSONObj(obj, "block_undefined_origin", Json5Primitive.fromBoolean(false), null);
|
||||||
addJSONObj(obj, "bStats", Json5Primitive.fromBoolean(true), 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");
|
addJSONObj(obj, "config_version", Json5Primitive.fromNumber(1), "DO NOT CHANGE");
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final boolean merge(final Json5Object a, final Json5Object b) {
|
private static final boolean merge(final Json5Object aObj, final Json5Object bObj) {
|
||||||
|
final Json5Object ret = new Json5Object();
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
for (final String key : bObj.keySet()) {
|
||||||
for (String key : b.keySet()) {
|
final Json5Element dv = bObj.get(key);
|
||||||
Json5Element element = b.get(key);
|
if (aObj.has(key)) {
|
||||||
if (!a.has(key)) {
|
final Json5Element v = aObj.get(key);
|
||||||
a.add(key, element.deepCopy());
|
if (dv instanceof Json5Object) {
|
||||||
changed = true;
|
if (v instanceof Json5Object) {
|
||||||
} else {
|
final boolean c = merge((Json5Object) v, (Json5Object) dv);
|
||||||
final Json5Element _element = a.get(key);
|
ret.add(key, (Json5Object) v);
|
||||||
if (_element instanceof Json5Object objA && element instanceof Json5Object objB) {
|
if (c) {
|
||||||
if (merge(objA, objB)) {
|
changed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret.add(key, dv.deepCopy());
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
} else if (dv instanceof Json5Array) {
|
||||||
|
if (v instanceof Json5Array) {
|
||||||
|
final Json5Array vArr = (Json5Array) v;
|
||||||
|
final Json5Array dArr = (Json5Array) dv;
|
||||||
|
if (dArr.size() == 0) {
|
||||||
|
ret.add(key, vArr.deepCopy());
|
||||||
|
} else {
|
||||||
|
final Json5Element d0 = dArr.get(0);
|
||||||
|
if (d0 instanceof Json5Primitive && ((Json5Primitive) d0).isString()) {
|
||||||
|
final Json5Array out = new Json5Array();
|
||||||
|
for (final Json5Element e : vArr) {
|
||||||
|
if (e instanceof Json5Primitive && ((Json5Primitive) e).isString()) {
|
||||||
|
out.add(e.deepCopy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (out.size() > 0) {
|
||||||
|
if (out.size() != vArr.size()) {
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
ret.add(key, out);
|
||||||
|
} else {
|
||||||
|
ret.add(key, dArr.deepCopy());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boolean a = true;
|
||||||
|
for (final Json5Element e : vArr) {
|
||||||
|
if (e == null) {
|
||||||
|
a = false;
|
||||||
|
} else if (d0 instanceof Json5Object) {
|
||||||
|
if (!(e instanceof Json5Object)) {
|
||||||
|
a = false;
|
||||||
|
}
|
||||||
|
} else if (d0 instanceof Json5Array) {
|
||||||
|
if (!(e instanceof Json5Array)) {
|
||||||
|
a = false;
|
||||||
|
}
|
||||||
|
} else if (d0 instanceof Json5Primitive && e instanceof Json5Primitive) {
|
||||||
|
final Json5Primitive bp = (Json5Primitive) d0;
|
||||||
|
final Json5Primitive ap = (Json5Primitive) e;
|
||||||
|
if (bp.isBoolean()) {
|
||||||
|
if (!ap.isBoolean()) {
|
||||||
|
a = false;
|
||||||
|
}
|
||||||
|
} else if (bp.isNumber()) {
|
||||||
|
if (!ap.isNumber()) {
|
||||||
|
a = false;
|
||||||
|
}
|
||||||
|
} else if (bp.isString()) {
|
||||||
|
if (!ap.isString()) {
|
||||||
|
a = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
a = false;
|
||||||
|
}
|
||||||
|
if (!a) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (a) {
|
||||||
|
ret.add(key, vArr.deepCopy());
|
||||||
|
} else {
|
||||||
|
ret.add(key, dArr.deepCopy());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret.add(key, dv.deepCopy());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
} else if (dv instanceof Json5Primitive) {
|
||||||
|
if (v instanceof Json5Primitive) {
|
||||||
|
final Json5Primitive dp = (Json5Primitive) dv;
|
||||||
|
final Json5Primitive vp = (Json5Primitive) v;
|
||||||
|
if (dp.isBoolean()) {
|
||||||
|
if (vp.isBoolean()) {
|
||||||
|
ret.add(key, vp.deepCopy());
|
||||||
|
} else {
|
||||||
|
ret.add(key, dv.deepCopy());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
} else if (dp.isNumber()) {
|
||||||
|
if (vp.isNumber()) {
|
||||||
|
ret.add(key, vp.deepCopy());
|
||||||
|
} else {
|
||||||
|
ret.add(key, dv.deepCopy());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
} else if (dp.isString()) {
|
||||||
|
if (vp.isString()) {
|
||||||
|
ret.add(key, vp.deepCopy());
|
||||||
|
} else {
|
||||||
|
ret.add(key, dv.deepCopy());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret.add(key, dv.deepCopy());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret.add(key, dv.deepCopy());
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret.add(key, dv.deepCopy());
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ret.add(key, dv.deepCopy());
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (final String key : aObj.keySet()) {
|
||||||
|
if (!bObj.has(key)) {
|
||||||
|
ret.add(key, aObj.get(key).deepCopy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final String key : aObj.keySet()) {
|
||||||
|
if (!bObj.has(key)) {
|
||||||
|
ret.add(key, aObj.get(key).deepCopy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final String k : new ArrayList<>(aObj.keySet())) {
|
||||||
|
aObj.remove(k);
|
||||||
|
}
|
||||||
|
for (final String k : ret.keySet()) {
|
||||||
|
aObj.add(k, ret.get(k));
|
||||||
|
}
|
||||||
|
for (final String key : ret.keySet()) {
|
||||||
|
aObj.add(key, ret.get(key));
|
||||||
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
package xyz.webmc.originblacklist.base.http;
|
|
||||||
|
|
||||||
import xyz.webmc.originblacklist.base.OriginBlacklist;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
|
||||||
import com.sun.net.httpserver.HttpHandler;
|
|
||||||
|
|
||||||
public class OriginBlacklistHTTPHandler implements HttpHandler {
|
|
||||||
private final OriginBlacklist plugin;
|
|
||||||
|
|
||||||
public OriginBlacklistHTTPHandler(final OriginBlacklist plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void handle(final HttpExchange exchange) throws IOException {
|
|
||||||
try {
|
|
||||||
final String path = exchange.getRequestURI().getPath();
|
|
||||||
if ("/".equals(path)) {
|
|
||||||
final byte[] bytes = this.plugin.getBlacklistShare().getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
exchange.getResponseHeaders().set("Content-Type", "application/json; charset=utf-8");
|
|
||||||
exchange.sendResponseHeaders(200, bytes.length);
|
|
||||||
|
|
||||||
try (final OutputStream os = exchange.getResponseBody()) {
|
|
||||||
os.write(bytes);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
exchange.sendResponseHeaders(404, -1);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
exchange.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
package xyz.webmc.originblacklist.base.http;
|
|
||||||
|
|
||||||
import xyz.webmc.originblacklist.base.OriginBlacklist;
|
|
||||||
import xyz.webmc.originblacklist.base.config.OriginBlacklistConfig;
|
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpServer;
|
|
||||||
|
|
||||||
public class OriginBlacklistHTTPServer {
|
|
||||||
private final OriginBlacklist plugin;
|
|
||||||
private final ExecutorService executor;
|
|
||||||
private HttpServer server;
|
|
||||||
private boolean running;
|
|
||||||
|
|
||||||
public OriginBlacklistHTTPServer(final OriginBlacklist plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.executor = Executors.newFixedThreadPool(4);
|
|
||||||
this.running = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void start() {
|
|
||||||
if (!this.running) {
|
|
||||||
try {
|
|
||||||
this.server = this.createServer();
|
|
||||||
this.server.start();
|
|
||||||
this.running = true;
|
|
||||||
} catch (final Throwable t) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void stop() {
|
|
||||||
if (this.running && this.server != null) {
|
|
||||||
this.server.stop(0);
|
|
||||||
this.running = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void shutdown() {
|
|
||||||
this.stop();
|
|
||||||
this.executor.shutdownNow();
|
|
||||||
}
|
|
||||||
|
|
||||||
private final HttpServer createServer() throws Throwable {
|
|
||||||
final OriginBlacklistConfig config = this.plugin.getConfig();
|
|
||||||
final HttpServer server = HttpServer
|
|
||||||
.create(new InetSocketAddress(config.getString("blacklist_http_share.listen_addr"),
|
|
||||||
config.getInteger("blacklist_http_share.http_port")), 0);
|
|
||||||
server.createContext("/", new OriginBlacklistHTTPHandler(this.plugin));
|
|
||||||
server.setExecutor(executor);
|
|
||||||
return server;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package xyz.webmc.originblacklist.base.http;
|
||||||
|
|
||||||
|
import xyz.webmc.originblacklist.base.OriginBlacklist;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.backend.server.api.webserver.IRequestContext;
|
||||||
|
import net.lax1dude.eaglercraft.backend.server.api.webserver.IRequestHandler;
|
||||||
|
import net.lax1dude.eaglercraft.backend.server.api.webserver.RouteDesc;
|
||||||
|
|
||||||
|
public class OriginBlacklistRequestHandler implements IRequestHandler {
|
||||||
|
private static final RouteDesc route = RouteDesc.create("/originblacklist/v2/");
|
||||||
|
private final OriginBlacklist plugin;
|
||||||
|
|
||||||
|
public OriginBlacklistRequestHandler(final OriginBlacklist plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void handleRequest(final IRequestContext ctx) {
|
||||||
|
final String path = ctx.getPath();
|
||||||
|
if (route.getPattern().equals(path)) {
|
||||||
|
final byte[] bytes = this.plugin.getBlacklistShare().getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
ctx.addResponseHeader("Content-Type", "application/json; charset=utf-8");
|
||||||
|
ctx.setResponseCode(200);
|
||||||
|
ctx.setResponseBody(bytes);
|
||||||
|
} else {
|
||||||
|
ctx.getServer().get404Handler().handleRequest(ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final void register(final OriginBlacklist plugin) {
|
||||||
|
plugin.getEaglerAPI().getWebServer().registerRoute(plugin, route, new OriginBlacklistRequestHandler(plugin));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final void unRegister(final OriginBlacklist plugin) {
|
||||||
|
plugin.getEaglerAPI().getWebServer().unregisterRoute(plugin, route);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,8 +8,10 @@ import java.nio.file.Path;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.lax1dude.eaglercraft.backend.server.api.IEaglerXServerAPI;
|
||||||
import org.semver4j.Semver;
|
import org.semver4j.Semver;
|
||||||
|
|
||||||
|
@SuppressWarnings({ "rawtypes" })
|
||||||
public interface IOriginBlacklistPlugin {
|
public interface IOriginBlacklistPlugin {
|
||||||
public String getPluginId();
|
public String getPluginId();
|
||||||
|
|
||||||
@@ -17,6 +19,8 @@ public interface IOriginBlacklistPlugin {
|
|||||||
|
|
||||||
public Path getPluginJarPath();
|
public Path getPluginJarPath();
|
||||||
|
|
||||||
|
public IEaglerXServerAPI getEaglerAPI();
|
||||||
|
|
||||||
public void log(final EnumLogLevel level, final String txt);
|
public void log(final EnumLogLevel level, final String txt);
|
||||||
|
|
||||||
public void kickPlayer(final Component txt, final OriginBlacklistLoginEvent event);
|
public void kickPlayer(final Component txt, final OriginBlacklistLoginEvent event);
|
||||||
|
|||||||
@@ -16,16 +16,18 @@ public final class OPlayer {
|
|||||||
private final String name;
|
private final String name;
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
private final String brand;
|
private final String brand;
|
||||||
|
private final String vhost;
|
||||||
private final boolean rewind;
|
private final boolean rewind;
|
||||||
private final int pvn;
|
private final int pvn;
|
||||||
|
|
||||||
public OPlayer(final IEaglerConnection conn, final String name, final UUID uuid, final String addr,
|
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.name = name;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
this.origin = conn.getWebSocketHeader(EnumWebSocketHeader.HEADER_ORIGIN);
|
this.origin = conn.getWebSocketHeader(EnumWebSocketHeader.HEADER_ORIGIN);
|
||||||
this.addr = formatSocketAddress(conn.getSocketAddress());
|
this.addr = formatSocketAddress(conn.getSocketAddress());
|
||||||
|
this.vhost = conn.isWebSocketSecure() ? "wss://" : "ws://" + conn.getWebSocketHost();
|
||||||
if (conn instanceof IEaglerLoginConnection) {
|
if (conn instanceof IEaglerLoginConnection) {
|
||||||
final IEaglerLoginConnection loginConn = (IEaglerLoginConnection) conn;
|
final IEaglerLoginConnection loginConn = (IEaglerLoginConnection) conn;
|
||||||
this.brand = loginConn.getEaglerBrandString();
|
this.brand = loginConn.getEaglerBrandString();
|
||||||
@@ -40,13 +42,14 @@ public final class OPlayer {
|
|||||||
this.origin = OriginBlacklist.UNKNOWN_STR;
|
this.origin = OriginBlacklist.UNKNOWN_STR;
|
||||||
this.addr = formatIPAddress(addr);
|
this.addr = formatIPAddress(addr);
|
||||||
this.brand = brand;
|
this.brand = brand;
|
||||||
|
this.vhost = vhost;
|
||||||
this.rewind = false;
|
this.rewind = false;
|
||||||
this.pvn = pvn;
|
this.pvn = pvn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OPlayer(final IEaglerConnection conn, final String name, final UUID uuid) {
|
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() {
|
public final String getOrigin() {
|
||||||
@@ -69,6 +72,10 @@ public final class OPlayer {
|
|||||||
return this.brand;
|
return this.brand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final String getVHost() {
|
||||||
|
return this.vhost;
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean isRewind() {
|
public final boolean isRewind() {
|
||||||
return this.rewind;
|
return this.rewind;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
|||||||
private boolean papiPlaceholdersEnabled;
|
private boolean papiPlaceholdersEnabled;
|
||||||
private Object papi;
|
private Object papi;
|
||||||
private OriginBlacklist blacklist;
|
private OriginBlacklist blacklist;
|
||||||
private IEaglerXServerAPI eaglerAPI;
|
|
||||||
private Metrics metrics;
|
private Metrics metrics;
|
||||||
|
|
||||||
private CachedServerIcon iconCache;
|
private CachedServerIcon iconCache;
|
||||||
@@ -73,7 +72,6 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
|||||||
this.papi = null;
|
this.papi = null;
|
||||||
}
|
}
|
||||||
this.blacklist = new OriginBlacklist(this);
|
this.blacklist = new OriginBlacklist(this);
|
||||||
this.eaglerAPI = EaglerXServerAPI.instance();
|
|
||||||
this.getCommand("originblacklist").setExecutor(new OriginBlacklistCommandBukkit(this.blacklist));
|
this.getCommand("originblacklist").setExecutor(new OriginBlacklistCommandBukkit(this.blacklist));
|
||||||
this.getServer().getPluginManager().registerEvents(this, this);
|
this.getServer().getPluginManager().registerEvents(this, this);
|
||||||
this.blacklist.init();
|
this.blacklist.init();
|
||||||
@@ -83,7 +81,7 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
|||||||
final Map<String, Integer> playerMap = new HashMap<>();
|
final Map<String, Integer> playerMap = new HashMap<>();
|
||||||
|
|
||||||
for (final Player player : Bukkit.getOnlinePlayers()) {
|
for (final Player player : Bukkit.getOnlinePlayers()) {
|
||||||
final boolean eagler = eaglerAPI.isEaglerPlayerByUUID(player.getUniqueId());
|
final boolean eagler = this.getEaglerAPI().isEaglerPlayerByUUID(player.getUniqueId());
|
||||||
final String key = eagler ? "Eagler" : "Java";
|
final String key = eagler ? "Eagler" : "Java";
|
||||||
playerMap.put(key, playerMap.getOrDefault(key, 0) + 1);
|
playerMap.put(key, playerMap.getOrDefault(key, 0) + 1);
|
||||||
}
|
}
|
||||||
@@ -112,15 +110,14 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public final void onJavaLogin(final AsyncPlayerPreLoginEvent event) {
|
public final void onJavaLogin(final AsyncPlayerPreLoginEvent event) {
|
||||||
final OPlayer player = new OPlayer(null, event.getName(), event.getUniqueId(),
|
final OPlayer player = new OPlayer(null, event.getName(), event.getUniqueId(), event.getAddress().toString(),
|
||||||
event.getAddress() != null ? event.getAddress().toString() : null, OriginBlacklist.UNKNOWN_STR, -1);
|
OriginBlacklist.UNKNOWN_STR, OriginBlacklist.UNKNOWN_STR, -1);
|
||||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
|
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public final void onJavaMOTD(final ServerListPingEvent event) {
|
public final void onJavaMOTD(final ServerListPingEvent event) {
|
||||||
final OPlayer player = new OPlayer(null, null, null,
|
final OPlayer player = new OPlayer(null, null, null, event.getAddress().toString(), null, null, -1);
|
||||||
event.getAddress() != null ? event.getAddress().toString() : null, null, -1);
|
|
||||||
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
|
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +136,11 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
|||||||
return Paths.get(this.getFile().getAbsolutePath());
|
return Paths.get(this.getFile().getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final IEaglerXServerAPI getEaglerAPI() {
|
||||||
|
return EaglerXServerAPI.instance();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void log(final EnumLogLevel level, final String txt) {
|
public final void log(final EnumLogLevel level, final String txt) {
|
||||||
if (level == EnumLogLevel.WARN) {
|
if (level == EnumLogLevel.WARN) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
|||||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||||
import xyz.webmc.originblacklist.bungee.command.OriginBlacklistCommandBungee;
|
import xyz.webmc.originblacklist.bungee.command.OriginBlacklistCommandBungee;
|
||||||
|
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
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.lax1dude.eaglercraft.backend.server.api.bungee.event.EaglercraftMOTDEvent;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.ServerPing;
|
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.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||||
import net.md_5.bungee.api.event.PreLoginEvent;
|
import net.md_5.bungee.api.event.PreLoginEvent;
|
||||||
@@ -41,7 +43,6 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
|||||||
private boolean papiPlaceholdersEnabled;
|
private boolean papiPlaceholdersEnabled;
|
||||||
private Object papi;
|
private Object papi;
|
||||||
private OriginBlacklist blacklist;
|
private OriginBlacklist blacklist;
|
||||||
private IEaglerXServerAPI eaglerAPI;
|
|
||||||
private Metrics metrics;
|
private Metrics metrics;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,8 +70,8 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
|||||||
this.papi = null;
|
this.papi = null;
|
||||||
}
|
}
|
||||||
this.blacklist = new OriginBlacklist(this);
|
this.blacklist = new OriginBlacklist(this);
|
||||||
this.eaglerAPI = EaglerXServerAPI.instance();
|
this.getProxy().getPluginManager().registerCommand(this,
|
||||||
this.getProxy().getPluginManager().registerCommand(this, new OriginBlacklistCommandBungee(this, this.blacklist, "originblacklist"));
|
new OriginBlacklistCommandBungee(this, this.blacklist, "originblacklist"));
|
||||||
this.getProxy().getPluginManager().registerListener(this, this);
|
this.getProxy().getPluginManager().registerListener(this, this);
|
||||||
this.blacklist.init();
|
this.blacklist.init();
|
||||||
if (this.blacklist.isMetricsEnabled()) {
|
if (this.blacklist.isMetricsEnabled()) {
|
||||||
@@ -79,7 +80,7 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
|||||||
final Map<String, Integer> playerMap = new HashMap<>();
|
final Map<String, Integer> playerMap = new HashMap<>();
|
||||||
|
|
||||||
for (final ProxiedPlayer player : this.proxy.getPlayers()) {
|
for (final ProxiedPlayer player : this.proxy.getPlayers()) {
|
||||||
final boolean eagler = eaglerAPI.isEaglerPlayerByUUID(player.getUniqueId());
|
final boolean eagler = this.getEaglerAPI().isEaglerPlayerByUUID(player.getUniqueId());
|
||||||
final String key = eagler ? "Eagler" : "Java";
|
final String key = eagler ? "Eagler" : "Java";
|
||||||
playerMap.put(key, playerMap.getOrDefault(key, 0) + 1);
|
playerMap.put(key, playerMap.getOrDefault(key, 0) + 1);
|
||||||
}
|
}
|
||||||
@@ -108,21 +109,30 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public final void onJavaLogin(final PostLoginEvent event) {
|
public final void onJavaLogin(final PostLoginEvent event) {
|
||||||
|
final PendingConnection conn = event.getPlayer().getPendingConnection();
|
||||||
|
final InetSocketAddress vhost = conn.getVirtualHost();
|
||||||
final ProxiedPlayer aPlayer = event.getPlayer();
|
final ProxiedPlayer aPlayer = event.getPlayer();
|
||||||
final OPlayer bPlayer = new OPlayer(null, aPlayer.getName(), aPlayer.getUniqueId(),
|
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));
|
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, bPlayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public final void onJavaHandshake(final PreLoginEvent event) {
|
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));
|
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public final void onJavaMOTD(final ProxyPingEvent event) {
|
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));
|
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +151,11 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
|||||||
return Paths.get(this.getFile().getAbsolutePath());
|
return Paths.get(this.getFile().getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final IEaglerXServerAPI getEaglerAPI() {
|
||||||
|
return EaglerXServerAPI.instance();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void log(final EnumLogLevel level, final String txt) {
|
public final void log(final EnumLogLevel level, final String txt) {
|
||||||
if (level == EnumLogLevel.WARN) {
|
if (level == EnumLogLevel.WARN) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
|||||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||||
import xyz.webmc.originblacklist.velocity.command.OriginBlacklistCommandVelocity;
|
import xyz.webmc.originblacklist.velocity.command.OriginBlacklistCommandVelocity;
|
||||||
|
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
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.ProxyPingEvent;
|
||||||
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
|
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
|
||||||
import com.velocitypowered.api.plugin.PluginContainer;
|
import com.velocitypowered.api.plugin.PluginContainer;
|
||||||
|
import com.velocitypowered.api.proxy.InboundConnection;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import com.velocitypowered.api.proxy.server.ServerPing;
|
import com.velocitypowered.api.proxy.server.ServerPing;
|
||||||
@@ -52,7 +54,6 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
|||||||
private boolean papiPlaceholdersEnabled;
|
private boolean papiPlaceholdersEnabled;
|
||||||
private Object papi;
|
private Object papi;
|
||||||
private OriginBlacklist blacklist;
|
private OriginBlacklist blacklist;
|
||||||
private IEaglerXServerAPI eaglerAPI;
|
|
||||||
private Metrics metrics;
|
private Metrics metrics;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -87,7 +88,6 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
|||||||
this.papi = null;
|
this.papi = null;
|
||||||
}
|
}
|
||||||
this.blacklist = new OriginBlacklist(this);
|
this.blacklist = new OriginBlacklist(this);
|
||||||
this.eaglerAPI = EaglerXServerAPI.instance();
|
|
||||||
this.proxy.getCommandManager().register("originblacklist", new OriginBlacklistCommandVelocity(this.blacklist));
|
this.proxy.getCommandManager().register("originblacklist", new OriginBlacklistCommandVelocity(this.blacklist));
|
||||||
this.blacklist.init();
|
this.blacklist.init();
|
||||||
if (this.blacklist.isMetricsEnabled()) {
|
if (this.blacklist.isMetricsEnabled()) {
|
||||||
@@ -96,7 +96,7 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
|||||||
final Map<String, Integer> playerMap = new HashMap<>();
|
final Map<String, Integer> playerMap = new HashMap<>();
|
||||||
|
|
||||||
for (final Player player : this.proxy.getAllPlayers()) {
|
for (final Player player : this.proxy.getAllPlayers()) {
|
||||||
final boolean eagler = eaglerAPI.isEaglerPlayerByUUID(player.getUniqueId());
|
final boolean eagler = this.getEaglerAPI().isEaglerPlayerByUUID(player.getUniqueId());
|
||||||
final String key = eagler ? "Eagler" : "Java";
|
final String key = eagler ? "Eagler" : "Java";
|
||||||
playerMap.put(key, playerMap.getOrDefault(key, 0) + 1);
|
playerMap.put(key, playerMap.getOrDefault(key, 0) + 1);
|
||||||
}
|
}
|
||||||
@@ -125,24 +125,30 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
|||||||
|
|
||||||
@Subscribe(order = PostOrder.FIRST)
|
@Subscribe(order = PostOrder.FIRST)
|
||||||
public final void onJavaLogin(final PreLoginEvent event) {
|
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(),
|
final OPlayer player = new OPlayer(null, event.getUsername(), event.getUniqueId(),
|
||||||
event.getConnection().getRemoteAddress().toString(), OriginBlacklist.UNKNOWN_STR,
|
conn.getRemoteAddress().toString(), OriginBlacklist.UNKNOWN_STR, vhost.getHostString() + vhost.getPort(),
|
||||||
event.getConnection().getProtocolVersion().getProtocol());
|
conn.getProtocolVersion().getProtocol());
|
||||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
|
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(order = PostOrder.FIRST)
|
@Subscribe(order = PostOrder.FIRST)
|
||||||
public final void onJavaHandshake(final PlayerClientBrandEvent event) {
|
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(),
|
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());
|
event.getPlayer().getProtocolVersion().getProtocol());
|
||||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, bPlayer));
|
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, bPlayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(order = PostOrder.LAST)
|
@Subscribe(order = PostOrder.LAST)
|
||||||
public final void onJavaMOTD(final ProxyPingEvent event) {
|
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);
|
null, -1);
|
||||||
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
|
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(null, event, EnumConnectionType.JAVA, player));
|
||||||
}
|
}
|
||||||
@@ -166,6 +172,11 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final IEaglerXServerAPI getEaglerAPI() {
|
||||||
|
return EaglerXServerAPI.instance();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void log(final EnumLogLevel level, final String txt) {
|
public final void log(final EnumLogLevel level, final String txt) {
|
||||||
if (level == EnumLogLevel.WARN) {
|
if (level == EnumLogLevel.WARN) {
|
||||||
|
|||||||
Reference in New Issue
Block a user