mirror of
https://github.com/colbster937/originblacklist.git
synced 2025-06-07 16:24:48 +00:00
Fix OriginBlacklist on bungeecord
This commit is contained in:
parent
5453ed0280
commit
4d0f0542ca
7
bin/main/bungee.yml
Normal file
7
bin/main/bungee.yml
Normal file
@ -0,0 +1,7 @@
|
||||
name: OriginBlacklist
|
||||
version: ${version}
|
||||
main: dev.colbster937.originblacklist.bungee.OriginBlacklistBungee
|
||||
description: ${description}
|
||||
author: Colbster937
|
||||
depends:
|
||||
- EaglercraftXServer
|
69
bin/main/config.yml
Normal file
69
bin/main/config.yml
Normal file
@ -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: |
|
||||
<red>This %easyblocktype% is not allowed on the server!</red>
|
||||
<dark_gray>»</dark_gray> <gray>%blocked%</gray> <dark_gray>«</dark_gray>
|
||||
|
||||
<gray>Think this is a mistake? Join our discord:</gray>
|
||||
<blue>discord.gg/changethisintheconfig</blue>
|
||||
|
||||
motd:
|
||||
enabled: true
|
||||
text: |
|
||||
<red>This %easyblocktype% is not allowed!</red>
|
||||
<dark_gray>»</dark_gray> <gray>%blocked%</gray> <dark_gray>«</dark_gray>
|
||||
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: ""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# :>
|
Binary file not shown.
BIN
bin/main/dev/colbster937/originblacklist/base/Base.class
Normal file
BIN
bin/main/dev/colbster937/originblacklist/base/Base.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/main/dev/colbster937/originblacklist/base/Command.class
Normal file
BIN
bin/main/dev/colbster937/originblacklist/base/Command.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9
bin/main/plugin.yml
Normal file
9
bin/main/plugin.yml
Normal file
@ -0,0 +1,9 @@
|
||||
name: OriginBlacklist
|
||||
version: ${version}
|
||||
main: dev.colbster937.originblacklist.bukkit.OriginBlacklistBukkit
|
||||
description: ${description}
|
||||
author: Colbster937
|
||||
depend:
|
||||
- EaglercraftXServer
|
||||
commands:
|
||||
originblacklist:
|
BIN
bin/main/server-blocked.png
Normal file
BIN
bin/main/server-blocked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
14
bin/main/velocity-plugin.json
Normal file
14
bin/main/velocity-plugin.json
Normal file
@ -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
|
||||
}
|
||||
]
|
||||
}
|
@ -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
|
||||
|
||||
|
@ -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<String> 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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user