Merge pull request #115 in MIN/mineplex from bugfix/thanos to develop

* commit '3770211e66b41e16440609a0a79b3999b9b6cca7':
  Turf Wars: Include Teddy's border fix.
  Turf Wars: Undo bracket formatting.
  Turf Wars: Apply knockback on all players when there are only two in the match.
  Turf Wars: Add comment on block physics event.
  Turf Wars: Fix sneaking near turf edge and wool placement near ladders.
This commit is contained in:
Shaun Bennett 2016-01-04 15:56:32 -06:00
commit 652084d071
2 changed files with 89 additions and 8 deletions

3
.gitignore vendored
View File

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

View File

@ -4,7 +4,6 @@ import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -19,23 +18,23 @@ import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockEvent; import org.bukkit.event.block.BlockEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent; 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.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
@ -53,7 +52,6 @@ import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent; import nautilus.game.arcade.events.PlayerKitGiveEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
@ -694,6 +692,32 @@ public class TurfForts extends TeamGame
continue; continue;
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
// Apply velocity even if the player is sneaking near turf edges.
if (block.isEmpty() && player.isOnGround())
{
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.getType() == Material.STAINED_CLAY || near.getType() == Material.WOOL)
{
block = near;
break;
}
}
}
while (block.getTypeId() != 159 && block.getY() > 0) while (block.getTypeId() != 159 && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN); block = block.getRelative(BlockFace.DOWN);
@ -732,8 +756,8 @@ public class TurfForts extends TeamGame
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
UtilPlayer.message(player, F.main("Game", "You cannot walk on the enemies turf!")); UtilPlayer.message(player, F.main("Game", "You cannot walk on the enemies turf!"));
} }
return; // return;
} }
//On Own Turf //On Own Turf
else if ((team.GetColor() == ChatColor.RED && data == 14) || (team.GetColor() == ChatColor.AQUA && data == 3)) else if ((team.GetColor() == ChatColor.RED && data == 14) || (team.GetColor() == ChatColor.AQUA && data == 3))
@ -815,4 +839,58 @@ public class TurfForts extends TeamGame
{ {
return _enemyTurf.get(player); return _enemyTurf.get(player);
} }
}
// Fixed by TeddyDev.
@EventHandler
public void blockGlitchFix(PlayerInteractEvent event)
{
if(event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if(event.getPlayer().isOnGround())
return;
Block block = event.getClickedBlock();
if(block.getType() == Material.STAINED_CLAY || block.getType() == Material.WOOL)
return;
Player player = event.getPlayer();
Block ground = player.getLocation().getBlock();
while (ground.getType() == Material.AIR && ground.getLocation().getBlockY() >= 0)
{
ground = ground.getRelative(BlockFace.DOWN);
}
if(ground.isLiquid())
{
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 9001, false, false, false,
"Border", "Border Damage");
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
return;
}
if(player.getLocation().distance(ground.getLocation()) < 4)
return;
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 9001, false, false, false,
"Border", "Border Damage");
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f);
}
// Keep ladders placed on ice when block updates occur.
@EventHandler
public void ladderDestroyFix(BlockPhysicsEvent event)
{
if (!IsLive())
return;
Block block = event.getBlock();
if (block.getType() == Material.LADDER)
{
event.setCancelled(true);
}
}
}