Skip to content

Conversation

@nopeless
Copy link
Contributor

@nopeless nopeless commented Mar 1, 2025

Description

Implement kick message getting and setting


Target Minecraft Versions: Not known yet

Related Issues:

https://discord.com/channels/135877399391764480/1332620961328926790

@nopeless nopeless changed the title Add kick message expr [WIP] Add kick message expr Mar 1, 2025
@Aresiel
Copy link

Aresiel commented Mar 1, 2025

OMG I literally had this issue today and this PR was made like the second I found it. What are the odds.

@nopeless
Copy link
Contributor Author

nopeless commented Mar 1, 2025

Annotations need proper skript version needs to be updated, hence the WIP

@Burbulinis
Copy link
Contributor

This PR should target dev/feature, not master

@Fusezion

This comment was marked as resolved.

@sovdeeth
Copy link
Member

sovdeeth commented Mar 1, 2025

Annotations need proper skript version needs to be updated, hence the WIP

Any additions should use INSERT VERSION as a placeholder. It's automatically replaced during release

@RequiredPlugins("xxx Paper 1.16.5+")
@Since("xxx 2.8.0")
@Events("Kick")
public class ExprKickMessage extends SimpleExpression<String> {
Copy link
Member

@sovdeeth sovdeeth Mar 1, 2025

Choose a reason for hiding this comment

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

This class needs to follow the proper code conventions re: method order, using finals in parameters, annotation placement.
But more importantly, this should probably be part of ExprMessage itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

working on the method order;

I don't think it should be part of ExprMessage, its not really a message that appears in chat. The reason why I named it ExprKickMessage is because kick reason was already taken

Copy link
Member

Choose a reason for hiding this comment

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

there's no ExprKickReason, though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

... good point, but then the class name would be ExprKickReason while the actual pattern is kick message and I thought that was worse

Copy link
Member

Choose a reason for hiding this comment

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

Why would the pattern stay as kick message? shouldn't it be kick reason too?

@nopeless nopeless changed the base branch from master to dev/feature March 1, 2025 17:59
@nopeless
Copy link
Contributor Author

nopeless commented Mar 1, 2025

This should already be possible via ExprMessage

QUIT("quit", "(quit|leave|log[ ]out|kick)( |-)message", PlayerQuitEvent.class, PlayerKickEvent.class) {
@Override
@Nullable
String get(final Event e) {
if (e instanceof PlayerKickEvent)
return ((PlayerKickEvent) e).getLeaveMessage();
else
return ((PlayerQuitEvent) e).getQuitMessage();
}
@Override
void set(final Event e, final String message) {
if (e instanceof PlayerKickEvent)
((PlayerKickEvent) e).setLeaveMessage(message);
else
((PlayerQuitEvent) e).setQuitMessage(message);
}
},

@Fusezion
This turns out to set the message in the chat not the kick message itself, hence the change

@Fusezion
Copy link
Contributor

Fusezion commented Mar 1, 2025

@Fusezion This turns out to set the message in the chat not the kick message itself, hence the change

Hmm, alright.

@nopeless
Copy link
Contributor Author

nopeless commented Mar 1, 2025

@sovdeeth If you have a class name recommendation let me know because its very ambiguous overall

Copy link
Contributor

@Absolutionism Absolutionism left a comment

Choose a reason for hiding this comment

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

I know Sovde already mentioned about the coding conventions, so I won't do anything related to that.

@ShaneBeee
Copy link
Contributor

In my opinion, rather than creating another expression, this should probably just be merged in with:
https://docs.skriptlang.org/expressions.html?search=#ExprMessage

nopeless and others added 2 commits March 2, 2025 01:57
Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com>
Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com>
@Fusezion
Copy link
Contributor

Fusezion commented Mar 3, 2025

@Efnilite I'm guessing that the expression pattern is final? (I don't know if you have discussed with others)

