Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sending multiple messages of notify-enter and notify-leave flag when joining from foreign worlds #4433

Merged

Conversation

Fameless9
Copy link
Contributor

Overview

Fixes #3424

Description

This PR combines the WorldChange and Teleport listeners. The teleport listener is triggered when a player changes worlds anyway, by combining them, plotEntry and plotExit are only called once when a player changes worlds and teleports at the same time, fixing the issue.

Before

messages-before.mp4

After

messages-after.mp4

Submitter Checklist

  • Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • Ensure that the pull request title represents the desired changelog entry.
  • New public fields and methods are annotated with @since TODO.
  • I read and followed the contribution guidelines.

@Fameless9 Fameless9 requested a review from a team as a code owner May 22, 2024 19:27
@github-actions github-actions bot added the Bugfix This PR fixes a bug label May 22, 2024
@PierreSchwang
Copy link
Member

I can't really review on my phone - but the thing I've noticed is, that the metadata mutation was deleted and not re-added, right?

@Fameless9
Copy link
Contributor Author

The teleport listener does the same thing as the world change listener. It removes both lastPlotAccess and lastLocationAccess. One thing I don't quite get is the PERMISSION_WORLDEDIT_BYPASS part. I haven't implemented this into the teleport listener as I don't really understand what it does. Please let me know and I'll add that to the listener if necessary.

@dordsor21
Copy link
Member

The teleport listener does the same thing as the world change listener. It removes both lastPlotAccess and lastLocationAccess. One thing I don't quite get is the PERMISSION_WORLDEDIT_BYPASS part. I haven't implemented this into the teleport listener as I don't really understand what it does. Please let me know and I'll add that to the listener if necessary.

Permissions can be per world so P2 needs to check that the player has WorkdEdit bypass permissions (or not) upon world change

@Fameless9
Copy link
Contributor Author

The teleport listener does the same thing as the world change listener. It removes both lastPlotAccess and lastLocationAccess. One thing I don't quite get is the PERMISSION_WORLDEDIT_BYPASS part. I haven't implemented this into the teleport listener as I don't really understand what it does. Please let me know and I'll add that to the listener if necessary.

Permissions can be per world so P2 needs to check that the player has WorkdEdit bypass permissions (or not) upon world change

Thanks a lot for clarifying. I'll add that back.

@@ -533,7 +533,9 @@ public void onTeleport(PlayerTeleportEvent event) {
// to is identical to the plot's home location, and untrusted-visit is true
// i.e. untrusted-visit can override deny-teleport
// this is acceptable, because otherwise it wouldn't make sense to have both flags set
if (!result && !(plot.getFlag(UntrustedVisitFlag.class) && plot
if (result) {
plotListener.plotEntry(pp, plot);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this only being added here? Do we not want to call plotEntry if deny teleport doesn't allow entry, but the untrusted visit flag does?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I have addressed this issue in the latest commit.

@NotMyFault NotMyFault requested a review from dordsor21 May 30, 2024 18:30
@dordsor21 dordsor21 requested a review from a team June 1, 2024 14:42
@NotMyFault NotMyFault changed the title Fixed #3424 by combining Teleport and WorldChange listeners Fix sending multiple messages of notify-enter and notify-leave flag when joining from foreign worlds Jun 16, 2024
@NotMyFault NotMyFault merged commit 67e69e3 into IntellectualSites:main Jun 16, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix This PR fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

notify-enter and notify-leave send three messages when teleporting to plot from different world
4 participants