8 Commits

Author SHA1 Message Date
Colbster937
d4541c9de4 udpate 2025-08-08 10:40:19 -05:00
Colbster937
58e9819c3a fix webhook with ipv6 2025-07-09 17:15:32 -05:00
Colbster937
6e1d5d132c add ip blacklisting & blacklist cmd 2025-06-13 13:21:32 -04:00
Colbster937
1a22788630 change back number of lines before eagler face :> 2025-05-21 18:16:02 -05:00
Colbster937
cf0481fb58 Merge pull request #1 from Atticuss26/main
Update config.yml to add a hacked client site
2025-05-21 18:15:02 -05:00
Colbster937
f8ea6d5bfd Add more hacked clients 2025-05-21 18:14:47 -05:00
Atticuss26
8d5e5d688b Update config.yml to add a hacked client site 2025-05-21 16:04:58 -07:00
Colbster937
2648377276 ? 2025-05-13 19:17:57 -05:00
13 changed files with 424 additions and 105 deletions

View File

@@ -9,16 +9,15 @@ basically just a reimplementation of originblacklist but for eaglerxserver
- [x] Origin Blacklisting
- [x] Brand Blacklisting
- [x] Username blacklisting
- [x] IP blacklisting
- [x] Custom kick message
- [x] Custom blacklist MOTD
- [x] MiniMessage formatting for messages
- [x] Velocity, *Bungee, and *Bukkit support
<br>_<sub><span style="color:gray">Bungee and Bukkit are should work, but have bugs.</span></sub>_
- [x] Velocity, Bungee, and Bukkit support
- [x] Send blacklists to a discord webhook
- [x] Simple blacklist command
- [ ] Blacklist subscription URLs
- [ ] Simple blacklist command
- [ ] Blacklist -> Whitelist
- [ ] IP blacklisting
- [ ] Update system
### Download

View File

