Turf Wars: Fix sneaking near turf edge and wool placement near ladders.

This commit is contained in:
Thanos paravantis 2016-01-02 23:30:27 +02:00
parent 55cdf4148a
commit 03c6395a30
2 changed files with 43 additions and 5 deletions

2
.gitignore vendored
View File

@ -52,3 +52,5 @@ zSotanna2
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments_1
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/write.lock
/Pocket
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_
/RemoteSystemsTempFiles

View File

@ -4,7 +4,6 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -19,13 +18,13 @@ import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
@ -34,8 +33,6 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import net.minecraft.server.v1_8_R3.EntityArrow;
import net.minecraft.server.v1_8_R3.Item;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
@ -53,7 +50,6 @@ import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
@ -694,6 +690,32 @@ public class TurfForts extends TeamGame
continue;
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
// Apply velocity even if the player is sneaking near turf edges.
if (block.isEmpty())
{
Block[] nearby = {
block.getRelative(BlockFace.NORTH),
block.getRelative(BlockFace.SOUTH),
block.getRelative(BlockFace.WEST),
block.getRelative(BlockFace.EAST),
block.getRelative(BlockFace.NORTH_EAST),
block.getRelative(BlockFace.NORTH_WEST),
block.getRelative(BlockFace.SOUTH_EAST),
block.getRelative(BlockFace.SOUTH_WEST)
};
for (Block near : nearby)
{
if (near.getTypeId() == 159)
{
block = near;
break;
}
}
}
while (block.getTypeId() != 159 && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN);
@ -815,4 +837,18 @@ public class TurfForts extends TeamGame
{
return _enemyTurf.get(player);
}
@EventHandler
public void onBlockPhysics(BlockPhysicsEvent event)
{
if (!IsLive())
return;
Block block = event.getBlock();
if (block.getType() == Material.LADDER)
{
event.setCancelled(true);
}
}
}