Just providing my two cents, I would prefer going with Efy's changes here as that not only fixes conflictions but is descriptive enough that players can tell the difference between this and it's counter part

@Efnilite
Copy link
Member

Efnilite commented Mar 3, 2025

@Efnilite I'm guessing that the expression pattern is final? (I don't know if you have discussed with others)

if you have better suggestions feel free to use them, we just need to make sure its different

@nopeless
Copy link
Contributor Author

nopeless commented Mar 4, 2025

I'll leave this open for a bit just in case someone wants to pitch in. personally I don't care what the pattern is as long as its usable

@sovdeeth sovdeeth removed their request for review March 21, 2025 02:12
@sovdeeth
Copy link
Member

you can re-request me once requested changes are addressed

@nopeless nopeless requested a review from a team as a code owner March 25, 2025 16:47
@nopeless nopeless requested review from Pikachu920 and erenkarakal and removed request for a team March 25, 2025 16:47
@nopeless
Copy link
Contributor Author

few notes: I renamed file to ExprOnScreenKickMessage so it is not ambiguous at all. Updated example and also set the pattern to just a single literal.

@nopeless nopeless requested a review from sovdeeth March 25, 2025 16:48
@nopeless nopeless requested a review from erenkarakal April 3, 2025 17:27
@erenkarakal erenkarakal added the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Apr 5, 2025
nopeless and others added 2 commits April 9, 2025 01:12
…ge.java

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
…ge.java

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
@nopeless nopeless changed the title [WIP] Add kick message expr [WIP] Add on screen kick message expr Apr 8, 2025
@nopeless nopeless requested a review from Absolutionism April 13, 2025 21:35
@sovdeeth sovdeeth merged commit aca9405 into SkriptLang:dev/feature Apr 16, 2025
5 checks passed
sovdeeth added a commit that referenced this pull request Apr 24, 2025
* Initial Commit

* Fix Elements

* Fix Entity Spawning

* Update EntityData.java

* Skip `-` prefix variable names when saving. (Ephemeral variables) (#7495)

* Skip minus sign names when saving.

* Remove minus sign from tokens list instead.

* move check to before serialization

---------

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>

* [WIP] Add on screen kick message expr (#7658)

* Add kick message expr

* Add proper placeholder for version

* Code clean up

* Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java

Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>

* We only support 1.19.4+

* use deprecated api

* resolve suggestions

* mark method as nullable

* remove minimessage entirely

* Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java

Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com>

* Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java

Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com>

* Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java

Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com>

* Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java

Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com>

* shorter import

* implement EventRestrictedSyntax

* Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java

Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>

* apply changes

* implement suggestions

* Update src/main/java/ch/njol/skript/expressions/ExprOnScreenKickMessage.java

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>

* Update src/main/java/ch/njol/skript/expressions/ExprOnScreenKickMessage.java

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>

* ExprTool - Cleanup & Additional Test (#7710)

* ExprTool.java - add mainhand and offhand

* ExprTool.sk - Add basic testing

* ExprTool.sk - new line

* Apply suggestions from code review

Add initial suggestions

Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>

* ExprTool.java - Change toString to SSB

* Remove support for only "offhand" and "mainhand"

* Move patterns back into the method

* Update src/main/java/ch/njol/skript/expressions/ExprTool.java

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>

* Move equipment slot map to BukkitUtils

* Requested changes

* Update to a BiMap for equipmentslot

* Update src/main/java/ch/njol/skript/bukkitutil/BukkitUtils.java

Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>

* Changes

* Remove Feature Changes

* Requested Changes

* Update EntityUtils.java

* Requested Changes

---------

Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com>
Co-authored-by: Moderocky <admin@moderocky.com>
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
Co-authored-by: nopeless <38830903+nopeless@users.noreply.github.com>
Co-authored-by: Fusezion <fusezionstream@gmail.com>
Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
@sovdeeth sovdeeth moved this to Done in 2.12 Releases May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version.

Projects

Status: Done - Released

Development

Successfully merging this pull request may close these issues.

9 participants