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 new events that allow for better API usage #3

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

Conversation

Golfing7
Copy link

Adds some new events and improves the event API

@SirSalad SirSalad self-requested a review April 20, 2024 21:47
import org.jetbrains.annotations.NotNull;

/**
* Called when a town has been created by a player.
Copy link
Member

Choose a reason for hiding this comment

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

"is about to be created" or similar

public class TownCreateEvent extends TownPlayerEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();

private boolean cancelled;
Copy link
Member

Choose a reason for hiding this comment

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

Use lombok

import org.jetbrains.annotations.NotNull;

/**
* Called when a town has been disbanded by a player.
Copy link
Member

Choose a reason for hiding this comment

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

"is about to be" or similar


/** The player disbanding the town */
private final Player player;
private boolean cancelled;
Copy link
Member

Choose a reason for hiding this comment

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

Use lombok

* Abstract event class for all town related events
*/
public abstract class TownEvent extends Event {
private final Town town;
Copy link
Member

Choose a reason for hiding this comment

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

Use lombok

import org.jetbrains.annotations.NotNull;

/**
* Called when a player left a town.
Copy link
Member

Choose a reason for hiding this comment

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

"is about to leave" or similar

import org.jetbrains.annotations.NotNull;

/**
* Called when a player has joined a town.
Copy link
Member

Choose a reason for hiding this comment

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

"is about to join" or similar

* If you cancel the event in this case, nothing happens.
* </p>
*/
public class TownPlayerJoinEvent extends TownPlayerEvent implements Cancellable {
Copy link
Member

Choose a reason for hiding this comment

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

This should also be fired on com.oxywire.oxytowns.command.commands.admin.town.TownAddPlayerCommand

/**
* Called when a town has been disbanded by a player.
*/
public class TownDisbandEvent extends TownPlayerEvent implements Cancellable {
Copy link
Member

Choose a reason for hiding this comment

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

This should also be fired on com.oxywire.oxytowns.command.commands.admin.town.TownDisbandCommand

public class TownDisbandEvent extends TownPlayerEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();

/** The player disbanding the town */
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this context? Towns will only ever be naturally disbanded by the mayor or a server admin

@Golfing7
Copy link
Author

Made the adjustments. Thanks for the feedback. I apologize for the long wait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants