-
-
Notifications
You must be signed in to change notification settings - Fork 374
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 playerexpcooldownchange event #5822
Add playerexpcooldownchange event #5822
Conversation
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.
nyhlus pr!!
import javax.annotation.Nullable; | ||
|
||
@Name("Exp Cooldown") | ||
@Description("The exp cooldown of a player") |
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.
Can you elaborate more? What's an exp cooldown? Is it a cooldown for gaining experience, is it a cooldown for picking up experience, for dropping experience, etc.
@Override | ||
@Nullable | ||
public Class<?>[] acceptChange(ChangeMode mode) { | ||
return (mode != ChangeMode.REMOVE_ALL) ? CollectionUtils.array(Timespan.class) : null; |
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.
May want to default to null if given an unexpected new ChangeMode, rather than accepting it. A switch is often recommended, I believe.
Co-authored-by: sovdee <ethansovde@gmail.com>
Co-authored-by: sovdee <ethansovde@gmail.com>
Co-authored-by: sovdee <ethansovde@gmail.com>
|
||
import javax.annotation.Nullable; | ||
|
||
@Name("Exp Cooldown") |
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 might be better to not use the abbreviated name here.
public Class<? extends Timespan> getReturnType() { return Timespan.class; } | ||
|
||
@Override | ||
protected String getPropertyName() { return "exp cooldown"; } |
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.
The property should probably be experience cooldown.
|
||
static { | ||
if (Skript.methodExists(Player.class, "getExpCooldown")) | ||
register(ExprExpCooldown.class, Timespan.class, "exp[erience] [pickup] cooldown change", "players"); |
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 looks like change
is a necessary element in the pattern but I thought that was for the event, not the property expression.
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
|
||
import javax.annotation.Nullable; |
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.
Use Jetbrains or Eclipse Nullable, we don't typically use javax
@Override | ||
@Nullable | ||
public Class<?>[] acceptChange(ChangeMode mode) { | ||
return (mode != ChangeMode.REMOVE_ALL) ? CollectionUtils.array(Timespan.class) : null; |
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.
Skript doesn't do one liners, changes need similar to the convert
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
bd134d0
to
3f08853
Compare
Closing due to 9+ months of inactivity. |
Description
Added PlayerExpCooldownEvent.
Target Minecraft Versions:
Requirements:
Related Issues: #5802