diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Arena.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Arena.java index a4dca2dcc..ec26ae9e9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Arena.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Arena.java @@ -258,8 +258,23 @@ public class Arena public void closeDoor() { - for (Location loc : _doorBlocks) - loc.getBlock().setType(Material.OBSIDIAN); + _host.Manager.getScheduler().scheduleSyncDelayedTask(_host.Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + for (Location loc : _doorBlocks) + loc.getBlock().setType(Material.OBSIDIAN); + + // Lag exploit check + for (Player p : getPastPlayers()) + { + Arena closest = _host.getArenaByMid(UtilAlg.findClosest(p.getLocation(), _host.getAllArenaMids())); + if (closest != _host.getPlayerArenas().get(p)) + p.teleport(UtilAlg.findClosest(p.getLocation(), getSpawns())); + } + } + }, 5L); } public boolean isOpenDoor() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index 9fa85f642..b03240656 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -1,8 +1,10 @@ package nautilus.game.arcade.game.games.gladiators; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; @@ -23,7 +25,6 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; @@ -107,6 +108,10 @@ public class Gladiators extends SoloGame DontAllowOverfill = true; EnableTutorials = false; + BlockBreakAllow.add(Material.SUGAR_CANE_BLOCK.getId()); + BlockBreakAllow.add(Material.GRASS.getId()); + BlockBreakAllow.add(Material.LONG_GRASS.getId()); + registerStatTrackers( new BrawlerTracker(this), //new UntouchableTracker(this), @@ -464,6 +469,11 @@ public class Gladiators extends SoloGame return mids; } + public HashMap getPlayerArenas() + { + return _playerArenas; + } + public ArrayList getAllArenaMids() { ArrayList mids = new ArrayList<>(); @@ -671,9 +681,15 @@ public class Gladiators extends SoloGame return; } + if (!_playerArenas.get(p).isOpenDoor()) + return; + //p.sendMessage("ARENA MOVE CHECK METHOD!"); Manager.getPluginManager().callEvent(new PlayerChangeArenaEvent(e.getPlayer(), closest, _playerArenas.get(p))); _playerArenas.put(p, closest); + + // Push player a little + UtilAction.velocity(p, UtilAlg.getTrajectory2d(p.getLocation(), closest.getMid()), 1.7, false, 0.2, 0, 3, false); } } @@ -892,8 +908,8 @@ public class Gladiators extends SoloGame if (e.getEntity() instanceof Player) { - ((Player)e.getEntity()).getInventory().addItem(new ItemStack(Material.ARROW, 1)); // Arrow fix. - ((Player)e.getEntity()).updateInventory(); +// ((Player)e.getEntity()).getInventory().addItem(new ItemStack(Material.ARROW, 1)); // Arrow fix. +// ((Player)e.getEntity()).updateInventory(); } } @@ -1007,6 +1023,9 @@ public class Gladiators extends SoloGame { if (_playerArenas.containsKey(e.getPlayer())) { + if (_playerArenas.get(e.getPlayer()).getState() != ArenaState.FIGHTING) + return; + for (Player p : _playerArenas.get(e.getPlayer()).getPastPlayers()) { if (p.equals(e.getPlayer())) @@ -1019,4 +1038,39 @@ public class Gladiators extends SoloGame } } } + + @EventHandler + public void deathHealth(CombatDeathEvent e) + { + if (!(e.GetEvent().getEntity() instanceof Player)) + return; + + if (e.GetLog().GetKiller().IsPlayer()) + { + Player killer = UtilPlayer.searchExact(e.GetLog().GetKiller().GetName()); + ((Player)e.GetEvent().getEntity()).sendMessage(F.main("Game", "Your killer had " + C.cRed + new DecimalFormat("#").format(killer.getHealth()) + "❤" + C.cGray + " left.")); + } + } + + @EventHandler + public void scoreboardEnd(GameStateChangeEvent e) + { + if (e.GetState() != GameState.End) + return; + + Scoreboard.Reset(); + + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cGreen + C.Bold + "Status"); + Scoreboard.Write(C.cWhite + "Ended"); + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cAqua + C.Bold + "Matches Left"); + Scoreboard.Write(C.cWhite + "0"); + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cYellow + C.Bold + "Players"); + if (getWinners() != null && !getWinners().isEmpty()) + Scoreboard.Write(C.cWhite + getWinners().get(0).getName()); + + Scoreboard.Draw(); + } }