Added Optional Offline Protect Only Mode and more #330
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I would like to be able to disable block protection on my server, but moderating against offline raids is very annoying. The following features can disable chunk protection only when the team is online and able to defend their base.
I also added
max_destroy_blocks_per_hour
which is meant to prevent players from completely destroying someone else's base in one sitting. I am not sure what the magic number should be, but the idea is that this feature can satisfy some players destructive desires, and also not completely undo a builder's hours of work. This setting should also nerf the strat where people just hide underground and fill in all the holes and never interact with the rest of the server (Ashley if you are reading this, yes this is my call out post on twitter dot com).I also added the
living_entity_attack_blacklist
tag in case server owners wanted to protect specific living entities. Entities in this tag are protected similar to tnt protection. If the source is unknown, the entity takes no damage. I saw a comment where it was intentionally decided to not protect living entities at all. The code that protects non living entities (paintings, item frames) is left intact. But I feel it should at least be an option and leave it up to the server owner for living entities. I still want wars to be fought over valuable entities like villagers, but I don't want offline villager raids to happen. This is why I added theprotect_entities_offline_only
setting.I tried to implement these features in the least destructive way I could come up with. But stuff like the destroy block counter required some new
Protection
nodes to be added and other changes because before; placing, left clicking on, and breaking blocks were all considered the samePrivacyProperty
and I didn't see howFTBChunksTeamData#canUse
could know if a block was being broken otherwise. If y'all don't like something that's what code review is for.I've testing everything in local multiplayer (--username=Dev2) and it works.
Also I made these changes in the 1.19 branch cause I will be running a small 1.19.2 server. I am not as familiar with mod dev in other versions.
New Configs:
offline_protection_only
: If enabled anddisable_protection
=false
enemy players will ONLY be able to damage your claimed chunks if you or your team mates are online.offline_protection_buffer
: Ifoffline_protection_only
=true
, the time in SECONDS after all members of a team log off, before chunk protection turns on. This setting is meant to discourage combat logging. Set to 0 to disable.max_destroy_blocks_per_hour
: Ifdisable_protection
=false
, this many blocks can still be destroyed per hour be enemy players. 0 disables this.destroy_blocks_count_period
: Ifmax_destroy_blocks_per_hour
> 0, the groups of time in seconds where the number of blocks broken are counted. Groups younger than an hour contribute to the total blocks broken. Groups older than an hour are removed.protect_entities_offline_only
: Only protect the entities listed in theliving_entity_attack_blacklist
tag when all team members are offline.New Tags:
edit_blacklist
: (Blocks) prevent enemy players from breaking these blocks even ifmax_destroy_blocks_per_hour
> 0living_entity_attack_blacklist
: (EntityTypes) prevent enemy players from attacking these entities. this is very useful when paired withprotect_entities_offline_only
to stop offline villager raids for example.