IntellectualSites / IntellectualSites/PlotSquared

Players can't use splash potions on themselves

Open
#2,997 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Approved Bug Enhancement Not a defect
Dominant language
Java
Stars
653
Forks
975
Avg merge
2m
Merged PRs (30d)
6

Description

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
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the self-targeted splash-potion case on PlotSquared 5.13.11, then inspect ProjectileEventListener.java at onPotionSplash and BukkitEntityUtil.java at entityDamage, as identified in the report. Compare the victim and attacker handling and verify that a player can use a potion on themselves without plots.admin.pvp.other, while the existing protection for other players remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.