Change border creep speed, boats only placeable on water

This commit is contained in:
libraryaddict 2015-03-20 17:34:44 +13:00
parent 7b41649d94
commit 3e7346618b

View File

@ -15,6 +15,7 @@ import org.bukkit.block.Furnace;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
@ -43,6 +44,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.inventory.FurnaceInventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
@ -496,7 +498,7 @@ public class SurvivalGames extends SoloGame
}
}
//@EventHandler
// @EventHandler
public void chestTickEvent(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
@ -596,6 +598,31 @@ public class SurvivalGames extends SoloGame
WorldData.World.setTime(WorldTimeSet);
}
@EventHandler
public void onVechilePlace(VehicleCreateEvent event)
{
if (event.getVehicle() instanceof Boat)
{
for (int x = -1; x <= 1; x++)
{
for (int y = -1; y <= 1; y++)
{
for (int z = -1; z <= 1; z++)
{
Block b = event.getVehicle().getLocation().add(x, y, z).getBlock();
if (b.isLiquid())
{
return;
}
}
}
}
event.getVehicle().remove();
}
}
@EventHandler
public void deathmatchBowShoot(EntityShootBowEvent event)
{
@ -1377,13 +1404,13 @@ public class SurvivalGames extends SoloGame
private ArrayList<Double> buildBorders(int seconds, double border, double leaveRemaining)
{
double totalNumber = Math.pow(seconds, 2D) + seconds;
double totalNumber = Math.pow(seconds, 1.9D) + (seconds * 50);
ArrayList<Double> borders = new ArrayList<Double>();
for (int i = 0; i <= seconds; i++)
{
borders.add(border - ((border - leaveRemaining) * (((Math.pow(i, 2D)) + i) / totalNumber)));
borders.add(border - ((border - leaveRemaining) * (((Math.pow(i, 1.9D) + (i * 50))) / totalNumber)));
}
return borders;