forked from GlowstoneMC/Glowstone
-
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.
Implements VechicleCreateEvent and delegate its implementation to Glo…
…wVehicle (GlowstoneMC#922)
- Loading branch information
Showing
3 changed files
with
27 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package net.glowstone.entity; | ||
|
||
import net.glowstone.EventFactory; | ||
import org.bukkit.Location; | ||
import org.bukkit.entity.Vehicle; | ||
import org.bukkit.event.vehicle.VehicleCreateEvent; | ||
|
||
public abstract class GlowVehicle extends GlowEntity implements Vehicle { | ||
/** | ||
* Creates a vehicle and adds it to the specified world. | ||
* | ||
* @param location The location of the entity. | ||
*/ | ||
public GlowVehicle(Location location) { | ||
super(location); | ||
VehicleCreateEvent event = EventFactory.getInstance() | ||
.callEvent(new VehicleCreateEvent(this)); | ||
if (event.isCancelled()) { | ||
this.remove(); | ||
return; | ||
} | ||
} | ||
} |
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