@@ -8,7 +8,7 @@ plugins {
group = 'dev.colbster937'
version = '1.0.5'
version = '1.1.2'
description = 'A reimplementation of OriginBlacklist for EaglerXServer'
def targetJavaVersion = 17
@@ -51,6 +51,7 @@ dependencies {
implementation("org.yaml:snakeyaml:2.2")
implementation("net.kyori:adventure-text-serializer-legacy:4.20.0")
implementation("net.kyori:adventure-text-minimessage:4.20.0")
implementation("com.github.seancfoley:ipaddress:5.3.4")
}
tasks {
@@ -74,6 +75,7 @@ processResources {
shadowJar {
relocate 'org.yaml.snakeyaml', 'dev.colbster937.shaded.snakeyaml'
relocate 'inet.ipaddr', 'dev.colbster937.shaded.ipaddr'
archiveVersion.set('')
archiveClassifier.set('')
}

View File

@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
public class Base {
private static LoggerAdapter adapter;
private static IEaglerXServerAPI api;
private static ConfigManager config;
private static IPBlacklist ipblacklist;
public static void setLogger(LoggerAdapter log) {
adapter = log;
@@ -32,7 +32,9 @@ public class Base {
api = api1;
}
public static String apiVer = "1.0.2";
public static ConfigManager config;
public static String pluginVer = "1.0.2";
public static boolean checkVer(String v1, String v2) {
String[] c = v1.split("\\.");
@@ -67,11 +69,14 @@ public class Base {
String origin = conn.getWebSocketHeader(EnumWebSocketHeader.HEADER_ORIGIN);
String brand = conn.getEaglerBrandString();
String name = conn.getUsername();
String ip = getAddr(conn);
String notAllowed1 = "not allowed on the server";
String notAllowed2 = "not allowed";
if (origin != null && !origin.equals("null")) {
for (String origin1 : config.blacklist.origins) {
if (matches(origin, origin1)) {
setKick(e, formatKickMessage("origin", "website", origin, conn.getWebSocketHost()));
setKick(e, formatKickMessage("origin", "website", notAllowed1, notAllowed2, origin, conn.getWebSocketHost()));
webhook(conn, origin, brand, "origin");
return;
}
@@ -81,7 +86,7 @@ public class Base {
if (brand != null && !brand.equals("null")) {
for (String brand1 : config.blacklist.brands) {
if (matches(brand, brand1)) {
setKick(e, formatKickMessage("brand", "client", brand, conn.getWebSocketHost()));
setKick(e, formatKickMessage("brand", "client", notAllowed1, notAllowed2, brand, conn.getWebSocketHost()));
webhook(conn, origin, brand, "brand");
return;
}
@@ -91,12 +96,19 @@ public class Base {
if (name != null && !name.equals("null")) {
for (String name1 : config.blacklist.players) {
if (matches(name, name1) || (name.length() > 16 || name.length() < 3)) {
setKick(e, formatKickMessage("player", "username", name, conn.getWebSocketHost()));
webhook(conn, origin, name, "player");
setKick(e, formatKickMessage("player", "username", notAllowed1, notAllowed2, name, conn.getWebSocketHost()));
webhook(conn, origin, brand, "player");
return;
}
}
}
if (ip != null && !ip.equalsIgnoreCase("null")) {
if (ipblacklist.check(ip)) {
setKick(e, formatKickMessage("ip address", "ip", notAllowed1, notAllowed2, ip, conn.getWebSocketHost()));
webhook(conn, origin, brand, "ip");
}
}
}
public static void setKick(IEaglercraftLoginEvent e, Component msg) {
@@ -110,30 +122,61 @@ public class Base {
}
public static void handleMOTD(IEaglercraftMOTDEvent e) {
if (config.messages.motd.enabled) {
if (!config.messages.motd.enabled) return;
IMOTDConnection conn = e.getMOTDConnection();
String origin = conn.getWebSocketHeader(EnumWebSocketHeader.HEADER_ORIGIN);
String host = conn.getWebSocketHost() != null ? conn.getWebSocketHost() : "";
String ip = getAddr(conn);
String blocktype1 = null;
String easyblocktype1 = null;
String blocked1 = null;
if (origin != null && !"null".equals(origin)) {
for (String origin2 : config.blacklist.origins) {
if (matches(origin, origin2)) {
blocktype1 = "origin";
easyblocktype1 = "website";
blocked1 = origin;
break;
}
}
}
if (blocktype1 == null && ip != null && !"null".equalsIgnoreCase(ip)) {
boolean blocked = ipblacklist != null && ipblacklist.check(ip);
if (!blocked) {
for (String ip2 : config.blacklist.ips) {
if (matches(ip, ip2)) { blocked = true; break; }
}
}
if (blocked) {
blocktype1 = "ip address";
easyblocktype1 = "ip";
blocked1 = ip;
}
}
if (blocktype1 == null) return;
final String finalBlocktype = blocktype1;
final String finalEasyblocktype = easyblocktype1;
final String finalBlocked = blocked1;
List<String> m = List.of(config.messages.motd.text.split("\n")).stream()
.map(line -> line
.replaceAll("%blocktype%", "origin")
.replaceAll("%easyblocktype%", "website")
.replaceAll("%blocked%", origin)
.replaceAll("%host%", conn.getWebSocketHost()))
.map(line -> LegacyComponentSerializer.legacySection().serialize(
MiniMessage.miniMessage().deserialize(line)))
.replace("%blocktype%", finalBlocktype)
.replace("%easyblocktype%", finalEasyblocktype)
.replace("%notallowed1%", "blacklisted")
.replace("%notallowed2%", "blacklisted")
.replace("%blocked%", finalBlocked)
.replace("%host%", host))
.map(line -> LegacyComponentSerializer.legacySection()
.serialize(MiniMessage.miniMessage().deserialize(line)))
.collect(Collectors.toList());
if (origin != null && !origin.equals("null")) {
for (String origin1 : config.blacklist.origins) {
if (matches(origin, origin1)) {
setMOTD(conn, m);
return;
}
}
} else if (origin != null && !origin.equals("null")) {
setMOTD(conn, m);
}
}
}
public static void setMOTD(IMOTDConnection conn, List<String> m) {
@@ -172,18 +215,22 @@ public class Base {
return text1.toLowerCase().matches(text2.replace(".", "\\.").replaceAll("\\*", ".*").toLowerCase());
}
public static Component formatKickMessage(String type, String easytype, String value, String host) {
public static Component formatKickMessage(String type, String easytype, String notAllowed1, String notAllowed2, String value, String host) {
String help = "";
if (type != "player") {
help = config.messages.help.generic;
} else {
if ("player".equals(type)) {
help = config.messages.help.player;
} else if ("ip address".equals(type)) {
help = config.messages.help.ip;
} else {
help = config.messages.help.generic;
}
return MiniMessage.miniMessage().deserialize(
config.messages.kick
.replaceAll("%help%", help)
.replaceAll("%blocktype%", type)
.replaceAll("%easyblocktype%", easytype)
.replaceAll("%notallowed1%", notAllowed1)
.replaceAll("%notallowed2%", notAllowed2)
.replaceAll("%blocked%", value)
.replaceAll("%host%", host));
}
@@ -194,7 +241,7 @@ public class Base {
return;
CompletableFuture.runAsync(() -> {
String addr = (plr.getPlayerAddress() != null ? plr.getPlayerAddress().toString().substring(1) : "undefined:undefined").split(":")[0];
String addr = getAddr(plr);
int protocol = !plr.isEaglerXRewindPlayer() ? plr.getMinecraftProtocol() : plr.getRewindProtocolVersion();
String host = plr.getWebSocketHost();
String userAgent = plr.getWebSocketHeader(EnumWebSocketHeader.HEADER_USER_AGENT);
@@ -209,7 +256,7 @@ public class Base {
"embeds": [
{
"title": "Player Information",
"description": "🎮 **Name:** %s\\n🏠 **IP:** %s\\n🌄 **PVN:** %s\\n🌐 **Origin:** %s\\n🔋 **Brand:** %s\\n🪑 **Host:** %s\\n🧊 **User Agent:** %s\\n⏪ **Rewind:** %s"
"description": "🎮 **Name:** %s\\n🏠 **IP:** %s\\n🌄 **PVN:** %s\\n🌐 **Origin:** %s\\n🔋 **Brand:** %s\\n🪑 **Host:** %s\\n🧊 **UA:** %s\\n⏪ **Rewind:** %s"
}
]
}
@@ -235,6 +282,18 @@ public class Base {
});
}
public static String getAddr(IEaglerLoginConnection conn) {
var addr1 = conn.getPlayerAddress() != null ? conn.getPlayerAddress().toString().substring(1) : "0.0.0.0:0";
var addr2 = addr1.lastIndexOf(':') != -1 ? addr1.substring(0, addr1.lastIndexOf(':')) : addr1;
return addr2;
}
public static String getAddr(IMOTDConnection conn) {
var addr1 = conn.getSocketAddress() != null ? conn.getSocketAddress().toString().substring(1) : "0.0.0.0:0";
var addr2 = addr1.lastIndexOf(':') != -1 ? addr1.substring(0, addr1.lastIndexOf(':')) : addr1;
return addr2;
}
public static void init() {
File motdIcon = new File(config.messages.motd.icon);
if (!motdIcon.exists()) {
@@ -246,6 +305,7 @@ public class Base {
getLogger().warn(e.toString());
}
}
ipblacklist = new IPBlacklist();
}
public static void reloadConfig() {

View File

@@ -1,6 +1,16 @@
package dev.colbster937.originblacklist.base;
import org.yaml.snakeyaml.Yaml;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import static dev.colbster937.originblacklist.base.Base.config;
public class Command {
private static final String permission = "<red>You do not have permission to use this command.</red>";
public interface CommandContext {
String getName();
@@ -9,16 +19,18 @@ public class Command {
String[] getArgs();
}
public static void usage(CommandContext ctx) {
ctx.reply("<aqua>Commands:</aqua>");
ctx.reply("<gray> - /originblacklist reload</gray>");
ctx.reply("<gray> - /originblacklist add <brand/origin/name/ip> <value></gray>");
ctx.reply("<gray> - /originblacklist remove <brand/origin/name/ip> <value></gray>");
ctx.reply("<gray> - /originblacklist list</gray>");
}
public static void handle(CommandContext ctx) {
String[] args = ctx.getArgs();
if (!ctx.hasPermission("originblacklist.reload")) {
ctx.reply("<red>You do not have permission to use this command.</red>");
if (!ctx.hasPermission("originblacklist.command")) {
ctx.reply(permission);
return;
} else if (args.length == 0) {
usage(ctx);
@@ -26,14 +38,136 @@ public class Command {
}
String sub = args[0].toLowerCase();
String sub1 = args.length > 1 ? args[1].toLowerCase() : "";
String sub2 = args.length > 2 ? args[2].toLowerCase() : "";
switch (sub) {
case "reload" -> {
if (ctx.hasPermission("originblacklist.reload")) {
Base.reloadConfig();
ctx.reply("<green>Reloaded.</green>");
} else {
ctx.reply(permission);
return;
}
}
case "add" -> {
if (!ctx.hasPermission("originblacklist.add")) {
ctx.reply(permission);
return;
}
if (sub1.isEmpty() || sub2.isEmpty()) {
usage(ctx);
return;
}
List<String> list = switch (sub1) {
case "brand" -> Base.config.blacklist.brands;
case "origin" -> Base.config.blacklist.origins;
case "player" -> Base.config.blacklist.players;
case "ip" -> Base.config.blacklist.ips;
default -> null;
};
if (list == null) {
usage(ctx);
return;
}
if (!list.contains(sub2)) {
list.add(sub2);
ctx.reply("<green>Added " + sub2 + " to " + sub1 + " blacklist.</green>");
} else {
ctx.reply("<yellow>Already blacklisted.</yellow>");
}
try {
config.saveConfig(Base.config.toMap(), new File("plugins/originblacklist/config.yml"));
} catch (IOException e) {
throw new RuntimeException(e);
}
Base.reloadConfig();
}
case "remove" -> {
if (!ctx.hasPermission("originblacklist.remove")) {
ctx.reply(permission);
return;
}
if (sub1.isEmpty() || sub2.isEmpty()) {
usage(ctx);
return;
}
List<String> list = switch (sub1) {
case "brand" -> Base.config.blacklist.brands;
case "origin" -> Base.config.blacklist.origins;
case "player" -> Base.config.blacklist.players;
case "ip" -> Base.config.blacklist.ips;
default -> null;
};
if (list == null) {
usage(ctx);
return;
}
if (list.remove(sub2)) {
ctx.reply("<green>Removed " + sub2 + " from " + sub1 + " blacklist.</green>");
} else {
ctx.reply("<yellow>Entry not found in " + sub1 + ".</yellow>");
}
try {
config.saveConfig(Base.config.toMap(), new File("plugins/originblacklist/config.yml"));
} catch (IOException e) {
throw new RuntimeException(e);
}
Base.reloadConfig();
}
case "list" -> {
if (!ctx.hasPermission("originblacklist.view")) {
ctx.reply(permission);
return;
}
ctx.reply("<aqua>Blacklist:</aqua>");
ctx.reply("<gray> Brands:</gray>");
for (String s : Base.config.blacklist.brands) ctx.reply("<gray> - " + s + "</gray>");
ctx.reply("<gray> Origins:</gray>");
for (String s : Base.config.blacklist.origins) ctx.reply("<gray> - " + s + "</gray>");
ctx.reply("<gray> Players:</gray>");
for (String s : Base.config.blacklist.players) ctx.reply("<gray> - " + s + "</gray>");
ctx.reply("<gray> IPs:</gray>");
for (String s : Base.config.blacklist.ips) ctx.reply("<gray> - " + s + "</gray>");
}
default -> usage(ctx);
}
}
public static List<String> suggest(CommandContext ctx) {
String[] args = ctx.getArgs();
if (args.length == 1) {
return List.of("reload", "add", "remove", "list");
}
if (args.length == 2 && args[0].equalsIgnoreCase("add")) {
return List.of("brand", "origin", "player", "ip");
}
return List.of();
}
public Map<String, Object> toMap() {
Yaml yaml = new Yaml();
return yaml.load(yaml.dump(this));
}
}

View File

@@ -9,10 +9,13 @@ import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import inet.ipaddr.IPAddress;
public class ConfigManager {
public Messages messages = new Messages();
public List<String> subscriptions = List.of();
//public List<String> subscriptions = List.of();
public Blacklist blacklist = new Blacklist();
public Discord discord = new Discord();
@@ -27,16 +30,33 @@ public class ConfigManager {
}
}
Yaml y = new Yaml(new Constructor(ConfigManager.class, new LoaderOptions()));
ConfigManager l;
try (InputStream in = new FileInputStream(f)) { l = y.load(in); }
Constructor constructor = new Constructor(ConfigManager.class, new LoaderOptions());
constructor.setPropertyUtils(new org.yaml.snakeyaml.introspector.PropertyUtils() {{
setSkipMissingProperties(true);
}});
Yaml y = new Yaml(constructor);
ConfigManager l = null;
if (l == null) l = new ConfigManager();
try (InputStream in = new FileInputStream(f)) {
l = y.load(in);
} catch (Exception ex) {
logger.warn("Error loading config: " + ex.getMessage());
}
if (l == null) {
l = new ConfigManager();
}
try {
Yaml raw = new Yaml();
Map<String, Object> u = raw.load(new FileInputStream(f));
Map<String, Object> d = raw.load(ConfigManager.class.getResourceAsStream("/config.yml"));
if (mergeConfig(u, d)) saveConfig(u, f);
} catch (Exception ex) {
logger.warn("YAML merge error: " + ex.getMessage());
}
l.blacklist.resolveIPS(logger);
return l;
} catch (IOException e) {
@@ -57,19 +77,43 @@ public class ConfigManager {
return c;
}
private static void saveConfig(Map<String, Object> m, File f) throws IOException {
public static void saveConfig(Map<String, Object> m, File f) throws IOException {
DumperOptions o = new DumperOptions();
o.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
o.setPrettyFlow(true);
new Yaml(o).dump(m, new FileWriter(f));
}
public Map<String, Object> toMap() {
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
options.setPrettyFlow(true);
options.setAllowReadOnlyProperties(true);
Yaml yaml = new Yaml(options);
String yaml1 = yaml.dumpAsMap(this);
Yaml parser = new Yaml();
Object yaml2 = parser.load(yaml1);
return (Map<String, Object>) yaml2;
}
public static class Blacklist {
public List<String> origins;
public List<String> brands;
public List<String> players;
public List<String> ips = List.of();
public transient Set<IPAddress> ips1 = new CopyOnWriteArraySet<>();
public boolean missing_origin;
public String blacklist_redirect;
//public String blacklist_redirect;
public void resolveIPS(Base.LoggerAdapter logger) {
for (String line : ips) {
try {
ips1.add(new inet.ipaddr.IPAddressString(line).toAddress());
} catch (Throwable ignored) {}
}
}
}
public static class Discord {
@@ -91,5 +135,6 @@ public class ConfigManager {
public static class Help {
public String generic;
public String player;
public String ip;
}
}

View File

@@ -0,0 +1,38 @@
package dev.colbster937.originblacklist.base;
import java.util.logging.Logger;
import inet.ipaddr.AddressStringException;
import inet.ipaddr.IPAddress;
import inet.ipaddr.IPAddressString;
import static dev.colbster937.originblacklist.base.Base.config;
public class IPBlacklist {
private Logger logger = null;
public IPBlacklist() {
this.logger = logger;
}
public boolean check(String addr) {
IPAddress ip;
String addr1 = addr;
try {
if (addr.startsWith("/")) {
addr1 = addr.substring(1);
}
ip = new IPAddressString(addr1).toAddress();
} catch (AddressStringException e) {
throw new RuntimeException("Invalid IP address: " + addr, e);
}
return config.blacklist.ips1.stream().anyMatch(s -> {
try {
return s.contains(ip);
} catch (Exception e) {
return false;
}
});
}
}

View File

@@ -1,20 +1,33 @@
package dev.colbster937.originblacklist.bukkit;
import dev.colbster937.originblacklist.base.Command;
import dev.colbster937.originblacklist.base.Command.CommandContext;
import org.bukkit.command.CommandSender;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class CommandBukkit implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
Command.handle(new CommandContext() {
public String getName() { return sender.getName(); }
public void reply(String msg) { sender.sendMessage(msg); }
dev.colbster937.originblacklist.base.Command.handle(new CommandContext() {
@Override
public String getName() {
return sender.getName();
}
@Override
public void reply(String msg) {
sender.sendMessage(LegacyComponentSerializer.legacySection()
.serialize(MiniMessage.miniMessage().deserialize(msg)));
}
@Override
public boolean hasPermission(String permission) {
return sender.hasPermission(permission);
}
@Override
public String[] getArgs() {
return args;
}

View File

@@ -6,6 +6,7 @@ import net.lax1dude.eaglercraft.backend.server.api.bukkit.event.EaglercraftLogin
import net.lax1dude.eaglercraft.backend.server.api.bukkit.event.EaglercraftMOTDEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.Plugin;
@@ -16,9 +17,9 @@ public class OriginBlacklistBukkit extends JavaPlugin implements Listener {
Plugin plugin = getServer().getPluginManager().getPlugin("EaglercraftXServer");
if (plugin != null) {
String version = plugin.getDescription().getVersion();
if (!Base.checkVer(version, Base.apiVer)) {
getLogger().severe("EaglerXServer " + Base.apiVer + " is required!");
throw new RuntimeException("Incompatible API version");
if (!Base.checkVer(version, Base.pluginVer)) {
getLogger().severe("EaglerXServer " + Base.pluginVer + " is required!");
throw new RuntimeException("Incompatible plugin version");
}
} else {
throw new RuntimeException("Missing EaglerXServer");

View File

@@ -1,8 +1,8 @@
package dev.colbster937.originblacklist.bungee;
import dev.colbster937.originblacklist.base.Command;
import dev.colbster937.originblacklist.base.Command.CommandContext;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
public class CommandBungee extends net.md_5.bungee.api.plugin.Command {
@@ -12,12 +12,19 @@ public class CommandBungee extends net.md_5.bungee.api.plugin.Command {
@Override
public void execute(CommandSender sender, String[] args) {
Command.handle(new CommandContext() {
public String getName() { return sender.getName(); }
public void reply(String msg) { sender.sendMessage(msg); }
dev.colbster937.originblacklist.base.Command.handle(new CommandContext() {
public String getName() {
return sender.getName();
}
public void reply(String msg) {
sender.sendMessage(TextComponent.fromLegacyText(msg));
}
public boolean hasPermission(String permission) {
return sender.hasPermission(permission);
}
public String[] getArgs() {
return args;
}

View File

@@ -4,6 +4,7 @@ import dev.colbster937.originblacklist.base.Base;
import net.lax1dude.eaglercraft.backend.server.api.bungee.EaglerXServerAPI;
import net.lax1dude.eaglercraft.backend.server.api.bungee.event.EaglercraftLoginEvent;
import net.lax1dude.eaglercraft.backend.server.api.bungee.event.EaglercraftMOTDEvent;
import net.md_5.bungee.api.event.PreLoginEvent;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
@@ -15,9 +16,9 @@ public class OriginBlacklistBungee extends Plugin implements Listener {
Plugin plugin = getProxy().getPluginManager().getPlugin("EaglercraftXServer");
if (plugin != null) {
String version = plugin.getDescription().getVersion();
if (!Base.checkVer(version, Base.apiVer)) {
getLogger().severe("EaglerXServer " + Base.apiVer + " is required!");
throw new RuntimeException("Incompatible API version");
if (!Base.checkVer(version, Base.pluginVer)) {
getLogger().severe("EaglerXServer " + Base.pluginVer + " is required!");
throw new RuntimeException("Incompatible plugin version");
}
} else {
throw new RuntimeException("Missing EaglerXServer");

View File

@@ -1,34 +1,49 @@
package dev.colbster937.originblacklist.velocity;
import com.velocitypowered.api.command.SimpleCommand;
import dev.colbster937.originblacklist.base.Command;
import dev.colbster937.originblacklist.base.Command.CommandContext;
import net.kyori.adventure.text.minimessage.MiniMessage;
import com.velocitypowered.api.command.CommandSource;
import java.util.List;
public class CommandVelocity implements SimpleCommand {
@Override
public void execute(Invocation invocation) {
CommandSource source = invocation.source();
dev.colbster937.originblacklist.base.Command.handle(new CommandContext() {
@Override
public String getName() {
return source.toString();
Command.handle(new VelocityCommandContext(invocation));
}
@Override
public void reply(String msg) {
source.sendMessage(MiniMessage.miniMessage().deserialize(msg));
public List<String> suggest(Invocation invocation) {
return Command.suggest(new VelocityCommandContext(invocation));
}
public static class VelocityCommandContext implements CommandContext {
private final Invocation invocation;
public VelocityCommandContext(Invocation invocation) {
this.invocation = invocation;
}
@Override
public String getName() {
return invocation.source().toString();
}
@Override
public void reply(String message) {
invocation.source().sendMessage(MiniMessage.miniMessage().deserialize(message));
}
@Override
public boolean hasPermission(String permission) {
return source.hasPermission(permission);
return invocation.source().hasPermission(permission);
}
@Override
public String[] getArgs() {
return invocation.arguments();
}
});
}
}

View File

@@ -1,13 +1,16 @@
package dev.colbster937.originblacklist.velocity;
import com.google.inject.Inject;
import com.velocitypowered.api.event.connection.PreLoginEvent;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.proxy.ProxyServer;
import dev.colbster937.originblacklist.base.Base;
import net.kyori.adventure.text.Component;
import net.lax1dude.eaglercraft.backend.server.api.velocity.EaglerXServerAPI;
import net.lax1dude.eaglercraft.backend.server.api.velocity.event.EaglercraftLoginEvent;
import net.lax1dude.eaglercraft.backend.server.api.velocity.event.EaglercraftMOTDEvent;
import java.net.InetAddress;
import org.slf4j.Logger;
public class OriginBlacklistVelocity {
@@ -29,9 +32,9 @@ public class OriginBlacklistVelocity {
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
proxy.getPluginManager().getPlugin("eaglerxserver").ifPresentOrElse(plugin -> {
if (!Base.checkVer(plugin.getDescription().getVersion().orElse("1.0.0"), Base.apiVer)) {
logger.error("EaglerXServer " + Base.apiVer + " is required!");
throw new RuntimeException("Incompatible api version");
if (!Base.checkVer(plugin.getDescription().getVersion().orElse("1.0.0"), Base.pluginVer)) {
logger.error("EaglerXServer " + Base.pluginVer + " is required!");
throw new RuntimeException("Incompatible plugin version");
}
}, () -> {
throw new RuntimeException("Missing EaglerXServer");

View File

@@ -3,11 +3,13 @@ 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
# - %notallowed1% - Longer "not allowed" message
# - %notallowed2% - Shorter "not allowed" message
# - %host% - The IP the player pinged
# - %help% - The configured help message for the block type
kick: |
<red>This %easyblocktype% is not allowed on the server!</red>
<red>This %easyblocktype% is %notallowed1%!</red>
<dark_gray>»</dark_gray> <gray>%blocked%</gray> <dark_gray>«</dark_gray>
%help%
@@ -19,24 +21,29 @@ messages:
help:
generic: "<gray>Please switch to a different %easyblocktype%.</gray>"
player: "<gray>Please change your %easyblocktype%.</gray>"
ip: "<gray>Please contact staff for assistance.</gray>"
motd:
enabled: true
text: |
<red>This %easyblocktype% is not allowed!</red>
<dark_gray>»</dark_gray> <gray>%blocked%</gray> <dark_gray>«</dark_gray>
<red>This %easyblocktype% is %notallowed2%!</red>
<dark_gray>»</dark_gray> <gray>%blocked%</gray>
icon: "blacklisted.png"
# Origin + Brand blacklist supports wildcards
# Everything should be lowercase
blacklist:
origins:
- "hack.example.com"
- "*eagler-clients.vercel.app*"
- "*eaglerhackedclients.vercel.app*"
- "*eaglerhacks.github.io*"
brands:
- "*dragonx*"
- "*piclient*"
players:
- "Admin"
ips:
- "192.0.2.0/24"
discord:
webhook: ""
@@ -54,12 +61,6 @@ discord: