PluginBugs / Issues-CosmeticsCore

Repository used to keep track of issues of my plugin CosmeticsCore
https://lonedev.gitbook.io/cosmeticscore/
0 stars 0 forks source link

Compatibility with some teleport plugins #68

Closed Athamex closed 1 year ago

Athamex commented 1 year ago

Terms

Discord tag (optional)

Athame#4912

What happened?

If I type /t spawn while in the wardrobe, I become invisible.

Steps to reproduce the issue

Just bug

Server version

1.17.1

CosmeticsCore Version

1.0.5

ProtocolLib Version

4.8.0

LoneLibs Version

1.0.21

FULL server log

No response

Error (optional)

No response

CosmeticsCore config.yml

No response

Problematic items yml configuration file (optional)

No response

Other files, you can drag and drop them here to upload. (optional)

No response

Screenshots/Videos (you can drag and drop files or paste links)

No response

LoneDev6 commented 1 year ago

Probably your teleport plugin doesn't trigger the teleport event for some reason.

Athamex commented 1 year ago

I use towny plugin for /t spawn

LoneDev6 commented 1 year ago

Can you try other teleport commands to see if the bug happens anyway?

Athamex commented 1 year ago

I try /spawn with essentials no problem

LlmDl commented 1 year ago

Towny's /t spawn command is ran with a TeleportCause.COMMAND, what is your teleport listener listening for @LoneDev6 ?

Athamex commented 1 year ago

Also /n spawn is invisibility bug. I have a video https://clipchamp.com/watch/kxPtNokkvN0

LoneDev6 commented 1 year ago

Towny's /t spawn command is ran with a TeleportCause.COMMAND, what is your teleport listener listening for @LoneDev6 ?

Thanks for the info, I'll try to see if this could be the cause and keep you updated about my tests.

LoneDev6 commented 1 year ago

Towny's /t spawn command is ran with a TeleportCause.COMMAND, what is your teleport listener listening for @LoneDev6 ?

    @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
    private void onPlayerTeleport(PlayerTeleportEvent e)

I only check this and cancel if true.

e.getCause() == PlayerTeleportEvent.TeleportCause.PLUGIN

Towny source: https://github.com/TownyAdvanced/Towny/blob/f28711bd79bb016e77fa408bb21320dcdc4c1591/src/com/palmergames/bukkit/towny/command/TownCommand.java#L2973

https://github.com/TownyAdvanced/Towny/blob/f28711bd79bb016e77fa408bb21320dcdc4c1591/src/com/palmergames/bukkit/towny/utils/SpawnUtil.java#L64

https://github.com/TownyAdvanced/Towny/blob/f28711bd79bb016e77fa408bb21320dcdc4c1591/src/com/palmergames/bukkit/towny/utils/SpawnUtil.java#L570

https://github.com/TownyAdvanced/Towny/blob/f28711bd79bb016e77fa408bb21320dcdc4c1591/src/com/palmergames/bukkit/towny/utils/SpawnUtil.java#L579

PaperLib.teleportAsync(player, spawnLoc, TeleportCause.COMMAND); https://github.com/PaperMC/PaperLib/blob/0621f6d90002bd7d873bc7a1b65b281e685d7063/src/main/java/io/papermc/lib/features/asyncteleport/AsyncTeleportPaper_13.java

It should actually trigger I think onPlayerTeleport. I have no idea why this doesn't work.

LlmDl commented 1 year ago

I would consider using PLUGIN and COMMAND causes for your setup. Some plugins use PLUGIN, some use COMMAND, some use both (like Towny.) Since you're wanting to track teleports I would listen to both.

LoneDev6 commented 1 year ago

I only check this and cancel if true.

I already do that

LlmDl commented 1 year ago

You are checking if the TeleportCause is PLUGIN, but are you also checking if e.getCause() == PlayerTeleportEvent.TeleportCause.COMMAND ?

LoneDev6 commented 1 year ago

It might be fixed in the upcoming update, please let me know as soon as I release the update.