-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
133 additions
and
97 deletions.
There are no files selected for viewing
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
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
37 changes: 37 additions & 0 deletions
37
src/main/java/me/xginko/snowballfight/events/SnowballEvent.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,37 @@ | ||
package me.xginko.snowballfight.events; | ||
|
||
import org.bukkit.entity.Snowball; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public abstract class SnowballEvent extends Event { | ||
|
||
private static final @NotNull HandlerList handlers = new HandlerList(); | ||
|
||
private final Snowball snowball; | ||
|
||
public SnowballEvent(boolean isAsync, Snowball snowball) { | ||
super(isAsync); | ||
this.snowball = snowball; | ||
} | ||
|
||
public SnowballEvent(Snowball snowball) { | ||
this.snowball = snowball; | ||
} | ||
|
||
public Snowball getSnowball() { | ||
return snowball; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
@NotNull | ||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/me/xginko/snowballfight/events/SnowballExplodeEvent.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,59 @@ | ||
package me.xginko.snowballfight.events; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.Snowball; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public abstract class SnowballExplodeEvent extends SnowballEvent { | ||
|
||
private static final @NotNull HandlerList handlers = new HandlerList(); | ||
|
||
protected @Nullable Entity hitEntity; | ||
protected @NotNull Location location; | ||
protected float explosionPower; | ||
protected boolean setFire, breakBlocks; | ||
|
||
public SnowballExplodeEvent(Snowball snowball, @Nullable Entity hitEntity, | ||
@NotNull Location location, float explosionPower, boolean setFire, boolean breakBlocks) { | ||
super(snowball); | ||
this.hitEntity = hitEntity; | ||
this.location = location; | ||
this.explosionPower = explosionPower; | ||
this.setFire = setFire; | ||
this.breakBlocks = breakBlocks; | ||
} | ||
|
||
public @Nullable Entity getHitEntity() { | ||
return hitEntity; | ||
} | ||
|
||
public @NotNull Location getLocation() { | ||
return location; | ||
} | ||
|
||
public float getPower() { | ||
return explosionPower; | ||
} | ||
|
||
public boolean getFire() { | ||
return setFire; | ||
} | ||
|
||
public boolean getBreakBlocks() { | ||
return breakBlocks; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
@NotNull | ||
public static 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