From 1dcbf5f7fd0a137b062c5adde0f1596d20c4008f Mon Sep 17 00:00:00 2001 From: William Burns Date: Fri, 11 Dec 2015 16:34:04 +0000 Subject: [PATCH 1/3] Couple of fixes --- .../game/games/gladiators/Gladiators.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) 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..c6f39d388 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,5 +1,6 @@ package nautilus.game.arcade.game.games.gladiators; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -659,7 +660,7 @@ public class Gladiators extends SoloGame if (closest != _playerArenas.get(p)) { - if (closest.getColour().furtherOut(_playerArenas.get(p).getColour())) + if (closest.getColour().furtherOut(_playerArenas.get(p).getColour()) || (!_playerArenas.get(p).isOpenDoor())) { // No going backwards. Bounce baby bounce. if (Recharge.Instance.use(p, "Arena Bounce", 500, false, false)) @@ -674,6 +675,9 @@ public class Gladiators extends SoloGame //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 +896,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 +1011,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 +1026,17 @@ 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.")); + } + } } From 6456d7bd66f4aab4ce81e2efd3f46131818c8b98 Mon Sep 17 00:00:00 2001 From: William Burns Date: Fri, 11 Dec 2015 16:55:15 +0000 Subject: [PATCH 2/3] Scoreboard change and breaking blocks. --- .../game/games/gladiators/Gladiators.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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 c6f39d388..b6080c5ad 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 @@ -4,6 +4,7 @@ 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; @@ -24,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; @@ -108,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), @@ -1039,4 +1043,26 @@ public class Gladiators extends SoloGame ((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(); + } } From 0d4bd91b573ca251d15471b6454452bd4ebca195 Mon Sep 17 00:00:00 2001 From: William Burns Date: Fri, 11 Dec 2015 22:47:07 +0000 Subject: [PATCH 3/3] lag detection thing --- .../arcade/game/games/gladiators/Arena.java | 19 +++++++++++++++++-- .../game/games/gladiators/Gladiators.java | 10 +++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) 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 b6080c5ad..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 @@ -469,6 +469,11 @@ public class Gladiators extends SoloGame return mids; } + public HashMap getPlayerArenas() + { + return _playerArenas; + } + public ArrayList getAllArenaMids() { ArrayList mids = new ArrayList<>(); @@ -664,7 +669,7 @@ public class Gladiators extends SoloGame if (closest != _playerArenas.get(p)) { - if (closest.getColour().furtherOut(_playerArenas.get(p).getColour()) || (!_playerArenas.get(p).isOpenDoor())) + if (closest.getColour().furtherOut(_playerArenas.get(p).getColour())) { // No going backwards. Bounce baby bounce. if (Recharge.Instance.use(p, "Arena Bounce", 500, false, false)) @@ -676,6 +681,9 @@ 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);