RefreshLoot - Loot Refresh Plugin
Plugin Information
- Name: RefreshLoot
- Version: 1.0.0
- Author: 114514h
- Supported Version: Minecraft 1.21.4
- API Version: Spigot 1.21
Function Description
RefreshLoot is a plugin designed to refresh items in containers across the world. Administrators can use commands to refresh random slots in all containers, including chests, trapped chests, large chests, barrels, furnaces, hoppers, and more.
Main Features
- Smart Refresh: Randomly selects container slots for item refreshing.
- Container Clearing: Option to clear all items in containers before refreshing.
- Configuration Reload: Supports hot-reloading configuration files without server restart.
- Multiple Container Support: Compatible with chests, trapped chests, large chests, barrels, furnaces, hoppers, etc.
- Asynchronous Processing: Avoids server lag and ensures smooth operation.
- Highly Configurable: Customizable refresh items, quantities, container types, etc.
Commands
/refreshlootor/rloot- Refresh random slots in all containers across the world./refreshloot reloador/rloot reload- Reload the configuration file.- Permission:
refreshloot.admin(default OP permission)
Configuration Instructions
Basic Settings
settings:
debug: false # Whether to enable debug mode
refresh-interval: 300 # Refresh interval in seconds
random-slots: 3 # Number of random slots to refresh each time
clear-containers: true # Whether to clear container contents before refreshing
Container Clearing Explanation:
clear-containers: true- Clears all items in containers before adding new random items.clear-containers: false- Retains existing items in containers and only adds new items to randomly selected slots.- Recommended setting:
truefor better refresh results.
Container Configuration
Each container type can be configured individually:
enabled: Whether to enable refreshing for this container type.refresh-slots: Number of slots to refresh each time.items: List of possible items to refresh.
Item Format
Item configuration format: MATERIAL:min-max
DIAMOND:1-3- Diamonds, quantity 1-3.BREAD:2-5- Bread, quantity 2-5.IRON_SWORD:1- Iron Sword, fixed quantity of 1.
Important Note: In Minecraft 1.21.4, the names of golden equipment have been changed:
GOLD_HELMET→GOLDEN_HELMETGOLD_CHESTPLATE→GOLDEN_CHESTPLATEGOLD_LEGGINGS→GOLDEN_LEGGINGSGOLD_BOOTS→GOLDEN_BOOTS
Refer to the MATERIAL_NAMES.md file for a detailed list of item names.
Supported Container Types
- Chest (chest) - Regular chest
- Trapped Chest (trapped_chest) - Trapped chest
- Large Chest (large_chest) - Double chest
- Barrel (barrel) - Barrel
- Furnace (furnace) - Furnace, blast furnace, smoker
- Hopper (hopper) - Hopper
Installation Method
- Place the compiled
RefreshLoot-1.0.0.jarfile into the server'spluginsfolder. - Restart the server or use the
/reloadcommand. - The plugin will automatically generate a configuration file
config.yml. - Modify the configuration file as needed.
- Use the
/rlootcommand to start refreshing containers.
Reload Functionality
The plugin supports hot-reloading configuration files without restarting the server:
Usage
/rloot reload
Reload Features
- Instant Effect: Changes take effect immediately after modifying the configuration file.
- Safe Reload: Includes error handling to prevent plugin failure during reload.
- Debug Information: Displays reload configuration status when debug mode is enabled.
- Asynchronous Processing: Reload process does not block the server's main thread.
When to Reload
- After modifying container configurations.
- After adjusting the item refresh list.
- After changing plugin settings.
- After updating message configurations.
Notes
- The plugin scans all chunks in the world to find containers, which may take a long time in large worlds.
- It is recommended to use the refresh command during periods of low server load.
- Customize items and quantities for each container type in the configuration file.
- Enable debug mode to view detailed refresh information.
Permissions
refreshloot.admin- Allows the use of loot refresh commands (default OP permission)
RefreshLoot - 物资刷新插件
插件信息
- 名称: RefreshLoot
- 版本: 1.0.0
- 作者: 114514h
- 支持版本: Minecraft 1.21.4
- API版本: Spigot 1.21
功能描述
RefreshLoot 是一个用于刷新世界内容器物品的插件。管理员可以使用命令来刷新世界内所有容器的随机槽位,包括箱子、陷阱箱、大箱子、木桶、熔炉、漏斗等。
主要特性
- 智能刷新: 随机选择容器中的槽位进行物品刷新
- 容器清除: 可选择在刷新前清除容器中的所有物品
- 配置重载: 支持热重载配置文件,无需重启服务器
- 多种容器支持: 支持箱子、陷阱箱、大箱子、木桶、熔炉、漏斗等
- 异步处理: 避免服务器卡顿,确保流畅运行
- 高度可配置: 可自定义刷新物品、数量、容器类型等
命令
/refreshloot或/rloot- 刷新世界内所有容器的随机槽位/refreshloot reload或/rloot reload- 重新加载配置文件- 权限:
refreshloot.admin(默认OP权限)
配置说明
基本设置
settings:
debug: false # 是否启用调试模式
refresh-interval: 300 # 刷新间隔(秒)
random-slots: 3 # 每次刷新时随机刷新的槽位数量
clear-containers: true # 是否在刷新前清除容器内容
清除容器功能说明:
clear-containers: true- 在刷新物品前先清除容器中的所有物品,然后添加新的随机物品clear-containers: false- 保留容器中的现有物品,只在随机选择的槽位中添加新物品- 建议设置为
true以获得更好的刷新效果
容器配置
每个容器类型都可以单独配置:
enabled: 是否启用该容器类型的刷新refresh-slots: 每次刷新时刷新的槽位数量items: 可能刷新的物品列表
物品格式
物品配置格式:MATERIAL:min-max
DIAMOND:1-3- 钻石,数量1-3个BREAD:2-5- 面包,数量2-5个IRON_SWORD:1- 铁剑,固定1个
重要提示: 在Minecraft 1.21.4版本中,金质装备的名称已更改:
GOLD_HELMET→GOLDEN_HELMETGOLD_CHESTPLATE→GOLDEN_CHESTPLATEGOLD_LEGGINGS→GOLDEN_LEGGINGSGOLD_BOOTS→GOLDEN_BOOTS
详细物品名称对照表请参考 MATERIAL_NAMES.md 文件。
支持的容器类型
- 箱子 (chest) - 普通箱子
- 陷阱箱 (trapped_chest) - 陷阱箱
- 大箱子 (large_chest) - 双箱子
- 木桶 (barrel) - 木桶
- 熔炉 (furnace) - 熔炉、高炉、烟熏炉
- 漏斗 (hopper) - 漏斗
安装方法
- 将编译好的
RefreshLoot-1.0.0.jar文件放入服务器的plugins文件夹 - 重启服务器或使用
/reload命令 - 插件会自动生成配置文件
config.yml - 根据需要修改配置文件
- 使用
/rloot命令开始刷新容器
重载功能
插件支持热重载配置文件,无需重启服务器:
使用方法
/rloot reload
重载功能特点
- 实时生效: 修改配置文件后立即生效
- 安全重载: 包含错误处理,重载失败不会影响插件运行
- 调试信息: 启用调试模式时显示重载后的配置状态
- 异步处理: 重载过程不会阻塞服务器主线程
重载时机
- 修改容器配置后
- 调整刷新物品列表后
- 更改插件设置后
- 更新消息配置后
## 注意事项
- 插件会扫描世界中的所有区块来查找容器,在大世界中可能需要较长时间
- 建议在服务器负载较低时使用刷新命令
- 可以通过配置文件自定义每种容器刷新的物品和数量
- 启用调试模式可以查看详细的刷新信息
## 权限
- `refreshloot.admin` - 允许使用物资刷新命令(默认OP权限)

