
? ForbiddenBlocks 插件 ?️
描述
通过 ForbiddenBlocks Plugin 增强你的 Minecraft 服务器游戏体验!? 这款强大的插件允许你根据物品的显示名称,细致地控制建筑环境,限制特定物品的放置。想象一下,阻止包含指定名称或lore(物品描述)的方块被随意放置——ForbiddenBlocks 让这一切变得轻而易举!?️
拥有相应权限的服务器管理员和玩家可以禁止或允许物品放置,这为服务器管理提供了多功能工具。限制可以应用于全局,影响所有玩家,也可以专门针对个别玩家,从而对方块放置进行细粒度的控制。无论你是想在生存世界中防止使用某些装饰性方块,还是想限制在特定区域进行建造,ForbiddenBlocks 都能赋予你掌控力!?➡️⛔
安装说明
只需几个简单的步骤即可开始使用 ForbiddenBlocks:
- ? 下载 ForbiddenBlocks 插件的 JAR 文件。
- ? 将 JAR 文件放入 Minecraft 服务器的
plugins 目录中。
- ? 重启服务器以激活插件。
就是这样!ForbiddenBlocks 现已准备好帮助你管理服务器的建筑格局。?
用法
通过这些易于使用的命令,掌控服务器的建筑规则:
命令
-
/forbiditem [player|global] [itemName]: ⛔ 禁止物品放置。
- 使用此命令防止玩家当前手持的物品或指定的
itemName 被放置。
- 可以通过名称针对特定玩家,或使用
global 将限制应用于整个服务器。
- 如果省略
itemName,则禁止手中持有的物品。
- 物品通过其显示名称进行识别,确保与自定义物品的兼容性。
/forbiditem global TNT <- 禁止所有人使用TNT
/forbiditem Notch Diamond Block <- 禁止玩家 'Notch' 使用钻石块
/forbiditem global <- 全局禁止你手中持有的物品
-
/allowitem [player|global] [itemName]: ✅ 允许物品放置。
- 逆转
/forbiditem 的效果,允许之前被禁止的物品放置。
- 工作原理类似于
/forbiditem,允许你针对玩家或全局设置,并可选择指定 itemName。
- 如果未提供
itemName,则重新允许手中持有的物品。
/allowitem global TNT <- 再次允许所有人使用TNT
/allowitem Notch Diamond Block <- 再次允许玩家 'Notch' 使用钻石块
/allowitem global <- 再次全局允许你手中持有的物品
-
/togglemessages: ? 切换放置限制消息。
- 玩家可以使用此命令控制他们在尝试放置禁止方块时是否收到消息。
- 通过允许玩家静音通知来个性化游戏体验。
/togglemessages <- 切换你的消息通知
-
/listforbidden [player]: ? 列出禁止的物品。
- 显示当前所有被禁止的物品列表。
- 可选择指定一个
player 名称以查看专门对该玩家禁止的物品。
- 如果没有玩家名称,则显示全局禁止的物品。
/listforbidden <- 列出全局禁止的物品
/listforbidden Notch <- 列出玩家 'Notch' 被禁止的物品
-
/reloadconfig: ? 重载插件配置。
- 应用
config.yml 文件中进行的更改,无需重启服务器。
- 非常适合快速调整和测试配置更改。
/reloadconfig <- 重载 config.yml
权限
通过这些权限微调对 ForbiddenBlocks 命令的访问:
-
forbiddenblocks.forbid: ⛔ 允许使用 /forbiditem 来限制物品放置。
-
forbiddenblocks.allow: ✅ 允许使用 /allowitem 来重新启用物品放置。
-
forbiddenblocks.togglemessages: ? 允许使用 /togglemessages 来管理通知。
-
forbiddenblocks.list: ? 允许使用 /listforbidden 来查看禁止的物品。
-
forbiddenblocks.reload: ? 允许使用 /reloadconfig 来重载配置。
# 权限插件(如 LuckPerms)中的示例
groups:
admin:
permissions:
- forbiddenblocks.* # 给管理员所有 ForbiddenBlocks 权限
builder:
permissions:
- forbiddenblocks.list # 允许建筑者列出禁止的物品
配置
通过编辑位于插件文件夹中的 config.yml 文件,自定义 ForbiddenBlocks 以完美适应你的服务器需求。
以下是配置选项的详细说明:
- Messages: ✉️ 根据你的喜好定制游戏内消息!
- 自定义插件针对不同操作发送的每条消息(例如,当物品被禁止或玩家收到通知时)。
- 利用 MiniMessage 格式标签 添加丰富的文本格式,如颜色
<color:red>、样式 <b> 等等!✨
- 参考
config.yml 中的默认消息示例,释放你的创造力!?
- 可用的消息路径:
messages.cannotPlace: 玩家尝试放置禁止方块时的消息。
messages.itemForbidden: 物品成功被禁止时的消息。
messages.itemAllowed: 物品成功被允许时的消息。
messages.mustHoldNamedItem: 在使用 /forbiditem 或 /allowitem 但未手持命名物品时的消息。
messages.noPermission: 通用无权限消息。
messages:
cannotPlace: "<red>? 你不被允许在此处放置 <item>!</red>"
itemForbidden: "<green>✅ <item> 现在已被禁止!</green>"
itemAllowed: "<green>✅ <item> 现在再次被允许使用!</green>"
mustHoldNamedItem: "<yellow>⚠️ 你必须手持一个带有显示名称的物品!</yellow>"
noPermission: "<red>❌ 你没有权限使用此命令。</red>"
```
* **选项 (Options)**:⚙️ 插件的全局设置。
* `sendMessages`:一个布尔值选项(true/false),用于全局控制插件是否向玩家发送限制消息。
* `true`(默认):当玩家尝试放置被禁止的方块时,会向他们发送消息。
* `false`:不发送任何消息,提供静默限制效果。
```yaml
options:
sendMessages: true
```
* **玩家禁止物品 (playerForbiddenItems)**:?️ 精确管理禁止放置的物品。
* 此部分定义了哪些物品禁止放置,包括全局范围和针对特定玩家的设置。
* 插件会将正在放置的物品的**显示名称**与这些配置进行比对检查。
* `global`:服务器中**所有玩家**都禁止放置的物品显示名称列表。
* 在此处添加物品显示名称以实现全服务器的限制。
* 支持纯文本物品名称、命名空间键(如 `minecraft:bedrock`),甚至支持使用 MiniMessage 格式化的显示名称以进行高级物品自定义。
```yaml
playerForbiddenItems:
global:
- "TNT"
- "Minecraft:Bedrock" # 带命名空间的示例
- "<gradient:#FF0000:#0000FF>超级爆炸箱</gradient>" # 带 MiniMessage 格式化的示例
```
* `PlayerName`:为**单个玩家**创建专属部分,需使用其确切的玩家名称。
* 在每个玩家名称下方,列出**仅对该玩家**禁止放置的物品显示名称。
* 这允许为每个玩家实现高度定制化的建筑权限!
```yaml
playerForbiddenItems:
global:
- "TNT"
Notch: # 针对 'Notch' 的玩家专属限制
- "Oak Log"
- "Oak Plank"
```
## 工作原理 ⚙️
ForbiddenBlocks 插件通过以下方式工作:
1. **监听方块放置事件:** 插件注册了一个事件监听器,监控 Minecraft 服务器中的 `BlockPlaceEvent`。每当玩家尝试放置方块时,都会触发此事件。 ?
2. **检查物品显示名称:** 当发生方块放置事件时,插件会从玩家手中获取物品并检查其是否具有显示名称。然后使用 MiniMessage 将该显示名称序列化为字符串。 ?️
3. **与禁止列表进行验证:** 插件随后将此显示名称与两个列表进行核对:
* **全局禁止物品:** 定义在 `config.yml` 中 `playerForbiddenItems.global` 下的,禁止所有玩家放置的物品列表。 ?
* **玩家专属禁止物品:** 定义在 `config.yml` 中 `playerForbiddenItems.PlayerName` 下的,禁止特定玩家放置的物品列表。 ?
4. **取消放置并通知玩家:** 如果已放置物品的显示名称在全局或玩家专属禁止列表中,插件将取消 `BlockPlaceEvent`,从而阻止方块被放置。 ?
* 如果在配置中启用(`options.sendMessages: true`),插件会向玩家发送一条可自定义的消息,告知他们不允许放置该方块。 ?
此过程确保方块放置限制得以平滑且高效地执行,增强了你对服务器建筑环境的控制能力。 ✨
## 贡献代码
? **欢迎贡献!** 如果你有改进建议、新功能想法或漏洞修复,请随时参与贡献!
* 提交包含你更改内容的 **Pull Request**。
* ? **打开 Issue** 以讨论漏洞或提出增强建议。
让我们一起让 ForbiddenBlocks 变得更好! ?
## 许可证
本项目采用 **MIT 许可证** 授权。你可以按照许可证条款自由地使用、修改和分发它。 ?

? ForbiddenBlocks Plugin ?️
Description
Enhance your Minecraft server's gameplay with the ForbiddenBlocks Plugin! ? This powerful plugin allows you to meticulously control the building environment by restricting the placement of specific items based on their display names. Imagine preventing unwanted placement of named or lore containing blocks – ForbiddenBlocks makes it easy! ?️
Server administrators and players with the necessary permissions gain the ability to forbid or allow item placement, offering a versatile tool for server management. Restrictions can be applied globally, affecting all players, or specifically to individual players, providing fine-grained control over block placement. Whether you want to prevent the use of certain decorative blocks in a survival world or restrict building in specific zones, ForbiddenBlocks gives you the power! ?➡️⛔
Installation Instructions
Get started with ForbiddenBlocks in just a few simple steps:
- ? Download the ForbiddenBlocks plugin JAR file.
- ? Place the JAR file into the
plugins directory of your Minecraft server.
- ? Restart your server to activate the plugin.
That's it! ForbiddenBlocks is now ready to help you manage your server's building landscape. ?
Usage
Take command of your server's building rules with these easy-to-use commands:
Commands
-
/forbiditem [player|global] [itemName]: ⛔ Forbids item placement.
- Use this command to prevent the placement of the item currently held by a player or specify an
itemName.
- Target specific players by name or use
global to apply the restriction server-wide.
- If
itemName is omitted, the item in hand will be forbidden.
- Items are identified by their Display Name, ensuring compatibility with custom items.
/forbiditem global TNT <- Forbids TNT for everyone
/forbiditem Notch Diamond Block <- Forbids Diamond Blocks for player 'Notch'
/forbiditem global <- Forbids the item you are holding globally
-
/allowitem [player|global] [itemName]: ✅ Allows item placement.
- Reverses the effect of
/forbiditem, permitting the placement of previously forbidden items.
- Works similarly to
/forbiditem, allowing you to target players or the global setting, and optionally specify an itemName.
- If
itemName is not provided, the item in hand will be allowed again.
/allowitem global TNT <- Allows TNT for everyone again
/allowitem Notch Diamond Block <- Allows Diamond Blocks for player 'Notch' again
/allowitem global <- Allows the item you are holding globally again
-
/togglemessages: ? Toggles placement restriction messages.
- Players can use this command to control whether they receive messages when attempting to place a forbidden block.
- Personalize the gameplay experience by allowing players to silence notifications if desired.
/togglemessages <- Toggles your message notifications
-
/listforbidden [player]: ? Lists forbidden items.
- Displays a list of all currently forbidden items.
- Optionally specify a
player name to view items forbidden specifically for that player.
- Without a player name, it shows globally forbidden items.
/listforbidden <- Lists globally forbidden items
/listforbidden Notch <- Lists items forbidden for player 'Notch'
-
/reloadconfig: ? Reloads plugin configuration.
- Applies changes made in the
config.yml file without requiring a server restart.
- Ideal for quick adjustments and testing of configuration changes.
/reloadconfig <- Reloads the config.yml
Permissions
Fine-tune access to the ForbiddenBlocks commands with these permissions:
-
forbiddenblocks.forbid: ⛔ Allows use of /forbiditem to restrict item placement.
-
forbiddenblocks.allow: ✅ Allows use of /allowitem to re-enable item placement.
-
forbiddenblocks.togglemessages: ? Allows use of /togglemessages to manage notifications.
-
forbiddenblocks.list: ? Allows use of /listforbidden to view forbidden items.
-
forbiddenblocks.reload: ? Allows use of /reloadconfig to reload the configuration.
# Example in permissions plugin (like LuckPerms)
groups:
admin:
permissions:
- forbiddenblocks.* # Gives all ForbiddenBlocks permissions to admins
builder:
permissions:
- forbiddenblocks.list # Allows builders to list forbidden items
Configuration
Customize ForbiddenBlocks to perfectly fit your server's needs by editing the config.yml file, located in the plugin's folder.
Here's a breakdown of the configuration options:
-
Messages: ✉️ Tailor the in-game messages to your liking!
- Customize every message sent by the plugin for different actions (e.g., when an item is forbidden or when a player is notified).
- Leverage MiniMessage formatting tags to add rich text formatting like colors
<color:red>, styles <b>, and more! ✨
- Refer to the
config.yml for default message examples and unleash your creativity! ?
- Available message paths:
messages.cannotPlace: Message when a player tries to place a forbidden block.
messages.itemForbidden: Message when an item is successfully forbidden.
messages.itemAllowed: Message when an item is successfully allowed.
messages.mustHoldNamedItem: Message when /forbiditem or /allowitem is used without holding a named item.
messages.noPermission: Generic no permission message.
messages:
cannotPlace: "<red>? You are not allowed to place <item>here!</red>"
itemForbidden: "<green>✅ <item> is now forbidden!</green>"
itemAllowed: "<green>✅ <item> is now allowed again!</green>"
mustHoldNamedItem: "<yellow>⚠️ You must be holding an item with a display name!</yellow>"
noPermission: "<red>❌ You don't have permission to use this command.</red>"
-
Options: ⚙️ Global plugin settings.
sendMessages: A boolean option (true/false) to globally control whether the plugin sends restriction messages to players.
true (default): Messages are sent to players when they try to place a forbidden block.
false: No messages are sent, providing a silent restriction.
options:
sendMessages: true
-
playerForbiddenItems: ?️ Manage forbidden items with precision.
- This section defines which items are forbidden for placement, both globally and for specific players.
- The plugin checks the Display Name of the item being placed against these configurations.
global: A list of item display names that are forbidden for all players on the server.
- Add item display names here to implement server-wide restrictions.
- Supports plain text item names, namespaced keys (like
minecraft:bedrock), and even MiniMessage formatted display names for advanced item customization.
playerForbiddenItems:
global:
- "TNT"
- "Minecraft:Bedrock" # Example with namespace
- "<gradient:#FF0000:#0000FF>Super Explosive Crate</gradient>" # Example with MiniMessage formatting
PlayerName: Create sections for individual players using their exact player names.
- Under each player's name, list item display names that are forbidden specifically for that player.
- This allows for highly customized building permissions per player!
playerForbiddenItems:
global:
- "TNT"
Notch: # Player-specific restrictions for 'Notch'
- "Oak Log"
- "Oak Plank"
How it works ⚙️
The ForbiddenBlocks plugin works by:
- Listening to Block Placement Events: The plugin registers an event listener that monitors
BlockPlaceEvent in your Minecraft server. This event is triggered every time a player attempts to place a block. ?
- Checking Item Display Names: When a block placement event occurs, the plugin retrieves the item from the player's hand and checks if it has a display name. It then uses MiniMessage to serialize this display name to a string. ?️
- Verifying Against Forbidden Lists: The plugin then checks this display name against two lists:
- Global Forbidden Items: A list of items forbidden for all players, defined in the
config.yml under playerForbiddenItems.global. ?
- Player-Specific Forbidden Items: Lists of items forbidden for specific players, also defined in
config.yml under playerForbiddenItems.PlayerName. ?
- Cancelling Placement and Notifying Player: If the placed item's display name is found in either the global or the player-specific forbidden lists, the plugin cancels the
BlockPlaceEvent, preventing the block from being placed. ?
- If enabled in the configuration (
options.sendMessages: true), the plugin sends a customizable message to the player informing them that they are not allowed to place the block. ?
This process ensures that block placement restrictions are enforced smoothly and efficiently, enhancing your server's control over the building environment. ✨
Contributing
? Contributions are welcome! If you have ideas for improvements, new features, or bug fixes, please don't hesitate to contribute!
- Do Submit a pull request with your changes.
- ? Open an issue to discuss bugs or suggest enhancements.
Let's make ForbiddenBlocks even better together! ?
License
This project is licensed under the MIT License. Feel free to use, modify, and distribute it as per the terms of the license. ?
评论 0
登录后参与评分
还没有评论,来抢沙发吧