-
-
Notifications
You must be signed in to change notification settings - Fork 392
Add an AvailableEvent(s) annotation #7668
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
base: dev/feature
Are you sure you want to change the base?
Conversation
* Adds ParsingStack data type * Add ParseStackOverflowException * Store ParsingStack in ParserInstance * Implement the parsing stack in SkriptParser Document SkriptParser#parse_i a bit better * Improve robustness of ParsingStack Add more operations to ParsingStack * Add usage note to ParsingStack * Add modification notice to ParserInstance#getParsingStack * Switch from Stack class to LinkedList class Add notice on iteration order * Change brackets of ignored catch block Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> * Review response, slight documentation changes, variable rename, formatting changes * Update src/main/java/ch/njol/skript/lang/parser/ParsingStack.java Co-authored-by: Kiip <25848425+kiip1@users.noreply.github.com> * Add `@param` tags to method Javadocs for completeness sake Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com> * Forgot import because of GH suggested change commit * Fix newer merge changes. --------- Co-authored-by: TPGamesNL <pet.teun.03@gmail.com> Co-authored-by: TPGamesNL <29547183+TPGamesNL@users.noreply.github.com> Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> Co-authored-by: Kiip <25848425+kiip1@users.noreply.github.com> Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
* init commit * optimize imports * replace try/catches with isValidUUID method, final changes * Final changes * tiny change * Tests and changes * fix test * Add a uuid function and final changes * Remove the AnyValued for UUIDs and tests for parsing uuids * Change throwing an exception to asserting false when deserializing * Clean up --------- Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
# Conflicts: # src/main/java/ch/njol/skript/doc/AvailableEvents.java # src/main/java/ch/njol/skript/expressions/ExprAbsorbedBlocks.java # src/main/java/ch/njol/skript/expressions/ExprAppliedEffect.java # src/main/java/ch/njol/skript/expressions/ExprAppliedEnchantments.java # src/main/java/ch/njol/skript/expressions/ExprAttacked.java # src/main/java/ch/njol/skript/expressions/ExprAttacker.java # src/main/java/ch/njol/skript/expressions/ExprBeaconValues.java # src/main/java/ch/njol/skript/expressions/ExprClicked.java # src/main/java/ch/njol/skript/expressions/ExprCommand.java # src/main/java/ch/njol/skript/expressions/ExprCommandSender.java # src/main/java/ch/njol/skript/expressions/ExprDamage.java # src/main/java/ch/njol/skript/expressions/ExprEgg.java # src/main/java/ch/njol/skript/expressions/ExprEnchantItem.java # src/main/java/ch/njol/skript/expressions/ExprEnchantingExpCost.java # src/main/java/ch/njol/skript/expressions/ExprEnchantmentBonus.java # src/main/java/ch/njol/skript/expressions/ExprEnchantmentOffer.java # src/main/java/ch/njol/skript/expressions/ExprEvtInitiator.java # src/main/java/ch/njol/skript/expressions/ExprExperience.java # src/main/java/ch/njol/skript/expressions/ExprExplodedBlocks.java # src/main/java/ch/njol/skript/expressions/ExprExplosionBlockYield.java # src/main/java/ch/njol/skript/expressions/ExprExplosionYield.java # src/main/java/ch/njol/skript/expressions/ExprFertilizedBlocks.java # src/main/java/ch/njol/skript/expressions/ExprFinalDamage.java # src/main/java/ch/njol/skript/expressions/ExprHatchingNumber.java # src/main/java/ch/njol/skript/expressions/ExprHatchingType.java # src/main/java/ch/njol/skript/expressions/ExprHealAmount.java # src/main/java/ch/njol/skript/expressions/ExprHealReason.java # src/main/java/ch/njol/skript/expressions/ExprHealth.java # src/main/java/ch/njol/skript/expressions/ExprHoverList.java # src/main/java/ch/njol/skript/expressions/ExprInventoryCloseReason.java # src/main/java/ch/njol/skript/expressions/ExprLevel.java # src/main/java/ch/njol/skript/expressions/ExprLevelProgress.java # src/main/java/ch/njol/skript/expressions/ExprMe.java # src/main/java/ch/njol/skript/expressions/ExprMessage.java # src/main/java/ch/njol/skript/expressions/ExprProtocolVersion.java # src/main/java/ch/njol/skript/expressions/ExprReadiedArrow.java # src/main/java/ch/njol/skript/expressions/ExprSentCommands.java # src/main/java/ch/njol/skript/expressions/ExprVersionString.java
This reverts commit 2c9571e.
This reverts commit 56d6871.
Oops, sorry Kenzie & Burb, there was a mishap with merging. Apologies for the (maybe?) notification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! the AvailableEvent annotation is not necessary as that can be handled by AvailableEvents, and you can remove the old Events from the classes
It was something I suggested, as a quality of life thing, most events only ever need 1, the same could have been said about |
for there's also no reason to allow
for you also dont even need the curly brackets when passing a single value to an annotation, e.g. therefore, the only difference between using
fair enough for keeping |
The AvailableEvent has been removed and replaced |
Is there any reason this can't be added on to the existing Events annotation? eg have 2 inputs, 1 string array and 1 class array, both with defaults to empty arrays? |
The events annotation doesn't do too good with representing what it means. Yes, AvailableEvents isn't too too much better, but it is more intuitive that these are the events that the element is available for. As long as Events is deprecated but still used, it should be okay to have a new annotation. Plus if there were to be two default options for Events, it would end up forcing |
Makes sense |
(I also can't see what changes you've requested, or at least I can't find them) |
He didn't do any suggestions, he just marked his review as requested changes with his comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, almost there
Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also increment the JSON_VERSION
to 2, 0
.
from my testing your changes work, so feel free to re-request me and it'll get approved 👍 thanks!
Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
src/main/java/ch/njol/skript/expressions/ExprCommandSender.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after looking at it again, a few minor things still
Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some concerns since this is changing the meaning of the events annotation. Previously, it was meant to list SkriptEvents that the syntax can be used in, not Bukkit Events. These are not 1:1 and I wonder if there's a case where a syntax can be used in skript event A, but not skript event B, where both A and B are derivative of Bukkit event X.
Let me know your thoughts.
I'm not entirely sure how we would deal with this. I had originally thought that we could just check if the AvailableEvents contains all events in said Skript event, but then I thought that it would become a little bit annoying for users to have to look into the Skript event that they'd like to have in the AvailableEvents, and that it would take up more time during development. I do see your concern, but without needing to take up development time, I'm not currently sure of a way to deal with this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the delayed review. I agree in that I don't really see a way to resolve it and I think the failure case is small enough that it's worth adding. Perhaps a manual override option just in case, where you can still provide strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. A few minor mistakes I noticed
import ch.njol.skript.events.EvtPlayerCommandSend; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.ExpressionType; | ||
import ch.njol.skript.lang.SkriptParser.ParseResult; | ||
import ch.njol.skript.lang.util.SimpleExpression; | ||
import ch.njol.util.Kleenean; | ||
import com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused?
@@ -35,9 +31,10 @@ | |||
@Examples({"on server list ping:", | |||
"\tset the version string to \"<light green>Version: <orange>%minecraft version%\"", | |||
"\tset the protocol version to 0 # 13w41a (1.7) - so the player will see the custom version string almost always"}) | |||
@Since("2.3") | |||
@RequiredPlugins("Paper 1.12.2 or newer") | |||
@AvailableEvents(ServerListPingEvent.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be PaperServerListPingEvent
@AvailableEvents(PlayerLevelChangeEvent.class) | ||
@Events("level change") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can actually remove the Events annotation here. It doesn't seem to be required/used for the syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was mentioned before, as I replied to it prior the removal of it there causes breaking changes to other documentation sites
for (Class<? extends Event> event : availableEvents.value()) { | ||
if (events.get(event) == null) | ||
continue; | ||
for (SkriptEventInfo<?> skriptEvent : events.get(event)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible that two Bukkit events will resolve to the same SkriptEventInfo. Is that something we need to be checking?
@AvailableEvents(EntityDamageEvent.class) | ||
@Events("damage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the commented-out code, I think you can instead remove the Events annotation here. It doesn't appear to have event-specific behavior anymore
@@ -29,9 +25,10 @@ | |||
"\tset the protocol version to 0 # 13w41a (1.7), so it will show the version string always", | |||
"\tset the version string to \"<light green>Version: <orange>%minecraft version%\"" | |||
}) | |||
@Since("2.3") | |||
@RequiredPlugins("Paper 1.12.2+") | |||
@AvailableEvents(ServerListPingEvent.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be PaperServerListPingEvent
Co-authored-by: Patrick Miller <apickledwalrus@icloud.com>
Description
This annotation will hopefully bring some sort of (sk) unity to the Events annotation catastrophe.
Let me know if I should (if this is good) include a deprecation of the
@Events
annotation.(Here you go efy!)
Target Minecraft Versions: any
Requirements: none
Related Issues: none