OneWay Elytra
一个适用于 Paper/Spigot 1.21.1 的 Minecraft 插件,实现了一套基于半径限制的特殊鞘翅系统。
此插件的功能
本插件创建了一个“单向鞘翅”(OneWay Elytra)系统,其中某些鞘翅只能在围绕出生点的可配置半径内使用。普通鞘翅照常工作,不受影响。
功能特性
- 基于半径的鞘翅使用:单向鞘翅只能在围绕出生点定义的半径内穿戴
- 自动鞘翅管理:
- 玩家进入半径时会自动获得一个单向鞘翅
- 当玩家离开半径时(仅在未滑翔状态下),鞘翅会被自动移除
- 防止滥用:
- 不允许在半径外开始新的滑翔
- 已经在飞行的玩家可以继续飞行直至着陆
- 着陆检测:当玩家在半径外着陆时,鞘翅会被自动移除
- 灵活的移除模式:
MOVE_TO_INVENTORY:鞘翅被移入物品栏(若物品栏已满则掉落)
DROP:鞘翅立即被删除(无法拾取)
安装方法
- 下载
OneWayElytra-1.0.0.jar 文件
- 将其放入服务器的
plugins 文件夹中
- 重启服务器
- 配置出生点和半径(见下文)
配置
配置文件位于 plugins/OneWayElytra/config.yml:
# 出生点(世界 + 坐标)
spawn:
world: "world"
x: 0.0
y: 64.0
z: 0.0
# 半径(以方块为单位)
radius: 100
# 移除模式:MOVE_TO_INVENTORY 或 DROP
removeMode: "MOVE_TO_INVENTORY"
# 消息提示
messages:
denyGlide: "&c你无法在此处使用单向鞘翅进行滑翔!"
removedAfterLanding: "&c由于你在允许区域外着陆,单向鞘翅已被移除。"
# 调试模式(显示额外信息)
debug: false
命令
/oe setspawn
将你的当前位置设置为出生点。
/oe setradius <blocks>
设置半径(以方块为单位)(例如,/oe setradius 50)。
/oe setremovemode <MOVE_TO_INVENTORY|DROP>
更改移除模式:
MOVE_TO_INVENTORY:鞘翅被移入物品栏
DROP:鞘翅被删除
/oe info
显示当前配置(出生点、半径、移除模式)。
/oe reload
重新加载配置文件。
/oe give <player> [amount]
给予玩家一个或多个单向鞘翅。
/oe tag
将你手中的鞘翅标记为单向鞘翅。
/oe untag
移除你手中鞘翅上的标记。
/oe check
检查你手中的鞘翅是否为单向鞘翅。
别名:/onewayelytra, /oneway
权限
onewayelytra.admin - 允许所有管理命令(默认:OP)
onewayelytra.bypass - 忽略所有一向鞘翅规则(默认:OP)
工作原理
- 鞘翅标记:单向鞘翅通过 PersistentDataContainer (PDC) 使用特殊标签进行标记
- 自动分发:当玩家进入定义半径且没有单向鞘翅时,他们会自动获得一个
- 滑翔保护:开始滑翔时,插件会检查玩家是否在半径内。在半径外,启动将被阻止
- 着陆检测:每 2 个刻检查一次任务,查看玩家是否已着陆,如果他们在半径外则移除鞘翅
技术细节
- API 版本:1.21.1
- 依赖项:无(仅依赖 Paper API)
- Java 版本:21
- 标记方式:使用 NamespacedKey
onewayelytra:oneway 的 PersistentDataContainer
故障排除
问题:鞘翅未自动给予/移除
- 检查出生点是否正确设置(
/oe info)
- 检查你是否在正确的半径内
- 在配置中启用调试模式(
debug: true)并检查控制台
问题:特殊字符显示不正确
- 确保配置文件保存为 UTF-8 编码
- 构建文件已配置为支持 UTF-8
OneWay Elytra
A Minecraft plugin for Paper/Spigot 1.21.1 that implements a special Elytra system with radius-based restrictions.
What does this plugin do?
This plugin creates a "OneWay Elytra" system where certain Elytras can only be used within a configurable radius around a spawn point. Normal Elytras work as usual and are not affected.
Features
- Radius-based Elytra usage: OneWay Elytras can only be worn within a defined radius around the spawn point
- Automatic Elytra management:
- Players automatically receive a OneWay Elytra when entering the radius
- The Elytra is automatically removed when players leave the radius (only when not gliding)
- Abuse prevention:
- New gliding cannot be started outside the radius
- Players already flying can continue their flight until landing
- Landing detection: When a player lands outside the radius, the Elytra is automatically removed
- Flexible removal modes:
MOVE_TO_INVENTORY: Elytra is moved to inventory (or dropped if full)
DROP: Elytra is immediately deleted (cannot be picked up)
Installation
- Download the
OneWayElytra-1.0.0.jar file
- Place it in your server's
plugins folder
- Restart your server
- Configure the spawn point and radius (see below)
Configuration
The configuration file is located at plugins/OneWayElytra/config.yml:
# Spawn point (World + coordinates)
spawn:
world: "world"
x: 0.0
y: 64.0
z: 0.0
# Radius in blocks
radius: 100
# Removal mode: MOVE_TO_INVENTORY or DROP
removeMode: "MOVE_TO_INVENTORY"
# Messages
messages:
denyGlide: "&cYou cannot glide here with the OneWay Elytra!"
removedAfterLanding: "&cThe OneWay Elytra was removed because you landed outside the allowed area."
# Debug mode (shows additional information)
debug: false
Commands
/oe setspawn
Sets the spawn point to your current position.
/oe setradius <blocks>
Sets the radius in blocks (e.g., /oe setradius 50).
/oe setremovemode <MOVE_TO_INVENTORY|DROP>
Changes the removal mode:
MOVE_TO_INVENTORY: Elytra is moved to inventory
DROP: Elytra is deleted
/oe info
Shows the current configuration (spawn point, radius, removal mode).
/oe reload
Reloads the configuration file.
/oe give <player> [amount]
Gives a player one or multiple OneWay Elytras.
/oe tag
Marks the Elytra in your hand as a OneWay Elytra.
/oe untag
Removes the mark from the Elytra in your hand.
/oe check
Checks if the Elytra in your hand is a OneWay Elytra.
Aliases: /onewayelytra, /oneway
Permissions
onewayelytra.admin - Allows all admin commands (default: OP)
onewayelytra.bypass - Ignores all OneWay Elytra rules (default: OP)
How it works
- Elytra marking: OneWay Elytras are marked via PersistentDataContainer (PDC) with a special tag
- Automatic distribution: When a player enters the defined radius without a OneWay Elytra, they automatically receive one
- Glide protection: When starting a glide, the plugin checks if the player is within the radius. Outside the radius, the start is blocked
- Landing detection: A task checks every 2 ticks if players have landed and removes the Elytra if they're outside the radius
Technical Details
- API Version: 1.21.1
- Dependencies: None (Paper API only)
- Java Version: 21
- Marking: PersistentDataContainer with NamespacedKey
onewayelytra:oneway
Troubleshooting
Problem: Elytra is not automatically given/removed
- Check if the spawn point is correctly set (
/oe info)
- Check if you're within the correct radius
- Enable debug mode in the config (
debug: true) and check the console
Problem: Special characters are displayed incorrectly
- Make sure the config file is saved as UTF-8
- The build file is already configured for UTF-8
评论 0
登录后参与评分
还没有评论,来抢沙发吧