Skip to content

Consider alternative solution for #864 #945

@SirSalad

Description

@SirSalad

Confirmation

  • My issue isn't already found on the Issue tracker.
  • My issue is about PlaceholderAPI and not any expansion or external plugin
  • The issue isn't already fixed in a Spigot Release or Development Build.
  • The Common Issues page doesn't mention this issue.

Type

Plugin Bug

What happens?

Reloading a plugin that provides an expansion through ServerUtils fails due to PAPI refusing to load an expansion when one with the same identifier is already registered. Prior to 2.11.3 release, specifically #866, this worked.

Expected Behaviour

Ideally, both this behavior is retained, and #864 is resolved

How to Reproduce

  1. Load a server with ServerUtils, PlaceholderAPI (2.11.3), and a plugin that provides a PlaceholderExpansion
  2. /su rp <that plugin>

/papi dump Output

N/A (Paper 1.19.2, PlaceholderAPI 2.11.3)

Console Log

N/A

Errors

[21:54:57 WARN]: [PlaceholderAPI] Failed to load expansion <that plugin's expansion's identifier>. Identifier is already in use.

Additional Info

After 2.11.3 release, specifically #866, we started experiencing issues with reloading (through ServerUtils) plugins that provide an expansion. It's understood that reloading plugins at runtime is generally unsafe and not supported, but before this PR was merged, it was possible to reload plugins without issues from PAPI. As said above, ideally both this behavior is retained and #864 is resolved.

I'm not sure I understand the true issue in #864. My understanding is: PlaceholderAPI may attempt to register an expansion twice, but because expansions are backed by a map with their identifier as the key, it'll keep and reference the latest one. For this issue, this is ideal behavior.

There are a few possible solutions I have in mind:

  • Warn the user that an expansion is being registered and overriding the already loaded one
  • All plugins unregister their own expansions (while already possible, I believe it is not suggested in PAPI'S docs)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions