-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add RadiationDamageEvent to the api (#4225)
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/RadiationDamageEvent.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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package io.github.thebusybiscuit.slimefun4.api.events; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* The {@link RadiationDamageEvent} is called when a player takes radiation damage. | ||
* | ||
* @author HoosierTransfer | ||
*/ | ||
public class RadiationDamageEvent extends Event implements Cancellable { | ||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final Player player; | ||
private final int exposure; | ||
private boolean cancelled; | ||
|
||
/** | ||
* This constructs a new {@link RadiationDamageEvent}. | ||
* | ||
* @param player The {@link Player} who took radiation damage | ||
* @param exposure The amount of radiation exposure | ||
*/ | ||
public RadiationDamageEvent(@Nonnull Player player, int exposure) { | ||
this.player = player; | ||
this.exposure = exposure; | ||
} | ||
|
||
/** | ||
* This returns the {@link Player} who took radiation damage. | ||
* | ||
* @return The {@link Player} who took radiation damage | ||
*/ | ||
public @Nonnull Player getPlayer() { | ||
return player; | ||
} | ||
|
||
/** | ||
* This returns the amount of radiation exposure. | ||
* | ||
* @return The amount of radiation exposure | ||
*/ | ||
public int getExposure() { | ||
return exposure; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancelled) { | ||
this.cancelled = cancelled; | ||
} | ||
|
||
public static @Nonnull HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
@Override | ||
public @Nonnull HandlerList getHandlers() { | ||
return getHandlerList(); | ||
} | ||
} |
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