diff --git a/bin/main/bungee.yml b/bin/main/bungee.yml
new file mode 100644
index 0000000..7916bf5
--- /dev/null
+++ b/bin/main/bungee.yml
@@ -0,0 +1,7 @@
+name: OriginBlacklist
+version: ${version}
+main: dev.colbster937.originblacklist.bungee.OriginBlacklistBungee
+description: ${description}
+author: Colbster937
+depends:
+ - EaglercraftXServer
\ No newline at end of file
diff --git a/bin/main/config.yml b/bin/main/config.yml
new file mode 100644
index 0000000..ca5640e
--- /dev/null
+++ b/bin/main/config.yml
@@ -0,0 +1,69 @@
+messages:
+ # Valid Placeholders:
+ # - %blocked% - The player's origin/brand that was blocked
+ # - %blocktype% - Shows what the player was blocked for
+ # - %easyblocktype% - Shows what the player was blocked for in an eagler-kid readable form
+
+ kick: |
+ This %easyblocktype% is not allowed on the server!
+ » %blocked% «
+
+ Think this is a mistake? Join our discord:
+ discord.gg/changethisintheconfig
+
+ motd:
+ enabled: true
+ text: |
+ This %easyblocktype% is not allowed!
+ » %blocked% «
+ icon: "blacklisted.png"
+
+# Origin + Brand blacklist supports wildcards
+# Everything should be lowercase
+blacklist:
+ origins:
+ - "hack.example.com"
+ brands:
+ - "*dragonx*"
+ - "*piclient*"
+ missing_origin: false
+
+discord:
+ webhook: ""
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# :>
\ No newline at end of file
diff --git a/bin/main/dev/colbster937/originblacklist/base/Base$LoggerAdapter.class b/bin/main/dev/colbster937/originblacklist/base/Base$LoggerAdapter.class
new file mode 100644
index 0000000..6e15c25
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/base/Base$LoggerAdapter.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/base/Base.class b/bin/main/dev/colbster937/originblacklist/base/Base.class
new file mode 100644
index 0000000..c7057fd
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/base/Base.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/base/Command$CommandContext.class b/bin/main/dev/colbster937/originblacklist/base/Command$CommandContext.class
new file mode 100644
index 0000000..f162159
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/base/Command$CommandContext.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/base/Command.class b/bin/main/dev/colbster937/originblacklist/base/Command.class
new file mode 100644
index 0000000..91c01d5
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/base/Command.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/base/ConfigManager$Blacklist.class b/bin/main/dev/colbster937/originblacklist/base/ConfigManager$Blacklist.class
new file mode 100644
index 0000000..9b5a4c5
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/base/ConfigManager$Blacklist.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/base/ConfigManager$Discord.class b/bin/main/dev/colbster937/originblacklist/base/ConfigManager$Discord.class
new file mode 100644
index 0000000..4013bee
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/base/ConfigManager$Discord.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/base/ConfigManager$MOTD.class b/bin/main/dev/colbster937/originblacklist/base/ConfigManager$MOTD.class
new file mode 100644
index 0000000..959cd47
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/base/ConfigManager$MOTD.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/base/ConfigManager$Messages.class b/bin/main/dev/colbster937/originblacklist/base/ConfigManager$Messages.class
new file mode 100644
index 0000000..f3f4c35
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/base/ConfigManager$Messages.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/base/ConfigManager.class b/bin/main/dev/colbster937/originblacklist/base/ConfigManager.class
new file mode 100644
index 0000000..30c31c6
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/base/ConfigManager.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/bukkit/CommandBukkit$1.class b/bin/main/dev/colbster937/originblacklist/bukkit/CommandBukkit$1.class
new file mode 100644
index 0000000..40160d7
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/bukkit/CommandBukkit$1.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/bukkit/CommandBukkit.class b/bin/main/dev/colbster937/originblacklist/bukkit/CommandBukkit.class
new file mode 100644
index 0000000..9674d6a
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/bukkit/CommandBukkit.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/bukkit/OriginBlacklistBukkit$1.class b/bin/main/dev/colbster937/originblacklist/bukkit/OriginBlacklistBukkit$1.class
new file mode 100644
index 0000000..1c8f2a4
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/bukkit/OriginBlacklistBukkit$1.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/bukkit/OriginBlacklistBukkit.class b/bin/main/dev/colbster937/originblacklist/bukkit/OriginBlacklistBukkit.class
new file mode 100644
index 0000000..8830248
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/bukkit/OriginBlacklistBukkit.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/bungee/CommandBungee$1.class b/bin/main/dev/colbster937/originblacklist/bungee/CommandBungee$1.class
new file mode 100644
index 0000000..b6f8737
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/bungee/CommandBungee$1.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/bungee/CommandBungee.class b/bin/main/dev/colbster937/originblacklist/bungee/CommandBungee.class
new file mode 100644
index 0000000..6b29473
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/bungee/CommandBungee.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/bungee/OriginBlacklistBungee$1.class b/bin/main/dev/colbster937/originblacklist/bungee/OriginBlacklistBungee$1.class
new file mode 100644
index 0000000..29e89be
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/bungee/OriginBlacklistBungee$1.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/bungee/OriginBlacklistBungee.class b/bin/main/dev/colbster937/originblacklist/bungee/OriginBlacklistBungee.class
new file mode 100644
index 0000000..b1367b9
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/bungee/OriginBlacklistBungee.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/velocity/CommandVelocity$1.class b/bin/main/dev/colbster937/originblacklist/velocity/CommandVelocity$1.class
new file mode 100644
index 0000000..99769cf
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/velocity/CommandVelocity$1.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/velocity/CommandVelocity.class b/bin/main/dev/colbster937/originblacklist/velocity/CommandVelocity.class
new file mode 100644
index 0000000..4ed656f
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/velocity/CommandVelocity.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/velocity/OriginBlacklistVelocity$1.class b/bin/main/dev/colbster937/originblacklist/velocity/OriginBlacklistVelocity$1.class
new file mode 100644
index 0000000..01a1bc6
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/velocity/OriginBlacklistVelocity$1.class differ
diff --git a/bin/main/dev/colbster937/originblacklist/velocity/OriginBlacklistVelocity.class b/bin/main/dev/colbster937/originblacklist/velocity/OriginBlacklistVelocity.class
new file mode 100644
index 0000000..a89ea54
Binary files /dev/null and b/bin/main/dev/colbster937/originblacklist/velocity/OriginBlacklistVelocity.class differ
diff --git a/bin/main/plugin.yml b/bin/main/plugin.yml
new file mode 100644
index 0000000..e583b2c
--- /dev/null
+++ b/bin/main/plugin.yml
@@ -0,0 +1,9 @@
+name: OriginBlacklist
+version: ${version}
+main: dev.colbster937.originblacklist.bukkit.OriginBlacklistBukkit
+description: ${description}
+author: Colbster937
+depend:
+ - EaglercraftXServer
+commands:
+ originblacklist:
\ No newline at end of file
diff --git a/bin/main/server-blocked.png b/bin/main/server-blocked.png
new file mode 100644
index 0000000..001ee13
Binary files /dev/null and b/bin/main/server-blocked.png differ
diff --git a/bin/main/velocity-plugin.json b/bin/main/velocity-plugin.json
new file mode 100644
index 0000000..bf1052d
--- /dev/null
+++ b/bin/main/velocity-plugin.json
@@ -0,0 +1,14 @@
+{
+ "id": "originblacklist",
+ "name": "OriginBlacklist",
+ "version": "${version}",
+ "description": "${description}",
+ "main": "dev.colbster937.originblacklist.velocity.OriginBlacklistVelocity",
+ "authors": ["Colbster937"],
+ "dependencies": [
+ {
+ "id": "eaglerxserver",
+ "optional": false
+ }
+ ]
+}
diff --git a/build.gradle b/build.gradle
index 96a4fd5..5df1ba4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,7 +8,7 @@ plugins {
group = 'dev.colbster937'
-version = '1.0.3'
+version = '1.0.4'
description = 'A reimplementation of OriginBlacklist for EaglerXServer'
def targetJavaVersion = 17
diff --git a/src/main/java/dev/colbster937/originblacklist/base/Base.java b/src/main/java/dev/colbster937/originblacklist/base/Base.java
index a787acb..4120522 100644
--- a/src/main/java/dev/colbster937/originblacklist/base/Base.java
+++ b/src/main/java/dev/colbster937/originblacklist/base/Base.java
@@ -66,14 +66,14 @@ public class Base {
if ((origin != "null" || origin != null) && !config.blacklist.missing_origin) {
for (String origin1 : config.blacklist.origins) {
if (matches(origin, origin1)) {
- e.setKickMessage(kick("origin", "website", origin));
+ setKickMessage(e, kick("origin", "website", origin));
webhook(conn, origin, brand, "origin");
return;
}
}
} else {
if (origin != "null" || origin != null) {
- e.setKickMessage(kick("origin", "website", origin));
+ setKickMessage(e, kick("origin", "website", origin));
webhook(conn, "null", brand, "origin");
return;
}
@@ -81,7 +81,7 @@ public class Base {
if (brand != "null" && brand != null) {
for (String brand1 : config.blacklist.brands) {
if (matches(brand, brand1)) {
- e.setKickMessage(kick("brand", "client", brand));
+ setKickMessage(e, kick("brand", "client", brand));
webhook(conn, origin, brand, "brand");
return;
}
@@ -89,19 +89,28 @@ public class Base {
}
}
+ public static void setKickMessage(IEaglercraftClientBrandEvent e, Component msg) {
+ try {
+ e.setKickMessage(msg);
+ } catch (Throwable ignored) {
+ String msg1 = LegacyComponentSerializer.legacySection().serialize(msg);
+ e.setKickMessage(msg1);
+ }
+ }
+
public static void handleMOTD(IEaglercraftMOTDEvent e) {
if (config.messages.motd.enabled) {
IMOTDConnection conn = e.getMOTDConnection();
String origin = conn.getWebSocketHeader(EnumWebSocketHeader.HEADER_ORIGIN);
List m = List.of(config.messages.motd.text.split("\n")).stream()
.map(line -> line
- .replace("%blocktype%", "origin")
- .replace("%easyblocktype%", "website")
- .replace("%blocked%", origin))
+ .replace("%blocktype%", "origin")
+ .replace("%easyblocktype%", "website")
+ .replace("%blocked%", origin))
.map(line -> LegacyComponentSerializer.legacySection().serialize(
- MiniMessage.miniMessage().deserialize(
- line
- )
+ MiniMessage.miniMessage().deserialize(
+ line
+ )
)).collect(Collectors.toList());
if ((origin != "null" || origin != null) && !config.blacklist.missing_origin) {
for (String origin1 : config.blacklist.origins) {
@@ -153,10 +162,10 @@ public class Base {
public static Component kick(String type, String easytype, String value) {
return MiniMessage.miniMessage().deserialize(
- config.messages.kick
- .replace("%blocktype%", type)
- .replace("%easyblocktype%", easytype)
- .replace("%blocked%", value)
+ config.messages.kick
+ .replace("%blocktype%", type)
+ .replace("%easyblocktype%", easytype)
+ .replace("%blocked%", value)
);
}
@@ -166,8 +175,8 @@ public class Base {
String addr = plr.getPlayerAddress() != null ? plr.getPlayerAddress().toString().substring(1) : "undefined";
String protocol = plr.isEaglerXRewindPlayer()
- ? (String.valueOf(plr.getRewindProtocolVersion()) != null ? String.valueOf(plr.getRewindProtocolVersion()) : "undefined")
- : (String.valueOf(plr.getMinecraftProtocol()) != null ? String.valueOf(plr.getMinecraftProtocol()) : "undefined");
+ ? (String.valueOf(plr.getRewindProtocolVersion()) != null ? String.valueOf(plr.getRewindProtocolVersion()) : "undefined")
+ : (String.valueOf(plr.getMinecraftProtocol()) != null ? String.valueOf(plr.getMinecraftProtocol()) : "undefined");
String rewind = plr.isEaglerXRewindPlayer() ? "Yes" : "No";
String userAgent = plr.getWebSocketHeader(EnumWebSocketHeader.HEADER_USER_AGENT);
if (userAgent == null || userAgent.isEmpty()) userAgent = "undefined";