NoticeExpress
一个用于服务器公告和通知的 Minecraft Fabric 模组,并提供可选的客户端 GUI 增强功能。
功能
- ? 服务端通知管理 - 创建、删除、置顶和管理服务器公告
- ? 持久化存储 - 使用 SQLite 数据库确保通知可靠存储
- ? 双模式显示 - 基于聊天的通知(备用方案)和可选的客户端 GUI
- ? 重要通知置顶 - 突出显示关键公告
- ? 权限系统 - 需要 OP 等级 3 才能管理通知
- ⚙️ 可配置 - 基于 JSON 的配置系统
要求
- Minecraft: 1.21.7
- Fabric Loader: 0.18.4 或更高版本
- Fabric API: 0.129.0+1.21.7 或更高版本
- Java: 21 或更高版本
安装
服务端(必需)
- 下载模组 JAR 文件
- 将其放入服务器的
mods 文件夹中
- 启动服务器
- 配置文件将在
config/noticeexpress/config.json 生成
客户端(可选)
- 下载相同的模组 JAR 文件
- 将其放入客户端的
mods 文件夹中
- 享受增强的 GUI 功能(即将推出)
命令
所有命令均以 /notice 开头:
管理命令(OP 等级 3+)
发布通知
/notice publish <title> <content>
示例:
/notice publish "Server Maintenance" "The server will be down for maintenance on Saturday from 2-4 PM."
删除通知
/notice delete <id>
示例:
/notice delete 1
置顶通知
/notice pin <id>
示例:
/notice pin 2
取消置顶通知
/notice unpin <id>
示例:
/notice unpin 2
查看命令(所有玩家)
列出所有通知
/notice list
显示包含 ID 和标题的所有通知的紧凑列表。
显示完整通知内容
/notice show
在聊天中显示带有完整内容的所有通知。
聊天显示格式
当在聊天中查看通知时,它们将以以下格式显示:
[发布者] [YYYY/MM/DD HH:mm] [PINNED]
标题(金色,加粗)
内容(白色,支持多行)
示例:
[Admin] [2026/02/02 12:30] [PINNED]
Server Maintenance
The server will be down for maintenance on Saturday from 2-4 PM.
Please save your progress before then.
配置
配置文件位置:config/noticeexpress/config.json
{
"serverTitle": "Server Announcements",
"databasePath": "config/noticeexpress/notices.db"
}
配置选项
- serverTitle: 在客户端 GUI 中显示的标题(默认:"Server Announcements")
- databasePath: SQLite 数据库文件的路径(默认:"config/noticeexpress/notices.db")
数据库
NoticeExpress 使用 SQLite 进行持久化存储。数据库会自动创建和管理。
数据库架构
CREATE TABLE notices (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
publisher TEXT NOT NULL,
publisher_uuid TEXT NOT NULL,
content TEXT NOT NULL,
timestamp INTEGER NOT NULL,
is_pinned INTEGER NOT NULL DEFAULT 0,
created_at INTEGER NOT NULL
)
权限
该模组使用 Minecraft 内置的 OP 系统:
- OP 等级 3+: 可以发布、删除、置顶和取消置顶通知
- 所有玩家: 可以使用
/notice list 和 /notice show 查看通知
客户端 GUI(即将推出)
可选的客户端模组将提供增强的 GUI,包括:
- ? 可滚动的通知列表
- ? 美观的通知卡片
- ? 可视化的置顶指示器
- ✨ 展开/折叠功能
- ?️ 点击交互界面
开发者指南
从源码构建
- 克隆仓库:
git clone https://github.com/0x002500/NoticeExpress.git
cd NoticeExpress
- 构建模组:
./gradlew build
- 在
build/libs/ 中找到编译后的 JAR 文件
项目结构
src/
├── main/
│ ├── java/top/orderly/noticeexpress/
│ │ ├── NoticeExpress.java # 主模组类
│ │ ├── command/
│ │ │ └── NoticeCommand.java # 命令注册和处理程序
│ │ ├── config/
│ │ │ └── ModConfig.java # 配置管理
│ │ ├── database/
│ │ │ ├── DatabaseManager.java # SQLite 连接管理器
│ │ │ └── NoticeRepository.java # CRUD 操作
│ │ ├── model/
│ │ │ └── Notice.java # 通知实体
│ │ └── util/
│ │ ├── ChatNotificationFormatter.java # 聊天格式化
│ │ ├── PermissionChecker.java # 权限工具
│ │ └── TimeFormatter.java # 时间格式化
│ └── resources/
│ ├── fabric.mod.json # 模组元数据
│ └── assets/noticeexpress/
│ └── icon.png # 模组图标
└── client/
└── java/top/orderly/noticeexpress/
├── NoticeExpressClient.java # 客户端初始化
└── ui/ # GUI 组件(即将推出)
API 使用
以编程方式创建通知
import top.orderly.noticeexpress.NoticeExpress;
import top.orderly.noticeexpress.model.Notice;
Notice notice = new Notice();
notice.setTitle("My Notice");
notice.setPublisher("System");
notice.setPublisherUuid(UUID.randomUUID());
notice.setContent("This is a programmatically created notice.");
NoticeExpress.getNoticeRepository().createNotice(notice);
检索通知
import top.orderly.noticeexpress.NoticeExpress;
import top.orderly.noticeexpress.model.Notice;
import java.util.List;
// 获取所有通知
List<Notice> allNotices = NoticeExpress.getNoticeRepository().getAllNotices();
// 根据 ID 获取特定通知
Notice notice = NoticeExpress.getNoticeRepository().getNoticeById(1);
// 获取指定时间戳之后的通知
long timestamp = System.currentTimeMillis() - 86400000; // 过去 24 小时
List<Notice> recentNotices = NoticeExpress.getNoticeRepository().getNoticesSince(timestamp);
路线图
- 客户端图形界面 (GUI)
- 网络数据包通信
- 玩家加入通知
- 本地化支持(英文和中文)
贡献指南
欢迎贡献!请随时提交 Pull Request。
- Fork 本仓库
- 创建功能分支 (
git checkout -b feature/AmazingFeature)
- 提交更改 (
git commit -m 'feat: add some amazing feature')
- 推送到分支 (
git push origin feature/AmazingFeature)
- 打开 Pull Request
提交信息规范
本项目遵循 Conventional Commits 规范:
feat: - 新功能
fix: - 修复 Bug
docs: - 文档变更
style: - 代码风格变更(格式化等)
refactor: - 代码重构
test: - 添加或更新测试
chore: - 维护任务
许可证
本项目采用 Apache-2.0 许可证进行授权 - 详情请参阅 LICENSE 文件。
NoticeExpress
A Minecraft Fabric mod for server announcements and notices with optional client-side GUI enhancement.
Features
- ? Server-side Notice Management - Create, delete, pin, and manage server announcements
- ? Persistent Storage - SQLite database for reliable notice storage
- ? Dual Display Modes - Chat-based notifications (fallback) and optional client GUI
- ? Pin Important Notices - Highlight critical announcements
- ? Permission System - OP level 3 required for notice management
- ⚙️ Configurable - JSON-based configuration system
Requirements
- Minecraft: 1.21.7
- Fabric Loader: 0.18.4 or higher
- Fabric API: 0.129.0+1.21.7 or higher
- Java: 21 or higher
Installation
Server-side (Required)
- Download the mod JAR file
- Place it in your server's
mods folder
- Start the server
- Configuration will be generated at
config/noticeexpress/config.json
Client-side (Optional)
- Download the same mod JAR file
- Place it in your client's
mods folder
- Enjoy enhanced GUI features (coming soon)
Commands
All commands start with /notice:
Management Commands (OP Level 3+)
Publish a Notice
/notice publish <title> <content>
Example:
/notice publish "Server Maintenance" "The server will be down for maintenance on Saturday from 2-4 PM."
Delete a Notice
/notice delete <id>
Example:
/notice delete 1
Pin a Notice
/notice pin <id>
Example:
/notice pin 2
Unpin a Notice
/notice unpin <id>
Example:
/notice unpin 2
Viewing Commands (All Players)
List All Notices
/notice list
Shows a compact list of all notices with their IDs and titles.
Show Full Notices
/notice show
Displays all notices with full content in chat.
Chat Display Format
When viewing notices in chat, they appear in the following format:
[Publisher] [YYYY/MM/DD HH:mm] [PINNED]
Title (in gold, bold)
Content (in white, supports multiple lines)
Example:
[Admin] [2026/02/02 12:30] [PINNED]
Server Maintenance
The server will be down for maintenance on Saturday from 2-4 PM.
Please save your progress before then.
Configuration
Configuration file location: config/noticeexpress/config.json
{
"serverTitle": "Server Announcements",
"databasePath": "config/noticeexpress/notices.db"
}
Configuration Options
- serverTitle: The title displayed in the client GUI (default: "Server Announcements")
- databasePath: Path to the SQLite database file (default: "config/noticeexpress/notices.db")
Database
NoticeExpress uses SQLite for persistent storage. The database is automatically created and managed.
Database Schema
CREATE TABLE notices (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
publisher TEXT NOT NULL,
publisher_uuid TEXT NOT NULL,
content TEXT NOT NULL,
timestamp INTEGER NOT NULL,
is_pinned INTEGER NOT NULL DEFAULT 0,
created_at INTEGER NOT NULL
)
Permissions
The mod uses Minecraft's built-in OP system:
- OP Level 3+: Can publish, delete, pin, and unpin notices
- All Players: Can view notices using
/notice list and /notice show
Client GUI (Coming Soon)
The optional client-side mod will provide an enhanced GUI with:
- ? Scrollable notice list
- ? Beautiful notice cards
- ? Visual pinned indicators
- ✨ Expand/collapse functionality
- ?️ Click-to-interact interface
For Developers
Building from Source
- Clone the repository:
git clone https://github.com/0x002500/NoticeExpress.git
cd NoticeExpress
- Build the mod:
./gradlew build
- Find the compiled JAR in
build/libs/
Project Structure
src/
├── main/
│ ├── java/top/orderly/noticeexpress/
│ │ ├── NoticeExpress.java # Main mod class
│ │ ├── command/
│ │ │ └── NoticeCommand.java # Command registration and handlers
│ │ ├── config/
│ │ │ └── ModConfig.java # Configuration management
│ │ ├── database/
│ │ │ ├── DatabaseManager.java # SQLite connection manager
│ │ │ └── NoticeRepository.java # CRUD operations
│ │ ├── model/
│ │ │ └── Notice.java # Notice entity
│ │ └── util/
│ │ ├── ChatNotificationFormatter.java # Chat formatting
│ │ ├── PermissionChecker.java # Permission utilities
│ │ └── TimeFormatter.java # Time formatting
│ └── resources/
│ ├── fabric.mod.json # Mod metadata
│ └── assets/noticeexpress/
│ └── icon.png # Mod icon
└── client/
└── java/top/orderly/noticeexpress/
├── NoticeExpressClient.java # Client initialization
└── ui/ # GUI components (coming soon)
API Usage
Creating a Notice Programmatically
import top.orderly.noticeexpress.NoticeExpress;
import top.orderly.noticeexpress.model.Notice;
Notice notice = new Notice();
notice.setTitle("My Notice");
notice.setPublisher("System");
notice.setPublisherUuid(UUID.randomUUID());
notice.setContent("This is a programmatically created notice.");
NoticeExpress.getNoticeRepository().createNotice(notice);
Retrieving Notices
import top.orderly.noticeexpress.NoticeExpress;
import top.orderly.noticeexpress.model.Notice;
import java.util.List;
// Get all notices
List<Notice> allNotices = NoticeExpress.getNoticeRepository().getAllNotices();
// Get a specific notice by ID
Notice notice = NoticeExpress.getNoticeRepository().getNoticeById(1);
// Get notices since a timestamp
long timestamp = System.currentTimeMillis() - 86400000; // Last 24 hours
List<Notice> recentNotices = NoticeExpress.getNoticeRepository().getNoticesSince(timestamp);
Roadmap
- Client-side GUI
- Network packet communication
- Player join notifications
- Localization support (English & Chinese)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature)
- Commit your changes (
git commit -m 'feat: add some amazing feature')
- Push to the branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
Commit Message Convention
This project follows Conventional Commits:
feat: - New features
fix: - Bug fixes
docs: - Documentation changes
style: - Code style changes (formatting, etc.)
refactor: - Code refactoring
test: - Adding or updating tests
chore: - Maintenance tasks
License
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
评论 0
登录后参与评分
还没有评论,来抢沙发吧