-
Notifications
You must be signed in to change notification settings - Fork 56
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
1whohears
wants to merge
8
commits into
FTBTeam:1.19/dev
Choose a base branch
from
1whohears:1.19/dev
base: 1.19/dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… 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.
… 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.
…ing to try to assign owner players to all of the contraptioins that can break blocks in create. but thankfully I came up with a much simpler solution. create machines are only breaking blocks in force loaded chunks on servers anyway. this option then prevents enemy tunnel bores from getting into a base because friendly force loaded chunks should be surrounded by regular claimed chunks that act as a protective buffer. a version of create that fires the block break event with a null player is still required, but only on the server side...but of course this all assumes all mods have a null check in their block break listeners...
… same "allow if in force loaded chunk" logic. this is the messiest code logic to date. I will fix it later.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.