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

Make KickPlayerEvent cancellable #2179

Merged
merged 6 commits into from
Sep 13, 2020
Merged

Conversation

ImMorpheus
Copy link
Contributor

Fix #2178

@ImMorpheus ImMorpheus added system: event api: 8 (u) version: 1.16 (unsupported since Oct 17th 2023) labels Jul 18, 2020
@Zidane
Copy link
Member

Zidane commented Jul 18, 2020

@ImMorpheus

This can target 7.

@ImMorpheus
Copy link
Contributor Author

The event is not implemented on stable-7.

@dualspiral
Copy link
Contributor

With regards to 7: #2178 (comment) - this needs to be thought about when it's done.

With regards to 8: remove the MessageChannelEvent implementation (or whatever the adventure equivalent is/will be). I do not see the use of having an audience attached to the method.

@ImMorpheus
Copy link
Contributor Author

ImMorpheus commented Aug 16, 2020

Done

EDIT: while it's true channels are not used we still use the message of MessageEvent.

@dualspiral
Copy link
Contributor

dualspiral commented Aug 22, 2020

while it's true channels are not used we still use the message of MessageEvent.

Add it on manually, don't keep an interface on if you don't use all of the elements of it.

@ImMorpheus
Copy link
Contributor Author

Add it on manually, don't keep an interface on if you don't use all of the elements of it.

They are two different events.

MessageChannelEvent != MessageEvent

KickPlayerEvent makes full use of the latter

@dualspiral
Copy link
Contributor

Also, while we're at it, make Player#kick return a boolean, because if a kick is cancelled, a comsumer of the event should be notified of it. This also needs an implementation update, so that needs doing in Common too.

@dualspiral
Copy link
Contributor

KickPlayerEvent makes full use of the latter

No it doesn't - these are not used.

@ImMorpheus
Copy link
Contributor Author

ImMorpheus commented Aug 22, 2020

No it doesn't - these are not used.

True, KickPlayerEvent#isMessageCancelled is not used but shouldn't it be ?

ServerSideConnectionEvent.Auth and ServerSideConnectionEvent.Login are the same (both are MessageEvent whose message refers to the "disconnect message").
If the message is cancelled then the default disconnect.disconnected message is used.
Why shouldn't the same apply to KickPlayerEvent ?

@dualspiral
Copy link
Contributor

If the message is cancelled then the default disconnect.disconnected message is used.

I'd rather that was ditched entirely - cancelling a message doesn't make sense in that scenario (all it's doing is basically using the original message instead). The message event should just be original/get/set if you ask me - then it's totally appropriate to put here.

@ImMorpheus
Copy link
Contributor Author

I'd rather that was ditched entirely - cancelling a message doesn't make sense in that scenario (all it's doing is basically using the original message instead)

Done

The message event should just be original/get/set if you ask me - then it's totally appropriate to put here.

Done and added a separate interface to mark the event as "message cancellable" (just like Event and Cancellable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: 8 (u) version: 1.16 (unsupported since Oct 17th 2023) system: event
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants