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..e7e8b09 --- /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 + # - %host% - The IP the player pinged + + 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..1fcdc5f 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/src/main/java/dev/colbster937/originblacklist/base/Base.java b/src/main/java/dev/colbster937/originblacklist/base/Base.java index 4120522..a423c34 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)) { - setKickMessage(e, kick("origin", "website", origin)); + setKickMessage(e, kick("origin", "website", origin, conn.getWebSocketHost())); webhook(conn, origin, brand, "origin"); return; } } } else { if (origin != "null" || origin != null) { - setKickMessage(e, kick("origin", "website", origin)); + setKickMessage(e, kick("origin", "website", origin, conn.getWebSocketHost())); 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)) { - setKickMessage(e, kick("brand", "client", brand)); + setKickMessage(e, kick("brand", "client", brand, conn.getWebSocketHost())); webhook(conn, origin, brand, "brand"); return; } @@ -104,9 +104,10 @@ public class Base { 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)) + .replaceAll("%blocktype%", "origin") + .replaceAll("%easyblocktype%", "website") + .replaceAll("%blocked%", origin) + .replaceAll("%host%", conn.getWebSocketHost())) .map(line -> LegacyComponentSerializer.legacySection().serialize( MiniMessage.miniMessage().deserialize( line @@ -160,12 +161,13 @@ public class Base { return text1.toLowerCase().matches(text2.replace(".", "\\.").replaceAll("\\*", ".*").toLowerCase()); } - public static Component kick(String type, String easytype, String value) { + public static Component kick(String type, String easytype, String value, String host) { return MiniMessage.miniMessage().deserialize( config.messages.kick - .replace("%blocktype%", type) - .replace("%easyblocktype%", easytype) - .replace("%blocked%", value) + .replaceAll("%blocktype%", type) + .replaceAll("%easyblocktype%", easytype) + .replaceAll("%blocked%", value) + .replaceAll("%host%", host) ); } @@ -178,6 +180,7 @@ public class Base { ? (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 host = plr.getWebSocketHost(); String userAgent = plr.getWebSocketHeader(EnumWebSocketHeader.HEADER_USER_AGENT); if (userAgent == null || userAgent.isEmpty()) userAgent = "undefined"; @@ -187,11 +190,11 @@ public class Base { "embeds": [ { "title": "Player Information", - "description": "๐ŸŽฎ **Name:** %s\\n๐Ÿ  **Address:** %s\\n๐ŸŒ„ **PVN:** %s\\n๐ŸŒ **Origin:** %s\\n๐Ÿ”‹ **Brand:** %s\\n๐ŸงŠ **User Agent:** %s\\nโช **Rewind:** %s" + "description": "๐ŸŽฎ **Name:** %s\\n๐Ÿ  **Address:** %s\\n๐ŸŒ„ **PVN:** %s\\n๐ŸŒ **Origin:** %s\\n๐Ÿ”‹ **Brand:** %s\\n๐Ÿช‘ **Host:** %s\\n๐ŸงŠ **User Agent:** %s\\nโช **Rewind:** %s" } ] } - """, type, plr.getAuthUsername(), addr, protocol, origin, brand, userAgent, rewind); + """, type, plr.getAuthUsername(), addr, protocol, origin, brand, host, userAgent, rewind); try { HttpURLConnection conn = (HttpURLConnection) new URL(webhook).openConnection(); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ca5640e..e7e8b09 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -3,6 +3,7 @@ messages: # - %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 + # - %host% - The IP the player pinged kick: | This %easyblocktype% is not allowed on the server! @@ -63,7 +64,6 @@ discord: - # :> \ No newline at end of file