Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Optional Offline Protect Only Mode and more #330

Open
wants to merge 5 commits into
base: 1.19/dev
Choose a base branch
from

Conversation

1whohears
Copy link

@1whohears 1whohears commented Nov 13, 2024

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 the protect_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 same PrivacyProperty and I didn't see how FTBChunksTeamData#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 and disable_protection = false enemy players will ONLY be able to damage your claimed chunks if you or your team mates are online.
offline_protection_buffer: If offline_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: If disable_protection = false, this many blocks can still be destroyed per hour be enemy players. 0 disables this.
destroy_blocks_count_period: If max_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 the living_entity_attack_blacklist tag when all team members are offline.

New Tags:
edit_blacklist: (Blocks) prevent enemy players from breaking these blocks even if max_destroy_blocks_per_hour > 0
living_entity_attack_blacklist: (EntityTypes) prevent enemy players from attacking these entities. this is very useful when paired with protect_entities_offline_only to stop offline villager raids for example.

… protection mode, max destroy blocks rate, living entity attack blacklist tag, and more
…ck list after it is known that the player doesn't own those chunks.
@CLAassistant
Copy link

CLAassistant commented Nov 13, 2024

CLA assistant check
All committers have signed the CLA.

… a PR to the create mod so that the drills will always fire the block break event. drills do not have an "owner" so the block break player will be null. however without this commit, FTB would still allow drills to break the block because the block break event is not canceled when the player is null.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants