OhTabListPing
一款高性能的 Minecraft 服务器插件,在标签页列表中显示每位玩家的延迟(Ping),并采用彩色编码格式。
包含布朗尼角色
功能特性
实时 Ping 显示 - 在标签页列表的玩家名称旁显示 Ping 值
彩色编码指示器 - 直观反馈连接质量
游戏内命令 - 无需编辑配置文件即可查看和修改设置
高性能 - 异步更新配合智能缓存机制
完全可配置 - 自定义格式、颜色、阈值及更新间隔
插件兼容性 - 可与昵称和权限类插件共存
优化更新 - 仅在 Ping 发生显著变化时进行更新
环境要求
- Minecraft 版本: 1.21.1+ (Spigot 或 Paper)
- Java 版本: 21 或更高
- 服务端软件: Spigot、Paper 或其他兼容分支
- 下载最新版本(
OhTabListPing-x.x.xx.jar),前往 Releases
- 放置 JAR 文件到你的服务器
plugins/ 文件夹中
- 重启你的服务器,或者使用插件管理器加载该插件
- 配置(可选)- 编辑
plugins/OhTabListPing/config.yml 以自定义设置
- 重载插件:如果你修改了配置文件,请执行
/otlp reload
命令
在游戏中使用直观的命令来管理插件配置:
主命令
/ohtablistping [子命令] [参数...]
别名: /otlp, /ping-config
子命令
查看帮助
/otlp help
显示所有可用命令及使用示例。
列出所有配置值
/otlp list
以格式化显示的方式展示当前所有配置值。
获取特定值
/otlp get <key>
示例:
/otlp get update-interval
/otlp get debug
/otlp get color-coding.thresholds.excellent
设置配置值
/otlp set <key> <value>
示例:
/otlp set update-interval 60
/otlp set debug true
/otlp set ping-format "{player} [{color}{ping}ms]"
/otlp set color-coding.colors.excellent §a
重新加载配置
/otlp reload
从磁盘重新加载 config.yml,并使用新设置重新启动更新任务。
权限
ohtablistping.admin - 完全的管理员权限(默认:op)
ohtablistping.reload - 仅重新加载配置
ohtablistping.view - 仅查看配置值
ohtablistping.set - 仅修改配置值
配置
插件在首次运行时会自动创建一个 config.yml 文件。以下是您可以自定义的内容:
# 更新间隔(以刻为单位,20 刻 = 1 秒)
update-interval: 40 # 推荐:40(2 秒)
# 触发更新的最小延迟变化值(避免不必要的更新)
update-threshold: 5 # 仅当延迟变化超过 5 毫秒时才更新
# 显示格式
ping-format: "{player} §7[{color}{ping}ms§7]"
# 颜色编码
color-coding:
enabled: true
colors:
excellent: "§a" # 绿色 (0-50ms)
good: "§e" # 黄色 (51-100ms)
acceptable: "§6" # 金色 (101-150ms)
poor: "§c" # 红色 (151+ms)
thresholds:
excellent: 50
good: 100
acceptable: 150
# 性能设置
async-updates: true # 异步运行更新(推荐)
debug: false # 启用调试日志
格式占位符
{player} - 玩家用户名
{ping} - 当前延迟数值
{color} - 自动确定的颜色代码
颜色代码
支持标准 Minecraft 颜色代码:
§a - 绿色
§e - 黄色
§6 - 金色
§c - 红色
§7 - 灰色
§f - 白色
工作原理
- 定时更新:插件每
update-interval 刻运行一次重复任务
- 获取延迟:使用
Player.getPing() API 获取每个玩家的延迟
- 智能缓存:仅当延迟变化超过
update-threshold 时才更新显示
- 颜色编码:根据延迟质量阈值应用相应颜色
- 显示更新:使用格式化后的延迟更新标签页列表中的玩家名称
性能
- 异步执行:更新在异步线程中运行,以防止服务器卡顿
- 智能缓存:通过阈值系统避免不必要的更新
- 优化的字符串操作:预格式化颜色代码和高效的格式化方式
- 低内存占用:极小的缓存大小(仅为 UUID → 延迟映射)
基准测试(在 100 名玩家环境下测试):
- CPU 影响:每次更新周期 < 0.1%
- 内存使用:额外约 5KB RAM
- TPS 影响:无(异步操作)
兼容性
兼容以下插件:
LuckPerms(权限前缀)
EssentialsX(昵称)
Vault(权限集成)
大多数修改标签页列表的插件(软依赖)
服务器软件:
Spigot 1.21.1
Paper 1.21.1
Purpur 1.21.1
其他基于 Spigot 的分叉版本
故障排除
标签页列表中未显示延迟
- 检查插件是否已启用:
/plugins
- 验证插件启动期间控制台中无错误
- 检查
config.yml 是否符合有效 YAML 语法
- 尝试重新加载插件:
/reload confirm
- 确保没有冲突的插件覆盖标签页列表
显示名称被截断
- 缩短配置中的
ping-format 字符串
- 标签页列表有字符限制,请保持格式简洁
插件与昵称插件冲突
- OhTabListPing 使用软依赖和 MONITOR 优先级
- 它应与大多数昵称插件共存
- 如果发生冲突,请尝试调整插件加载顺序
性能问题
- 增加
update-interval(默认值:40 tick)
- 增加
update-threshold(默认值:5ms)
- 确保已启用
async-updates(默认值:true)
- 启用
debug 以检查错误
从源码构建
# 克隆仓库
git clone https://github.com/anaspui/ohtablistping.git
cd ohtablistping
# 使用 Maven 构建
mvn clean package
# 输出的 JAR 包将位于 target/OhTabListPing-x.x.x.jar
开发
项目结构
ohtablistping/
├── src/main/java/com/anaspui/ohtablistping/
│ ├── OhTabListPing.java # 主插件类
│ ├── ConfigManager.java # 配置处理器
│ ├── TabListUpdater.java # Ping 更新逻辑
│ ├── PlayerEventListener.java # 事件处理器
│ └── ConfigCommand.java # 命令执行器
├── src/main/resources/
│ ├── plugin.yml # 插件描述文件
│ └── config.yml # 默认配置文件
└── pom.xml # Maven 构建文件
使用的技术
- Java 21 - 核心语言
- Spigot API 1.21.1 - Minecraft 服务器 API
- Maven - 构建管理
- Bukkit Scheduler - 异步任务执行
贡献
欢迎贡献!请按照以下步骤操作:
- Fork 仓库
- 创建功能分支 (
git checkout -b feature/xyz-feature)
- 提交更改 (
git commit -m 'Add xyz feature')
- 推送到分支 (
git push origin feature/xyz-feature)
- 提交 Pull Request
许可证
本项目基于 MIT 许可证授权 - 详情请参阅 LICENSE 文件。
致谢
作者: anaspui
为 Minecraft 社区,用心打造!
⭐ 如果你觉得这个插件有用,请给仓库点个 Star!
OhTabListPing
A high-performance Minecraft server plugin that displays each player's ping (latency) in the tab list with color-coded formatting.
Brownies featured
Features
Real-time Ping Display - Shows ping values next to player names in the tab list
Color-Coded Indicators - Visual feedback for connection quality
In-Game Commands - View and modify configuration without editing files
High Performance - Async updates with intelligent caching
Fully Configurable - Customize format, colors, thresholds, and update intervals
Plugin Compatibility - Works alongside nickname and permission plugins
Optimized Updates - Only updates when ping changes significantly
Requirements
- Minecraft Version: 1.21.1+ (Spigot or Paper)
- Java Version: 21 or higher
- Server Software: Spigot, Paper, or compatible forks
Installation
- Download the latest release (
OhTabListPing-x.x.xx.jar) from Releases
- Place the JAR file in your server's
plugins/ folder
- Restart your server or load the plugin with a plugin manager
- Configure (optional) - Edit
plugins/OhTabListPing/config.yml to customize settings
- Reload the plugin if you changed the config:
/otlp reload
Commands
Manage the plugin configuration in-game with intuitive commands:
Main Command
/ohtablistping [subcommand] [args...]
Aliases: /otlp, /ping-config
Subcommands
View Help
/otlp help
Displays all available commands and usage examples.
List All Config Values
/otlp list
Shows all current configuration values in a formatted display.
Get Specific Value
/otlp get <key>
Examples:
/otlp get update-interval
/otlp get debug
/otlp get color-coding.thresholds.excellent
Set Configuration Value
/otlp set <key> <value>
Examples:
/otlp set update-interval 60
/otlp set debug true
/otlp set ping-format "{player} [{color}{ping}ms]"
/otlp set color-coding.colors.excellent §a
Reload Configuration
/otlp reload
Reloads config.yml from disk and restarts the update task with new settings.
Permissions
ohtablistping.admin - Full admin access (default: op)
ohtablistping.reload - Reload configuration only
ohtablistping.view - View config values only
ohtablistping.set - Modify config values only
Configuration
The plugin automatically creates a config.yml file on first run. Here's what you can customize:
# Update interval in ticks (20 ticks = 1 second)
update-interval: 40 # Recommended: 40 (2 seconds)
# Minimum ping change to trigger update (avoids unnecessary updates)
update-threshold: 5 # Only update if ping changed by 5+ ms
# Display format
ping-format: "{player} §7[{color}{ping}ms§7]"
# Color coding
color-coding:
enabled: true
colors:
excellent: "§a" # Green (0-50ms)
good: "§e" # Yellow (51-100ms)
acceptable: "§6" # Gold (101-150ms)
poor: "§c" # Red (151+ms)
thresholds:
excellent: 50
good: 100
acceptable: 150
# Performance settings
async-updates: true # Run updates asynchronously (recommended)
debug: false # Enable debug logging
Format Placeholders
{player} - Player's username
{ping} - Current ping value
{color} - Automatically determined color code
Color Codes
Standard Minecraft color codes are supported:
§a - Green
§e - Yellow
§6 - Gold
§c - Red
§7 - Gray
§f - White
How It Works
- Scheduled Updates: The plugin runs a repeating task every
update-interval ticks
- Ping Retrieval: Gets each player's ping using
Player.getPing() API
- Smart Caching: Only updates display if ping changed by more than
update-threshold
- Color Coding: Applies color based on ping quality thresholds
- Display Update: Updates the tab list player name with formatted ping
Performance
- Async Execution: Updates run asynchronously to prevent server lag
- Intelligent Caching: Avoids unnecessary updates using threshold system
- Optimized String Operations: Pre-formatted color codes and efficient formatting
- Low Memory Footprint: Minimal cache size (only UUID → ping map)
Benchmarks (tested with 100 players):
- CPU Impact: < 0.1% per update cycle
- Memory Usage: ~5KB additional RAM
- TPS Impact: None (async operations)
Compatibility
Compatible With:
LuckPerms (permission prefixes)
EssentialsX (nicknames)
Vault (permission integration)
Most tab-modifying plugins (soft dependencies)
Server Software:
Spigot 1.21.1
Paper 1.21.1
Purpur 1.21.1
Other Spigot-based forks
Troubleshooting
Ping not showing in tab list
- Check that the plugin is enabled:
/plugins
- Verify no errors in console during plugin startup
- Check
config.yml is valid YAML syntax
- Try reloading the plugin:
/reload confirm
- Ensure no conflicting plugins are overriding tab list
Display names appear truncated
- Shorten the
ping-format string in config
- Tab list has character limits, keep format concise
Plugin conflicts with nickname plugins
- OhTabListPing uses soft dependencies and MONITOR priority
- It should work alongside most nickname plugins
- If conflicts occur, try adjusting plugin load order
Performance issues
- Increase
update-interval (default: 40 ticks)
- Increase
update-threshold (default: 5ms)
- Ensure
async-updates is enabled (default: true)
- Enable
debug to check for errors
Building from Source
# Clone the repository
git clone https://github.com/anaspui/ohtablistping.git
cd ohtablistping
# Build with Maven
mvn clean package
# Output JAR will be in target/OhTabListPing-x.x.x.jar
Development
Project Structure
ohtablistping/
├── src/main/java/com/anaspui/ohtablistping/
│ ├── OhTabListPing.java # Main plugin class
│ ├── ConfigManager.java # Configuration handler
│ ├── TabListUpdater.java # Ping update logic
│ ├── PlayerEventListener.java # Event handlers
│ └── ConfigCommand.java # Command executor
├── src/main/resources/
│ ├── plugin.yml # Plugin descriptor
│ └── config.yml # Default configuration
└── pom.xml # Maven build file
Technologies Used
- Java 21 - Core language
- Spigot API 1.21.1 - Minecraft server API
- Maven - Build management
- Bukkit Scheduler - Async task execution
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/xyz-feature)
- Commit your changes (
git commit -m 'Add xyz feature')
- Push to the branch (
git push origin feature/xyz-feature)
- Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Credits
Author: anaspui
Built with LOVE! for the Minecraft community
⭐ If you find this plugin useful, please star the repository!
评论 0
登录后参与评分
还没有评论,来抢沙发吧