Skip to content

getTeleporter() returns wrong player for /tphere #4673

@BloodEko

Description

@BloodEko

Type of bug

Compatibility issue

/ess dump all output

https://essentialsx.net/dump.html?id=a9195a029a124921a836af060711c239

Error log (if applicable)

No response

Bug description

When running /tphere on a player the TeleportWarmupEvent will have getTeleporter() and getTeleportee() returning the same, teleported player, instead of different players.

https://github.com/EssentialsX/Essentials/blob/2.x/Essentials/src/main/java/net/ess3/api/events/teleport/TeleportEvent.java#L31
The problem seems to be caused by the shorthand constructor, which doesn't distinguish the fields.
So there might be more commands affected, which should be checked.

Steps to reproduce

  1. Have a least 2 people online.
  2. Teleport the other player via /tphere
  3. Via the output for the code below.
@EventHandler
public void onWarmup(TeleportWarmupEvent event) {
    System.out.println("Teleporter: " + event.getTeleporter());
    System.out.println("Teleportee: " + event.getTeleportee());
}

Expected behaviour

For the event getTeleporter() should return the caller of the command.

Actual behaviour

For the event getTeleporter() returns the target of the command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: confirmedConfirmed bugs in EssentialsX.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions