Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Created FusedExplosive interface. #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/org/bukkit/entity/Creeper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Represents a Creeper
*/
public interface Creeper extends Monster {
public interface Creeper extends Monster, FusedExplosive {

/**
* Checks if this Creeper is powered (Electrocuted)
Expand All @@ -13,7 +13,8 @@ public interface Creeper extends Monster {
public boolean isPowered();

/**
* Sets the Powered status of this Creeper
* Sets the Powered status of this Creeper.<br>
* Powered creeper's explosion yield is 2 times bigger than default.
*
* @param value New Powered status
*/
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/org/bukkit/entity/FusedExplosive.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.bukkit.entity;

/**
* A representation of a fused {@link Explosive}.
*/
public interface FusedExplosive extends Explosive {
/**
* Set the number of ticks until the entity blows up after being primed.
*
* @param fuseTicks The fuse ticks
*/
public void setFuseTicks(int fuseTicks);

/**
* Retrieve the number of ticks until the explosion of this entity.
*
* @return the number of ticks until this entity explodes
*/
public int getFuseTicks();

}
17 changes: 1 addition & 16 deletions src/main/java/org/bukkit/entity/TNTPrimed.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,7 @@
/**
* Represents a Primed TNT.
*/
public interface TNTPrimed extends Explosive {

/**
* Set the number of ticks until the TNT blows up after being primed.
*
* @param fuseTicks The fuse ticks
*/
public void setFuseTicks(int fuseTicks);

/**
* Retrieve the number of ticks until the explosion of this TNTPrimed
* entity
*
* @return the number of ticks until this TNTPrimed explodes
*/
public int getFuseTicks();
public interface TNTPrimed extends FusedExplosive {

/**
* Gets the source of this primed TNT. The source is the entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.bukkit.entity.minecart;

import org.bukkit.entity.FusedExplosive;
import org.bukkit.entity.Minecart;

/**
* Represents a Minecart with TNT inside it that can explode when triggered.
*/
public interface ExplosiveMinecart extends Minecart {
public interface ExplosiveMinecart extends Minecart, FusedExplosive {
}
53 changes: 53 additions & 0 deletions src/main/java/org/bukkit/event/entity/ExplosiveFuseStartEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package org.bukkit.event.entity;

import org.bukkit.Location;
import org.bukkit.entity.FusedExplosive;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

/**
* Called when a fused {@link FusedExplosive} is ignited.
*/
public class ExplosiveFuseStartEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;

public ExplosiveFuseStartEvent(FusedExplosive what) {
super(what);
}

/**
* Gets the {@link FusedExplosive} that was ignited.
*
* @return The ignited {@link FusedExplosive}
*/
@Override
public FusedExplosive getEntity() {
return (FusedExplosive) entity;
}

/**
* Gets the event's {@link Location}.
* @return The event Location
*/
public Location getLocation() {
return entity.getLocation ();
}

public boolean isCancelled() {
return cancelled;
}

public void setCancelled(boolean cancel) {
cancelled = cancel;
}

@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}
}