GeoBlock
一个 Paper 插件,使用本地 MaxMind GeoLite2 数据库按国家/地区过滤传入连接,支持对受信任 IP 和 UUID 的绕过,可选的 VPN/代理检测以及 Discord webhook 通知。
功能
- 基于国家/地区的过滤,支持
blacklist(黑名单)或 whitelist(白名单)模式(使用 ISO 3166-1 alpha-2 代码)。
- IP 和 UUID 绕过列表,支持 IPv4/IPv6 CIDR。
- 通过标准 Bukkit API 集成权限系统:如果存在 LuckPerms 则与其配合,否则回退到原版
/op。
- 异步 Discord webhook 用于连接拒绝通知,可切换是否包含 IP 地址以保护隐私。
- 通过
/geoblock reload 热重载配置。
构建
./gradlew build
阴影 jar 文件生成于 build/libs/GeoBlock-<version>.jar,所有运行时依赖都重定位到了 fr.horizonsmp.geoBlock.lib.* 下,以避免与其他插件冲突。
运行开发服务器
./gradlew runServer
启动一个加载了该插件的 Paper 开发服务器。
要求
- Java 25
- Paper 1.21.x(Minecraft
26.1.2 API 目标)
- MaxMind GeoLite2 许可证密钥以自动更新数据库,或者在插件数据文件夹下手动提供 MMDB 文件。
配置
首次运行后,编辑 plugins/GeoBlock/ 下生成的文件:
config.yml — 过滤模式、国家列表、GeoIP、VPN 和 Discord 选项。每个选项都有内联文档说明。
messages.yml — 面向用户的字符串(踢出原因、命令输出)。
whitelist.yml — 绕过列表(通过命令管理)。
插件在启动时以及通过 /geoblock reload 读取 config.yml、messages.yml 和 whitelist.yml。
命令
| 命令 |
权限 |
描述 |
/geoblock reload |
geoblock.command.reload |
重新加载所有配置文件 |
/geoblock bypass add ip <ip|cidr> |
geoblock.command.bypass |
将 IP 或 CIDR 添加到绕过列表 |
/geoblock bypass add uuid <uuid> |
geoblock.command.bypass |
将玩家 UUID 添加到绕过列表 |
/geoblock bypass remove ip <ip> |
geoblock.command.bypass |
移除 IP/CIDR 条目 |
/geoblock bypass remove uuid <uuid> |
geoblock.command.bypass |
移除 UUID 条目 |
/geoblock bypass list |
geoblock.command.bypass |
显示所有绕过条目 |
/geoblock help |
geoblock.admin |
打印命令摘要 |
geoblock.admin(默认 op)包含两个子权限,因此在没有 LuckPerms 的服务器上,操作员拥有完全访问权限。
许可
参见 LICENSE 文件。
GeoBlock
A Paper plugin that filters incoming connections by country using a local
MaxMind GeoLite2 database, with bypass support for trusted IPs and UUIDs,
optional VPN/proxy detection and Discord webhook notifications.
Features
- Country-based filtering in
blacklist or whitelist mode (ISO 3166-1
alpha-2 codes).
- IP and UUID bypass list with IPv4/IPv6 CIDR support.
- Permission integration through the standard Bukkit API: works with
LuckPerms when present, falls back to vanilla
/op otherwise.
- Async Discord webhook for connection denials, with toggleable IP
inclusion for privacy-conscious deployments.
- Hot configuration reload via
/geoblock reload.
Build
./gradlew build
The shaded jar is produced at build/libs/GeoBlock-<version>.jar with all
runtime dependencies relocated under fr.horizonsmp.geoBlock.lib.* to
avoid clashes with other plugins.
Run a development server
./gradlew runServer
Boots a Paper development server with the plugin loaded.
Requirements
- Java 25
- Paper 1.21.x (Minecraft
26.1.2 API target)
- A MaxMind GeoLite2 license key for automatic database updates, or a
manually provided MMDB file under the plugin data folder.
Configuration
After the first run, edit the files generated under plugins/GeoBlock/:
config.yml — filtering mode, country list, GeoIP, VPN and Discord
options. Each option is documented inline.
messages.yml — user-facing strings (kick reasons, command output).
whitelist.yml — bypass list (managed through commands).
The plugin reads config.yml, messages.yml and whitelist.yml at
startup and through /geoblock reload.
Commands
| Command |
Permission |
Description |
/geoblock reload |
geoblock.command.reload |
Reload all configuration files |
/geoblock bypass add ip <ip|cidr> |
geoblock.command.bypass |
Add an IP or CIDR to the bypass list |
/geoblock bypass add uuid <uuid> |
geoblock.command.bypass |
Add a player UUID to the bypass list |
/geoblock bypass remove ip <ip> |
geoblock.command.bypass |
Remove an IP/CIDR entry |
/geoblock bypass remove uuid <uuid> |
geoblock.command.bypass |
Remove a UUID entry |
/geoblock bypass list |
geoblock.command.bypass |
Show every bypass entry |
/geoblock help |
geoblock.admin |
Print the command summary |
geoblock.admin (default op) implies the two child permissions, so
operators get full access on a server without LuckPerms.
License
See LICENSE file.
评论 0
登录后参与评分
还没有评论,来抢沙发吧