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

Add PlayerPlotChatEvent #3735

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jaapieaapie1
Copy link

@jaapieaapie1 jaapieaapie1 commented Jul 22, 2022

Description

This pull request adds a new event that will be called after a player chats in plot chat.

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.

@jaapieaapie1 jaapieaapie1 requested a review from a team as a code owner July 22, 2022 07:43
@github-actions github-actions bot added the Feature This PR proposes a new feature label Jul 22, 2022
@PierreSchwang
Copy link
Member

Looks good so far - Would be great to implement the CancellablePlotEvent as well. Therefor plugins using that event are able to force / cancel plot messages on their own, if that event already exist.

Comment on lines +246 to +248
/**
* @since TODO
*/
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/**
* @since TODO
*/

This is an internal class.

import java.util.Set;

/**
* @since TODO
Copy link
Member

Choose a reason for hiding this comment

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

Please add since todo to the added methods too.

@NotMyFault NotMyFault added the Developer Note worth changes for API users label Jul 22, 2022
*
* @return Set of PlotPlayer
*/
public Set<PlotPlayer<?>> getRecipients() {
Copy link
Member

Choose a reason for hiding this comment

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

It should be documented that

  • the returned set can be modified
  • the changes apply to who receives the message

Also, the PlotPlayer should be at least marked as non-null here, as putting a null value into the set will throw an exception later.
Same applies for getSpies(), and it's probably also worth to think about what should happen if a player is in both sets.


boolean force = plotChatEvent.getEventResult() == Result.FORCE;

if (force || (plot.isDenied(plotPlayer.getUUID()) && !Permissions
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be !force, as the plot chat should happen if the result is FORCE

public class PlayerPlotChatEvent extends PlotEvent implements CancellablePlotEvent {

private final PlotPlayer<?> player;
private final String message;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe rather use an adventure component for the message?
The passed message as a string is before the translation of color codes etc happened. Would be more suitable to use the component which is used as the "msg" placeholder.

@NotMyFault
Copy link
Member

@jaapieaapie1 Would you like to address the feedback?

@github-actions
Copy link

Please take a moment and address the merge conflicts of your pull request. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Note worth changes for API users Feature This PR proposes a new feature unresolved-merge-conflict
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants