PlotSquared icon indicating copy to clipboard operation
PlotSquared copied to clipboard

Players can't use splash potions on themselves

Open mindw0rm opened this issue 4 years ago • 1 comments

Server Implementation

Paper

Server Version

1.16.5

Describe the bug

When players use a splash potion on themselves while on a plot, they don't get any effect, instead the message '[P2] You are lacking the permission node: plots.admin.pvp.other' is shown. This is on the player's own plot, on plots without permission, unowned plots or the roads, the potion can't be thrown at all (which might be an issue in itself, alt least if the potion is non-offensive, but that's up to debate and not the issue here ;) ).

To Reproduce

  1. Join with a player without the permission plots.admin.pvp.other (i.e. most non-op players)
  2. go to your plot
  3. throw a splash potion on yourself (bug discovered and tested with night vision on a creative server, but should happen with any splash potion)

Expected behaviour

The expected behaviour would be that players can use potions on themselves, at least on their own plot (or other plots where they have sufficient rights). I would even expect that non-offensive potions (e.g. healing) could be used on others, and offensive ones as well if PVP is enabled.

Screenshots / Videos

No response

Error log (if applicable)

No response

Plot Debugpaste

https://athion.net/ISPaster/paste/view/e977283e37424370b56dbe984d782e0a

PlotSquared Version

5.13.10-premium and 5.13.11

Checklist

  • [X] I have included a Plot debugpaste.
  • [X] I am using the newest build from https://www.spigotmc.org/resources/77506/ and the issue still persists.

Anything else?

This is a migration of https://issues.intellectualsites.com/issue/PS-233, as requested. I have not tested it again with the current 5.13.11-premium but the bug was still present in 5.13.11 at the time of the original bug report.

The issue was first detected on our real server, which runs PlotSquared 5.13.10-premium (see debugpaste above). Can also be replicated on a server with only PlotSquared (and Worldedit). Debugpaste: https://athion.net/ISPaster/paste/view/c94b64bd7f404120bae9eefcbfd8b27a

The final tests (and the debug paste) were done on my local computer, using the current github version and stripped of all unneccessary plugins to make sure that this really is a PlotSquared issue. I analyzed this with a debugger, and for me the problem is either in ProjectileEventListener.onPotionSplash (https://github.com/IntellectualSites/PlotSquared/blob/v5/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java#L77) or BukkitEntityUtil.entityDamage (https://github.com/IntellectualSites/PlotSquared/blob/v5/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java#L245), who both do not check if the victim and the attacker are different players.

mindw0rm avatar Apr 27 '21 15:04 mindw0rm

I just tested it with 5.13.11-premium, the issue is still present.

mindw0rm avatar Apr 28 '21 19:04 mindw0rm