-
Notifications
You must be signed in to change notification settings - Fork 549
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 a TalismanActivatedEvent which fires when a Player uses a Talisman. #3920
Conversation
Activates when a Talisman is activated.
Pro Tip!
If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀 |
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/3920/68fa4e85
|
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 idea but some changes need to be made :)
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivatedEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivatedEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivatedEvent.java
Outdated
Show resolved
Hide resolved
...java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivatedEvent.java
Outdated
Show resolved
Hide resolved
...java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java
Outdated
Show resolved
Hide resolved
…lismanActivatedEvent.java changes variable names to camel case Co-authored-by: TheBusyBiscuit <[email protected]>
…lismanActivatedEvent.java changes the who variable to a more clear player variable Co-authored-by: Sefiraat <[email protected]>
talisman.sendMessage(p); | ||
TalismanActivatedEvent TalismanEvent = new TalismanActivatedEvent(p, talisman, talismanItem); | ||
Bukkit.getPluginManager().callEvent(TalismanEvent); | ||
if(!TalismanEvent.isCancelled()) { |
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.
if(!TalismanEvent.isCancelled()) { | |
if (!TalismanEvent.isCancelled()) { |
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'm pretty sure I committed this but apparently the change hasn't gone through, I don't really know why
...java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/Talisman.java
Show resolved
Hide resolved
…n/items/magical/talismans/Talisman.java adds a space for readability Co-authored-by: J3fftw <[email protected]>
…n/items/magical/talismans/Talisman.java more spaces for readability Co-authored-by: J3fftw <[email protected]>
…n/items/magical/talismans/Talisman.java didnt commit the first time I guess Co-authored-by: J3fftw <[email protected]>
* | ||
*/ | ||
|
||
public class TalismanActivatedEvent extends PlayerEvent implements Cancellable { |
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.
We might wanna rename this.
when it’s cancelled it’s not activated.
So maybe TalismanActivatEvent Or something else
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.
That's a good idea. I didn't even think of that.
Due to me writing by mail, you need to lowercase the variable name 'Handlers'
…On 7/26/23, China Worldstar ***@***.***> wrote:
@Sniperkaos commented on this pull request.
> +import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+
+import
io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman;
+
+/**
+ *
+ * This ***@***.*** PlayerEvent} is called when a ***@***.*** Player} activates a
***@***.*** Talisman}
+ *
+ * @author cworldstar
+ *
+ */
+
+public class TalismanActivatedEvent extends PlayerEvent implements
Cancellable {
That's a good idea. I didn't even think of that.
--
Reply to this email directly or view it on GitHub:
#3920 (comment)
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
* @return The {@link Talisman} used. | ||
* | ||
*/ | ||
@Nonnull |
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.
According to the style preferences, annotations that target the return type should be inline. Same for line 60.
@Nonnull | |
public @Nonnull Talisman getTalisman() { |
@Sniperkaos Still working on the suggestions above or happy for it to be closed? |
Co-authored-by: TheBusyBiscuit <[email protected]> Co-authored-by: Sefiraat <[email protected]> Co-authored-by: J3fftw <[email protected]> Co-authored-by: Daniel Walsh <[email protected]> Co-authored-by: China Worldstar <[email protected]> Co-authored-by: cworldstar <[email protected]> Co-authored-by: Alessio Colombo <[email protected]>
Description
I found it odd that there wasn't an event to listen for when Talismans are activated, and thought it would be
helpful for one to be added.
Proposed changes
Added TalismanActivationEvent, which extends PlayerEvent.
It is fired when the static function activateTalisman is called.
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values