-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggestions, Formatting, and cleanup
- Loading branch information
1 parent
a294e54
commit 903144e
Showing
2 changed files
with
79 additions
and
88 deletions.
There are no files selected for viewing
158 changes: 75 additions & 83 deletions
158
...n4/api/events/TalismanActivatedEvent.java → ...un4/api/events/TalismanActivateEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,76 @@ | ||
package io.github.thebusybiscuit.slimefun4.api.events; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import org.bukkit.entity.Player; | ||
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 {@link PlayerEvent} is called when a {@link Player} activates a {@link Talisman} | ||
* | ||
* @author cworldstar | ||
* | ||
*/ | ||
|
||
public class TalismanActivatedEvent extends PlayerEvent implements Cancellable { | ||
|
||
private static HandlerList Handlers = new HandlerList(); | ||
private Talisman talisman; | ||
private ItemStack talismanItemStack; | ||
private boolean cancelled = false; | ||
|
||
|
||
/** | ||
* | ||
* @param player | ||
* The {@link Player} who activated the talisman. | ||
* | ||
* @param talisman | ||
* The {@link Talisman} that was activated. | ||
* | ||
* @param talismanItem | ||
* The {@link ItemStack} corresponding to the Talisman. | ||
*/ | ||
@ParametersAreNonnullByDefault | ||
public TalismanActivatedEvent(Player player, Talisman talisman, ItemStack talismanItem) { | ||
super(player); | ||
this.talisman = talisman; | ||
this.talismanItemStack = talismanItem; | ||
} | ||
/** | ||
* | ||
* @return The {@link Talisman} used. | ||
* | ||
*/ | ||
@Nonnull | ||
public Talisman getTalisman() { | ||
return this.talisman; | ||
} | ||
/** | ||
* | ||
* @return The {@link ItemStack} of the used {@link Talisman}. | ||
*/ | ||
@Nonnull | ||
public ItemStack getTalismanItem() { | ||
return this.talismanItemStack; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return Handlers; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
@Override | ||
public boolean isCancelled() { | ||
return this.cancelled; | ||
} | ||
@Override | ||
public void setCancelled(boolean cancel) { | ||
this.cancelled = cancel; | ||
} | ||
|
||
|
||
|
||
package io.github.thebusybiscuit.slimefun4.api.events; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import org.bukkit.entity.Player; | ||
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 {@link PlayerEvent} is called when a {@link Player} activates a {@link Talisman} | ||
* | ||
* @author cworldstar | ||
*/ | ||
|
||
public class TalismanActivateEvent extends PlayerEvent implements Cancellable { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
private final Talisman talisman; | ||
private final ItemStack talismanItemStack; | ||
private boolean cancelled = false; | ||
|
||
/** | ||
* @param player | ||
* The {@link Player} who activated the talisman. | ||
* | ||
* @param talisman | ||
* The {@link Talisman} that was activated. | ||
* | ||
* @param talismanItem | ||
* The {@link ItemStack} corresponding to the Talisman. | ||
*/ | ||
@ParametersAreNonnullByDefault | ||
public TalismanActivateEvent(Player player, Talisman talisman, ItemStack talismanItem) { | ||
super(player); | ||
this.talisman = talisman; | ||
this.talismanItemStack = talismanItem; | ||
} | ||
|
||
/** | ||
* @return The {@link Talisman} used. | ||
*/ | ||
public @Nonnull Talisman getTalisman() { | ||
return this.talisman; | ||
} | ||
|
||
/** | ||
* @return The {@link ItemStack} of the used {@link Talisman}. | ||
*/ | ||
public @Nonnull ItemStack getTalismanItem() { | ||
return this.talismanItemStack; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return this.cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancel) { | ||
this.cancelled = cancel; | ||
} | ||
|
||
@Override | ||
public @Nonnull HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
|
||
public static @Nonnull HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters