mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 12:35:15 +01:00
Fixes an issue with boats
Signed-off-by: matt <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
parent
56c24a6a56
commit
1d327ec346
@ -35,6 +35,7 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.help.HelpTopic;
|
||||
@ -235,6 +236,33 @@ import java.util.regex.Pattern;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onVehicleEntityCollision(VehicleEntityCollisionEvent e) {
|
||||
if (e.getVehicle().getType() == EntityType.BOAT) {
|
||||
Location location = BukkitUtil.getLocation(e.getEntity());
|
||||
if (location.getPlotArea() == null) {
|
||||
//we don't care about events that happen outside of a plot area.
|
||||
return;
|
||||
}
|
||||
if (e.getEntity() instanceof Player) {
|
||||
PlotPlayer player = BukkitUtil.getPlayer((Player) e.getEntity());
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if (plot != null) {
|
||||
if (!plot.isAdded(player.getUUID())) {
|
||||
//Here the event is only canceled if the player is not the owner
|
||||
//of the property on which he is located.
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
//Here the event is cancelled too, otherwise you can move the
|
||||
//boat with EchoPets or other mobs running around on the plot.
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onRedstoneEvent(BlockRedstoneEvent event) {
|
||||
Block block = event.getBlock();
|
||||
/* switch (block.getType()) {
|
||||
|
Loading…
Reference in New Issue
Block a user