JobsReborn-PatchPlaceBreak [插件]
JobsReborn 的放置与破坏补丁扩展。
放置与破坏问题
在 JobsReborn 中,放置一个方块然后将其破坏会被计为有效的职业操作,从而导致玩家获得报酬。 鉴于这一事实,很容易设想一种情况:使用精准采集镐采集钻石矿石,并立即重新放置它,以便可以无限重复此过程……
JobsReborn 的一种解决方案是在放置钻石矿石时扣除金钱和经验值,从而防止上述场景发生。但这并不完美:如果你出于任何原因希望使用金钱和经验值加成,那么当方块被破坏时应支付的金额将高于放置同一方块时应扣除的金额。而且……嗯……为了装饰而放置方块却损失金钱和经验值,也不太受玩家欢迎。
事实上,JobsReborn 提供的放置与破坏补丁已经提供了一个更好的解决方案。然而,其主要限制在于保护解除前的最大延迟为 14 天。此外,你必须为每个方块指定一段固定的时间,在此期间再次破坏该方块将无法赚取金钱和经验值。总体而言,这肯定是一个进步,但我们应当/能够更进一步。这正是本插件发挥作用的地方。
功能特性
- 提供与 JobsReborn 已提供的放置与破坏保护相似且高效的保护机制(包括活塞补丁、双玩家漏洞利用防护、服务器重启韧性等);
- 无时间限制的保护,彻底杜绝你服务器上任何可能的漏洞利用者;
- 对受限方块的更细粒度自定义(受保护的方块列表可以是包含模式或排除模式),以便在微调性能的同时轻松最大化保护效果;
- 配置简单快捷,默认使用 SQLite 作为持久化解决方案,便于快速发现和本插件的实验性测试(但不推荐在生产环境中使用,因为性能较低);
- 支持使用 MySQL 或 MariaDB 数据库(观察到性能显著提升);
- 通过严格的验证尽早检测配置问题,确保插件能够快速失败并安全响应,从而在配置出错时保障你的安全。
补丁工作原理
补丁逻辑很简单:当破坏或放置方块时,每个方块都会被标记。 这些信息会跨服务器重启持久保存。
在支付报酬时,如果 BREAK(破坏)、TNTBREAK(TNT 破坏)或 PLACE(放置)操作涉及活跃的“玩家”标签,则支付将被取消。 无论该玩家的作者是谁都无关紧要,因此如果一个玩家放置了方块而另一个玩家破坏了它,支付仍会被取消(从而修复双玩家漏洞利用)。
有两种主要行为,它们存在细微差别:
- 当方块被放置时,会为其附加一个标签:这对于修复 BREAK 和 TNTBREAK 操作很有用(例如,当破坏由玩家放置的钻石矿石时);
- 当方块被破坏时,会在其原位置附加一个标签:这对于修复 PLACE 操作很有用(例如,在短时间内反复替换之前被破坏的树苗)。
注意:第二种行为会导致“短暂”标签,即仅在一定短时间内适用的标签。该值固定为三秒。
最后,当活塞移动方块时,标签也会随之跟随(无论是短暂标签还是持久标签),从而修复活塞漏洞利用。
作为参考点,这种行为可能与 mcMMO 插件中实现的类似。
简单高效,即可解决问题。
Spigot 插件设置
此处假设你已经拥有一个已搭建好的 Spigot 服务器,并且上面已安装了 JobsReborn 插件。
服务器版本必须大于或等于 1.17.x。
从本仓库的发布页面下载最新的 .jar 文件,并将其放入 plugins/ 文件夹中,即可完成安装!重启服务器后,插件应在 /plugins 命令显示列表中呈现绿色状态。
如果你希望在较低版本的服务器上使用此插件,请使用以下版本:
在此阶段,你应该关闭 JobsReborn 中 "PlaceAndBreak" 配置部分的所有选项。 这将产生与以下结果类似的效果:
PlaceAndBreak:
# 启用方块保护,防止通过反复放置和破坏相同方块来利用矿石等方块。
# 修改 restrictedBlocks.yml 以选择你想要保护的方块
Enabled: false
# 是否使用新的方块保护方法
# 在大多数情况下,这是检查破坏/放置保护更高效的方案,不涉及任何缓存或将数据保存到数据库
# 仅适用于 1.14+ 服务器
NewMethod: false
BlockTracker:
# 是否使用 BlockTracker 插件替代内置的方块追踪器
Enabled: false
# 启用此选项后,我们将忽略由矿石生成器生成的方块,如石头、圆石和黑曜石。你仍然可以对玩家放置的黑曜石方块使用计时器
IgnoreOreGenerators: true
# 在数据库中保留方块保护数据的天数
# 这将清除冷却值为 -1 的方块数据
# 每次服务器启动时都会执行数据库清理
# 该值不能超过 14 天
KeepDataFor: 14
GlobalBlockTimer:
# 所有方块将在玩家放置后 X 秒内受到保护
Place:
Use: false
# 时间(秒)。这只能为正数,且不超过 900
# 如果需要更高的计时器,可以在 restrictedBlocks.yml 文件中为每个特定方块单独定义
Timer: 3
Break:
Use: false
# 时间(秒)。这只能为正数,且不超过 60
# 这仅是为了防止玩家将方块放置在相同位置并再次获得报酬
Timer: 3
# 启用精准采集保护。
# 启用此功能后,玩家使用精准采集工具破坏受限制方块列表中的方块时将不会获得报酬。
SilkTouchProtection: false
问题反馈
如果你发现任何错误或可疑行为,请毫不犹豫地通过“Discussion”板块或直接通过 GitHub Issues 板块 报告。我会尽最大努力尽快作出反应。
如何支持本项目?
如果你喜欢这个项目并希望支持我们,可以考虑在 GitHub 仓库 上给个 Star。 这将向我们展示你对本项目的兴趣,我们将对此表示感谢!
许可证
本项目采用 MIT 许可证。
JobsReborn-PatchPlaceBreak [Addon]
A place-and-break patch extension of JobsReborn.
Place-and-break issue
With JobsReborn, it appears that placing a block and then breaking it is counted as a valid job action which leads to a payment for the player. Given this fact, it's straightforward to imagine a diamond ore being gathered with a Silk Touch pickaxe and immediately after being replaced again so that the process can be repeated indefinitely...
A solution with JobsReborn is to remove money and xp when a diamond ore is placed, preventing the previously described scenario. But it isn't perfect: if you expect to use money and xp boost for whatever reason, the amount of money to give when the block is broken will be higher than the amount to be retrieved when placing the same one. And... well... losing money and xp when you place a block for decoration isn't very appreciated by players too.
In fact, the place-and-break patch provided by JobsReborn already provides a better solution. However, its main limitation comes from the maximum delay of 14 days before the protection is released. Furthermore, you must specify for each block a fix amount of time during which breaking the block again will not permit earning money and xp. Overall, that's a first step forward for sure, but we can/should go even further. That's here this plugin takes place.
Features
- Similar and performant patch-and-break protection than the one already provided by JobsReborn (including piston patch, pair-players exploit, resiliency to server restarts, etc) ;
- Unlimited in time protection, discouraging once for all any exploiter in your server ;
- More fine-grained customization of restricted blocks (the list of blocks to be protected can be inclusive or exclusive) in order to easily maximise the protection effectiveness while fine-tuning performances ;
- Easy and fast setup with SQLite as a default persistence solution for quick discovery and experimentation with this plugin (not recommended in production environment tho because of low performances) ;
- Possibility to rely on a MySQL or a MariaDB database (much better performances observed) ;
- We keep you safe in case of configuration mistake by detecting issues early with strict validation to ensure fail-fast and safe reaction from the plugin.
How the patch works
The patch is simple: when breaking or placing blocks, each one is tagged. This information is persisted across server restarts.
At payment time, if a BREAK, TNTBREAK or PLACE action involve an active "player" tag, the payment will be cancelled. It doesn't matter whose player is the author, so if one player places a block and another one breaks it, the payment will be cancelled anyway (patching pair-players exploit).
There are two main behaviors that have subtle differences:
- When a block is placed, a tag is attached to it: This is useful to patch BREAK and TNTBREAK actions (e.g. when breaking player-placed diamond ores) ;
- When a block is broken, a tag is attached to the location where it was: This is useful to patch PLACE actions (e.g. when replacing previously broken sapling repeatedly and in a brief time window).
Note: the second behavior leads to "ephemeral" tags, that's to say, a tag which will be applicable during a short-time only. The value is fixed to three seconds.
Finally, when a piston moves a block, the tag just follows it (being ephemeral or not), thus patching piston exploits.
As a comparison point, this behavior can have similarities with the one implemented by mcMMO plugin.
Easy and efficient, this does the trick.
Setup of the Spigot plugin
We expect here that you already have a Spigot server already set up with the JobsReborn plugin installed on it.
The server's version must be higher or equals to 1.17.x.
Download the latest .jar file from the
release section of this
repository and put it into the plugins/ folder, and you'll be done! After restarting the server,
the plugin should now appear green in the list displayed by the /plugins command.
If you wish to use this plugin on a lower version of the server, you should instead use the following version:
- 2.2.53 for Minecraft versions from 1.11 to 1.16 (included)
- 1.2.0 for Minecraft versions 1.8, 1.9 and 1.10
At this point, you should turn off all options of the "PlaceAndBreak" config part of JobsReborn. This would lead to a similar result as the following one:
PlaceAndBreak:
# Enable blocks protection, like ore, from exploiting by placing and destroying same block again and again.
# Modify restrictedBlocks.yml for blocks you want to protect
Enabled: false
# Should we use new block protection method
# In most cases this is more efficient way to check for break/place protection and doesn't involve any cache or data saving into database
# Only works with 1.14+ servers
NewMethod: false
BlockTracker:
# Should we use BlockTracker plugin instead of built in block tracker
Enabled: false
# Enabling this we will ignore blocks generated in ore generators, liko stone, coublestone and obsidian. You can still use timer on player placed obsidian block
IgnoreOreGenerators: true
# For how long in days to keep block protection data in data base
# This will clean block data which ones have -1 as cooldown value
# Data base cleanup will be performed on each server startup
# This cant be more then 14 days
KeepDataFor: 14
GlobalBlockTimer:
# All blocks will be protected X seconds after player places it
Place:
Use: false
# Time in seconds. This can only be positive number and no higher than 900
# If higher timers are needed then it can be defined in restrictedBlocks.yml file for each specific block
Timer: 3
Break:
Use: false
# Time in seconds. This can only be positive number and no higher than 60
# This is only to prevent player from placing blocks into same place and getting paid once more
Timer: 3
# Enable silk touch protection.
# With this enabled players wont get paid for broken blocks from restrictedblocks list with silk touch tool.
SilkTouchProtection: false
Issues
If you find any bug or suspicious behavior, please don't hesitate to report it through "Discussion" section or directly through GitHub Issues section. I will do my best to react as quickly as possible.
How to support the project?
If you appreciate the project and want to support us, then you can consider putting a star on the GitHub repository. This will show us your interest in the project, and we will be grateful for that!
Licence
This project is under the MIT license.
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 JobsReborn-PatchPlaceBreak
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
定期维护活动(依赖项更新和安全检查)
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
用于绘制游戏内地图或在浏览器中随探索实时进行地图绘制的实时地图。
评论 0
登录后参与评分
还没有评论,来抢沙发吧