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

Adds Item Cooldown Event #6570

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

Conversation

7othifaPS
Copy link

Description

Adds the item cooldown event to skript


Target Minecraft Versions: any
Requirements: none
Related Issues: #6569

@7othifaPS 7othifaPS mentioned this pull request Apr 15, 2024
1 task
Comment on lines +743 to +749
Skript.registerEvent("Unknown Command", SimpleEvent.class, UnknownCommandEvent.class, "[player] (wrong|unknown) (cmd|command) [send|use]")
.description("Called when the player uses a command that does not exist.")
.examples(
"on unknown command:",
"\tset event-unknown command message to \"Hey, this command does not exist.\""
)
.since("INSERT VERSION");
Copy link
Member

Choose a reason for hiding this comment

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

your branch isn't clean, this is from your old pr.
You may want to restart this pr with a clean branch.

.since("INSERT VERSION");

Skript.registerEvent("Player Item Cooldown", SimpleEvent.class, PlayerItemCooldownEvent.class, "[player] item cool[ ]down")
.description("Called when a player's item cooldown changes.", " ","You must at least wait 1 tick if you need the cooldown or check it", "Because the cooldown won't have been set on the item itself when the event is called in case something wants to cancel or modify the cooldown.")
Copy link
Member

Choose a reason for hiding this comment

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

Why not modify the item cooldown expression to allow it to get/set the event value if it's used in this event?

Copy link
Author

Choose a reason for hiding this comment

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

how should i

Copy link
Author

Choose a reason for hiding this comment

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

and should i just have event-integer in the BukkitEventValues

Copy link
Member

Choose a reason for hiding this comment

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

by editing the getter and changer in the expression, there are examples in things like ExprExperience, for example.
And no, I would not provide event-integer. I would provide event-timespan, though.

Copy link
Author

Choose a reason for hiding this comment

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

ExprItemCooldown doesn't look like ExprExperience class :/

Copy link
Author

Choose a reason for hiding this comment

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

actually i found that setting it in the event will keep setting it forever, because if i set that it calls the event

Copy link
Member

Choose a reason for hiding this comment

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

yes that's exactly why the expression needs a changer that modifies the event's values instead of using setCooldown()
You may also want to prevent setting the cooldown after a delay in the event, but that's optional.

Copy link
Author

Choose a reason for hiding this comment

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

but for modifing the expression, how should i change that since it uses setCooldown(), do i add a checker to check if event instanceof PlayerItemCooldownEvent?

Copy link
Author

Choose a reason for hiding this comment

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

and do other things in that
and if its not it does its regular thing? or thats a bad idea

Copy link
Member

Choose a reason for hiding this comment

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

yes that's exactly why I told you to look at ExprExperience

@AyhamAl-Ali AyhamAl-Ali changed the title Adds Item Cooldown Adds Item Cooldown Event Apr 15, 2024
@AyhamAl-Ali AyhamAl-Ali added the feature Pull request adding a new feature. label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull request adding a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants