-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add module to enable explosion of entities with pumpkins on their head
change a few config paths for better understanding add a few comments improve here and there
- Loading branch information
Showing
17 changed files
with
402 additions
and
123 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
68 changes: 68 additions & 0 deletions
68
src/main/java/me/xginko/pumpkinpvpreloaded/events/PostPumpkinHeadEntityExplodeEvent.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,68 @@ | ||
package me.xginko.pumpkinpvpreloaded.events; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.entity.LivingEntity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class PostPumpkinHeadEntityExplodeEvent extends Event { | ||
|
||
private static final @NotNull HandlerList handlers = new HandlerList(); | ||
|
||
private final @NotNull LivingEntity pumpkinHead; | ||
private final @Nullable Player killer; | ||
private final @NotNull Location explodeLocation; | ||
private final float explodePower; | ||
private final boolean setFire, destroyedBlocks, hasExploded; | ||
|
||
public PostPumpkinHeadEntityExplodeEvent( | ||
@NotNull LivingEntity pumpkinHead, | ||
final @Nullable Player killer, | ||
@NotNull Location explodeLocation, | ||
final float explosionPower, | ||
final boolean setFire, | ||
final boolean destroyedBlocks, | ||
final boolean hasExploded | ||
) { | ||
this.pumpkinHead = pumpkinHead; | ||
this.killer = killer; | ||
this.explodeLocation = explodeLocation; | ||
this.explodePower = explosionPower; | ||
this.setFire = setFire; | ||
this.destroyedBlocks = destroyedBlocks; | ||
this.hasExploded = hasExploded; | ||
} | ||
|
||
public @NotNull LivingEntity getPumpkinHeadEntity() { | ||
return pumpkinHead; | ||
} | ||
public @Nullable Player getKiller() { | ||
return killer; | ||
} | ||
public @NotNull Location getExplodeLocation() { | ||
return explodeLocation; | ||
} | ||
public boolean hasExploded() { | ||
return hasExploded; | ||
} | ||
public float getExplodePower() { | ||
return explodePower; | ||
} | ||
public boolean hasSetFire() { | ||
return setFire; | ||
} | ||
public boolean hasDestroyedBlocks() { | ||
return destroyedBlocks; | ||
} | ||
|
||
@Override | ||
public @NotNull HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
public static @NotNull HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
src/main/java/me/xginko/pumpkinpvpreloaded/events/PrePumpkinHeadEntityExplodeEvent.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,89 @@ | ||
package me.xginko.pumpkinpvpreloaded.events; | ||
|
||
import me.xginko.pumpkinpvpreloaded.PumpkinPVPConfig; | ||
import me.xginko.pumpkinpvpreloaded.PumpkinPVPReloaded; | ||
import org.bukkit.Location; | ||
import org.bukkit.entity.LivingEntity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class PrePumpkinHeadEntityExplodeEvent extends Event implements Cancellable { | ||
|
||
private static final @NotNull HandlerList handlers = new HandlerList(); | ||
private boolean isCancelled; | ||
|
||
private @NotNull LivingEntity pumpkinHead; | ||
private final @Nullable Player killer; | ||
private @NotNull Location explodeLocation; | ||
private float explodePower; | ||
private boolean setFire, breakBlocks; | ||
|
||
public PrePumpkinHeadEntityExplodeEvent( | ||
@NotNull LivingEntity pumpkinHead, | ||
final @Nullable Player killer, | ||
@NotNull Location explodeLocation | ||
) { | ||
this.pumpkinHead = pumpkinHead; | ||
this.killer = killer; | ||
this.explodeLocation = explodeLocation; | ||
PumpkinPVPConfig config = PumpkinPVPReloaded.getConfiguration(); | ||
this.explodePower = config.explosion_power; | ||
this.setFire = config.explosion_set_fire; | ||
this.breakBlocks = config.explosion_break_blocks; | ||
this.isCancelled = false; | ||
} | ||
|
||
public @NotNull LivingEntity getPumpkinHeadEntity() { | ||
return pumpkinHead; | ||
} | ||
public void setPumpkinHeadEntity(@NotNull LivingEntity pumpkinHead) { | ||
this.pumpkinHead = pumpkinHead; | ||
} | ||
public @Nullable Player getKiller() { | ||
return killer; | ||
} | ||
public @NotNull Location getExplodeLocation() { | ||
return explodeLocation; | ||
} | ||
public void setExplodeLocation(@NotNull Location explodeLocation) { | ||
this.explodeLocation = explodeLocation; | ||
} | ||
public float getExplodePower() { | ||
return explodePower; | ||
} | ||
public void setExplodePower(float explodePower) { | ||
this.explodePower = explodePower; | ||
} | ||
public boolean shouldSetFire() { | ||
return setFire; | ||
} | ||
public void setFire(boolean setFire) { | ||
this.setFire = setFire; | ||
} | ||
public boolean shouldBreakBlocks() { | ||
return breakBlocks; | ||
} | ||
public void setBreakBlocks(boolean breakBlocks) { | ||
this.breakBlocks = breakBlocks; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean cancel) { | ||
isCancelled = cancel; | ||
} | ||
@Override | ||
public boolean isCancelled() { | ||
return isCancelled; | ||
} | ||
@Override | ||
public @NotNull HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
public static @NotNull 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
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
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
Oops, something went wrong.