lag detection thing
This commit is contained in:
parent
6456d7bd66
commit
0d4bd91b57
@ -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()
|
||||
|
@ -469,6 +469,11 @@ public class Gladiators extends SoloGame
|
||||
return mids;
|
||||
}
|
||||
|
||||
public HashMap<Player, Arena> getPlayerArenas()
|
||||
{
|
||||
return _playerArenas;
|
||||
}
|
||||
|
||||
public ArrayList<Location> getAllArenaMids()
|
||||
{
|
||||
ArrayList<Location> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user