Skip to content

PlayerTeleportEvent#getCause is UNKNOWN for some commands #2789

@Techirion

Description

@Techirion

Expected behavior

TeleportCause.UNKNOWN is usually reserved for stuff like anticheat plugins. Plugins that update "back" location like essentials or custom implementations would skip it.

I think it would be better if its replaced by TeleportCause.PLUGIN or TeleportCause.PLUGIN and TeleportCause.COMMAND when appropriate.

Observed/Actual behavior

PlayerTeleportEvent#getCause is UNKNOWN for commands like /is (tp to island home)

public CompletableFuture<Boolean> homeTeleportAsync(@NonNull World world, @NonNull Player player) {

https://github.com/BentoBoxWorld/BentoBox/blob/develop/src/main/java/world/bentobox/bentobox/util/Util.java#L405

Not sure if this is intended for some reason?

Steps/models to reproduce

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onPlayerTeleportEvent(PlayerTeleportEvent event) {
        Bukkit.getLogger().info(event.getCause().name());
    }

The doing /is

or installing BSkyblock + Essential and doing /is then checking if Essentials /back teleports to previous location.

BentoBox version

> bbox ver
[19:07:50 INFO]: Running PAPER 1.21.10.
[19:07:50 INFO]: (1.21.10-129-3e25649 (MC: 1.21.10))
[19:07:50 INFO]: BentoBox version: 3.11.1
[19:07:50 INFO]: Database: JSON
[19:07:50 INFO]: Loaded Game Worlds:
[19:07:50 INFO]: bskyblock_world (BSkyBlock): Overworld, Nether, The End
[19:07:50 INFO]: Loaded Addons:
[19:07:50 INFO]: AutoIslandPurge 1.1.0-SNAPSHOT (ENABLED)
[19:07:50 INFO]: Bank 1.9.0-SNAPSHOT-b118 (ENABLED)
[19:07:50 INFO]: Biomes 2.2.1-SNAPSHOT-b306 (ENABLED)
[19:07:50 INFO]: Border 4.6.0-SNAPSHOT-b256 (ENABLED)
[19:07:50 INFO]: BSkyBlock 1.19.1 (ENABLED)
[19:07:50 INFO]: Challenges 1.5.2 (ENABLED)
[19:07:50 INFO]: CheckMeOut 1.2.0 (ENABLED)
[19:07:50 INFO]: ControlPanel 1.15.0-SNAPSHOT-b91 (ENABLED)
[19:07:50 INFO]: DimensionalTrees 1.8.0 (ENABLED)
[19:07:50 INFO]: ExtraMobs 1.14.0 (ENABLED)
[19:07:50 INFO]: FarmersDance 1.2.2-SNAPSHOT (ENABLED)
[19:07:50 INFO]: IslandFly 1.14.2 (ENABLED)
[19:07:50 INFO]: Level 2.23.0-SNAPSHOT-b677 (ENABLED)
[19:07:50 INFO]: Likes 2.5.0-SNAPSHOT-b129 (ENABLED)
[19:07:50 INFO]: Limits 1.27.1 (ENABLED)
[19:07:50 INFO]: MagicCobblestoneGenerator 2.7.2-SNAPSHOT-b316 (ENABLED)
[19:07:50 INFO]: Visit 1.7.0 (ENABLED)
[19:07:50 INFO]: Warps 1.17.0-SNAPSHOT-b393 (ENABLED)

Plugin list

pl
[19:08:00 INFO]: ℹ Server Plugins (41):
[19:08:00 INFO]: Bukkit Plugins:
[19:08:00 INFO]: - AdditionalFeatures, AuctionHouse, AxSmithing, BentoBox, BentoBox-Bank, BentoBox-Biomes, BentoBox-Border, BentoBox-BSkyBlock, BentoBox-Challenges, BentoBox-CheckMeOut
[19:08:00 INFO]: BentoBox-FarmersDance, BentoBox-IslandFly, BentoBox-Level, BentoBox-Likes, BentoBox-Limits, BentoBox-MagicCobblestoneGenerator, BentoBox-Visit, BentoBox-Warps, BentoBoxPlus, Citizens
[19:08:00 INFO]: Crates, DecentHolograms, FastAsyncWorldEdit, FreedomChat, GrimAC, GSit, LockettePro, LogBlock, mcMMO, NoCheatEnforcer
[19:08:00 INFO]: ServerManager, ShopManager, SimplePets, SimpleTrading, UserManager, Vault, ViaBackwards, ViaRewind, ViaRewind-Legacy-Support, ViaVersion
[19:08:00 INFO]: WorldGuard

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: APIrelating to the BentoBox APIType: EnhancementImprovement or modification which is usually a new feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions