Repository navigation
fix: apply the pve flag of a plot to attackers standing on the road - #4972
Open
TheMeinerLP wants to merge 1 commit into
Open
TheMeinerLP wants to merge 1 commit into
TheMeinerLP wants to merge 1 commit into
Conversation
A mob or other non-player attacker standing on the road could damage players and animals inside a plot whose pve flag is false, while the same attacker standing on a plot could not. The victim's plot now decides in both cases.
This file contains hidden or 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
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.
Overview
The
pveflag of a plot decides whether mobs and other non-player attackers may damage players and animals inside it. That only held for attackers standing on a plot. An attacker standing on the road next to the plot was not bound by the flag: withpveleft at its defaultfalse, it could still damage a player or an animal inside the plot, while the very same attacker standing on a plot could not.Checked in game on 7.6.1 with damage attributed to a wither, an ender dragon and a zombie placed over the road (
/damage ... by <mob>): a cow in the plot went from 10 to 7 health and a player from 20 to about 17, and the same attacker placed inside the plot was refused. It could not be shown with a naturally behaving mob: a real wither left the road within a second and a hovering dragon dealt no damage in the time observed. So this closes an inconsistency in the rule rather than a demonstrated griefing method.What changed
For attackers that are not players (and not projectiles fired by players), the
pveflag of the victim's plot now decides regardless of whether the attacker stands on a plot or on the road.Unchanged: attackers standing on a plot, attacker and victim both on the road (road flags decide as before), fireworks, plots with
pveset totrue, and everything about player attackers (pvp,animal-attack,hostile-attack,tamed-attack,misc-break,vehicle-break).The end of
BukkitEntityUtil#entityDamagemoved into a small class without Bukkit types,NonPlayerDamage, so the rule can be tested. Apart from the one changed line the previous order of checks is kept.Side effects
pveis off by default, nothing standing on the road damages players and animals inside a plot on a default setup any more, which is how it already worked inside plots.Tests
14 cases for the rule: attacker on the road and victim in a plot (with and without
pve, with the road flag set, arrows, fireworks), both in a plot, attacker in a plot and victim on the road, and both on the road. With the previous rule the two cases for a plot withoutpvefail.These are the first tests in the Bukkit module;
:plotsquared-bukkit:testruns them without changes to the build files.Not covered
entityDamageitself, i.e. how locations, flags and entity types are turned into the inputs of the rule.pveroad flag is set. A test records that as current behaviour.