PickUp 模组
主要用途
一款允许对玩家和实体进行完全自定义拾取行为的插件,彻底重写并替换了 Minecraft 原版物品拾取逻辑。它支持自定义拾取范围、物品合并、拾取延迟等——在提供比原版系统更好性能的同时,完全兼容 Folia 的多线程架构。
关键控制
/up 或 /pickup: 所有拾取管理功能的主命令
/up true: 启用拾取功能(禁用原版拾取)
/up false: 禁用拾取功能(恢复原版机制)
/up status: 查看插件状态和当前配置
/up set <key> <value>: 动态修改配置设置
/up reload: 从磁盘重新加载配置
高级控制
/mc restart: 重启 Minecraft 服务器(需要外部启动脚本)
特性
- 玩家驱动模式: 玩家在移动时自动拾取附近的物品(可配置范围和间隔)
- 物品驱动模式: 物品主动寻找附近的玩家/实体(智能调度与延迟管理)
- 物品合并: 自动合并附近相同的物品(可配置范围)
- 副手支持: 掉落的物品可以主动拾取到副手中(需在配置中启用)。
- 自动装备: 实体自动装备更好的护甲/武器
高级特性
- 死亡日志: 增强的死亡消息包含坐标信息(可切换)
- 服务器重启: 使用外部脚本重启 Minecraft 服务器(参见服务器重载原理及外部脚本说明)。
性能与优化
- Folia 多线程: 全面支持 Folia 基于区域的线程模型
- 空间索引: 使用基于区块的索引系统进行高效的物品查找
- 智能调度: 可配置的刻间隔以实现最佳性能
- 内存管理: 自动清理无效物品和引用
关键优势
- ✅ 双模式系统: 选择玩家驱动或物品驱动的拾取方式(或两者兼用)
- ✅ Folia 就绪: 全面的多线程支持,适用于高性能服务器
- ✅ 非侵入式: 仅在激活时禁用原版拾取,完全可恢复
- ✅ 实时配置: 所有设置均可通过命令调整
- ✅ 智能物品管理: 自动合并、清理和优化
- ✅ 高兼容性: 适用于 Paper 1.17+ 和 Folia 1.19.4+
重要提示
- 需要 Paper/Folia: 不适用于 Spigot 或 CraftBukkit
- 权限要求: 所有命令需要
pickup.admin 权限(默认:OP)
- 配置: 所有设置位于
config.yml 中,可通过 /up reload 热重载
安装
- 确保您正在运行 Paper 1.17+ 或 Folia 1.19.4+
- 将
PickUp.jar 放入您的 plugins/ 文件夹
- 重启服务器
- 使用
/up status 验证安装
- 通过
/up set 或编辑 config.yml 配置设置
快速入门命令
/up help # 显示所有命令
/up true # 启用智能拾取
/up set pickup.range 2.5 # 将拾取范围设置为 2.5 格
/up set mode.player-driven true # 启用玩家驱动模式
/up reload # 应用配置更改
服务器重载原理及外部脚本说明
为什么不使用 Bukkit 的 /reload?
Bukkit/Spigot 原生的 /reload 命令存在严重的内存泄漏风险,官方团队不再推荐使用。为了确保服务器的长期稳定性,PickUp 插件采用“软关闭 + 外部重启”机制来进行安全重载。
工作原理
- 玩家执行
/mc restart
- 插件执行以下操作:
- 停止所有事件监听器
- 清理临时内存数据
- 在插件目录中创建
restart.flag 标记文件
- 调用
Bukkit.shutdown() 优雅地关闭服务器
- 外部启动脚本检测到
restart.flag 的存在 → 自动重启服务器
- 重启后,插件正常加载,配置生效,无残留状态
✅ 整个过程无内存泄漏且无类加载冲突,适用于生产环境。
Windows 启动脚本示例 (start.bat)
@echo off
chcp 936 >nul
title Minecraft服务器
cd /d "%~dp0"
echo [%date% %time%] 正在启动服务器...
java -Xmx2G -Xms1G -Dfile.encoding=GBK -jar folia-1.21.11-9.jar nogui
echo [%date% %time%] 服务器已关闭。
if exist restart.flag (
del restart.flag
echo [%date% %time%] 检测到重启请求,5秒后重新启动...
timeout /t 5 >nul
goto restart
)
echo.
echo 未检测到重启请求,5秒后自动退出...
timeout /t 5 >nul
? 使用说明:
- 将此脚本保存为
start.bat,放在与您的 paper-*.jar 相同的目录下
- 始终通过双击
start.bat 启动服务器
- 执行
/mc reload 后,服务器将自动重启并应用新配置
? Linux / macOS 用户?
只需编写具有相同逻辑的等效 shell 脚本 (start.sh):
#!/bin/bash
while true; do
java -Xmx1G -Xms1G -jar paper-1.21.10-115.jar nogui
if [ -f "restart.flag" ]; then
rm -f restart.flag
echo "Restart request detected, restarting in 5 seconds..."
sleep 5
else
echo "Normal exit."
break
fi
done
许可证
本项目根据 GPL-3.0 许可证授权 - 详情请参阅 LICENSE 文件。
PickUp Mod
Primary Purpose
A plugin that allows fully customizable pickup behavior for both players and mobs, completely rewriting and replacing Minecraft's vanilla item pickup logic. It supports customizing pickup range, item merging, pickup delay, and more—delivering better performance than the vanilla system while being fully compatible with Folia's multi-threaded architecture.
Key Controls
/up or /pickup: Main command for all pickup management functions
/up true: Enable pickup functionality (disables vanilla pickup)
/up false: Disable pickup functionality (restores vanilla mechanics)
/up status: View plugin status and current configuration
/up set <key> <value>: Dynamically modify configuration settings
/up reload: Reload configuration from disk
Advanced Controls
/mc restart: Restart the Minecraft server (requires an external startup script)
Features
- Player-Driven Mode: Players automatically pick up nearby items when moving (configurable range and interval)
- Item-Driven Mode: Items actively seek nearby players/mobs (smart scheduling with delay management)
- Item Merging: Automatically merges nearby identical items (configurable range)
- Offhand Support: Dropped items can be actively picked up into the offhand (enable in config).
- Auto Equipment: Mobs automatically equip better armor/weapons
Advanced Features
- Death Logging: Enhanced death messages with coordinates (toggleable)
- Server Restart: Restart the Minecraft server using an external script (see Server Reload Principle & External Script Explanation).
Performance & Optimization
- Folia Multi-Threading: Full support for Folia's region-based threading model
- Spatial Indexing: Efficient item lookup system using chunk-based indexing
- Smart Scheduling: Configurable tick intervals for optimal performance
- Memory Management: Automatic cleanup of invalid items and references
Key Advantages
- ✅ Dual-Mode System: Choose between player-driven or item-driven pickup (or both)
- ✅ Folia-Ready: Full multi-threading support for high-performance servers
- ✅ Non-Intrusive: Disables vanilla pickup only when active, fully restorable
- ✅ Real-Time Configuration: All settings adjustable via commands
- ✅ Smart Item Management: Automatic merging, cleanup, and optimization
- ✅ High Compatibility: Works with Paper 1.17+ and Folia 1.19.4+
Important Notes
- Requires Paper/Folia: Does not work with Spigot or CraftBukkit
- Permission Required:
pickup.admin permission for all commands (default: OP)
- Configuration: All settings in
config.yml, hot-reload with /up reload
Installation
- Ensure you're running Paper 1.17+ or Folia 1.19.4+
- Place
PickUp.jar in your plugins/ folder
- Restart your server
- Use
/up status to verify installation
- Configure settings via
/up set or edit config.yml
Quick Start Commands
/up help # Show all commands
/up true # Enable smart pickup
/up set pickup.range 2.5 # Set pickup range to 2.5 blocks
/up set mode.player-driven true # Enable player-driven mode
/up reload # Apply configuration changes
Server Reload Principle & External Script Explanation
Why Not Use Bukkit's /reload?
Bukkit/Spigot's native /reload command carries a significant risk of memory leaks and is no longer recommended by the official teams. To ensure long-term server stability, the PickUp plugin employs a "soft shutdown + external restart" mechanism for safe reloading.
How It Works
- A player executes
/mc restart
- The plugin performs the following actions:
- Stops all event listeners
- Cleans up temporary in-memory data
- Creates a
restart.flag marker file in the plugin directory
- Calls
Bukkit.shutdown() to gracefully shut down the server
- The external startup script detects the existence of
restart.flag → automatically restarts the server
- After restart, the plugin loads normally, configuration takes effect, with no leftover state
✅ The entire process is free of memory leaks and class loading conflicts, suitable for production environments.
Windows Startup Script Example (start.bat)
@echo off
chcp 936 >nul
title Minecraft服务器
cd /d "%~dp0"
echo [%date% %time%] 正在启动服务器...
java -Xmx2G -Xms1G -Dfile.encoding=GBK -jar folia-1.21.11-9.jar nogui
echo [%date% %time%] 服务器已关闭。
if exist restart.flag (
del restart.flag
echo [%date% %time%] 检测到重启请求,5秒后重新启动...
timeout /t 5 >nul
goto restart
)
echo.
echo 未检测到重启请求,5秒后自动退出...
timeout /t 5 >nul
? Usage Instructions:
- Save this script as
start.bat in the same directory as your paper-*.jar
- Always start the server by double-clicking
start.bat
- After executing
/mc reload, the server will automatically restart and apply new configuration
? For Linux / macOS Users?
Simply write an equivalent shell script (start.sh) with the same logic:
#!/bin/bash
while true; do
java -Xmx1G -Xms1G -jar paper-1.21.10-115.jar nogui
if [ -f "restart.flag" ]; then
rm -f restart.flag
echo "Restart request detected, restarting in 5 seconds..."
sleep 5
else
echo "Normal exit."
break
fi
done
License
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.
评论 0
登录后参与评分
还没有评论,来抢沙发吧