MAC disabled with Tournament Mode

Bridges TM game desc fix
This commit is contained in:
Chiss 2014-05-03 11:47:15 +10:00
parent e818662161
commit 395a5d2c08
4 changed files with 94 additions and 42 deletions

View File

@ -39,6 +39,8 @@ public class AntiHack extends MiniPlugin
public static AntiHack Instance; public static AntiHack Instance;
private boolean _enabled = true;
public Punish Punish; public Punish Punish;
public Portal Portal; public Portal Portal;
@ -94,6 +96,9 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void playerMove(PlayerMoveEvent event) public void playerMove(PlayerMoveEvent event)
{ {
if (!_enabled)
return;
synchronized (_antiHackLock) synchronized (_antiHackLock)
{ {
_lastMoveEvent.put(event.getPlayer(), System.currentTimeMillis()); _lastMoveEvent.put(event.getPlayer(), System.currentTimeMillis());
@ -103,6 +108,9 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void playerTeleport(PlayerTeleportEvent event) public void playerTeleport(PlayerTeleportEvent event)
{ {
if (!_enabled)
return;
synchronized (_antiHackLock) synchronized (_antiHackLock)
{ {
_ignore.put(event.getPlayer(), System.currentTimeMillis() + 2000); _ignore.put(event.getPlayer(), System.currentTimeMillis() + 2000);
@ -112,6 +120,9 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void playerVelocity(PlayerVelocityEvent event) public void playerVelocity(PlayerVelocityEvent event)
{ {
if (!_enabled)
return;
synchronized (_antiHackLock) synchronized (_antiHackLock)
{ {
_velocityEvent.add(event.getPlayer()); _velocityEvent.add(event.getPlayer());
@ -121,6 +132,9 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void playerToggleFly(PlayerToggleFlightEvent event) public void playerToggleFly(PlayerToggleFlightEvent event)
{ {
if (!_enabled)
return;
Player player = event.getPlayer(); Player player = event.getPlayer();
synchronized (_antiHackLock) synchronized (_antiHackLock)
@ -147,12 +161,18 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void playerQuit(PlayerQuitEvent event) public void playerQuit(PlayerQuitEvent event)
{ {
if (!_enabled)
return;
ResetAll(event.getPlayer()); ResetAll(event.getPlayer());
} }
@EventHandler @EventHandler
public void startIgnore(PlayerMoveEvent event) public void startIgnore(PlayerMoveEvent event)
{ {
if (!_enabled)
return;
Player player = event.getPlayer(); Player player = event.getPlayer();
synchronized (_antiHackLock) synchronized (_antiHackLock)
@ -235,6 +255,9 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void processOffenses(UpdateEvent event) public void processOffenses(UpdateEvent event)
{ {
if (!_enabled)
return;
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;
@ -271,6 +294,9 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void generateReports(UpdateEvent event) public void generateReports(UpdateEvent event)
{ {
if (!_enabled)
return;
if (event.getType() != UpdateType.SLOW) if (event.getType() != UpdateType.SLOW)
return; return;
@ -370,6 +396,9 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void cleanupPlayers(UpdateEvent event) public void cleanupPlayers(UpdateEvent event)
{ {
if (!_enabled)
return;
if (event.getType() != UpdateType.SLOW) if (event.getType() != UpdateType.SLOW)
return; return;
@ -397,4 +426,10 @@ public class AntiHack extends MiniPlugin
{ {
return _offense; return _offense;
} }
public void SetEnabled(boolean b)
{
_enabled = b;
System.out.println("MAC Disabled");
}
} }

View File

@ -50,6 +50,7 @@ import mineplex.minecraft.game.core.fire.Fire;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.antistack.AntiStack; import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood; import mineplex.core.blood.Blood;
@ -122,6 +123,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_serverConfig = serverConfig; _serverConfig = serverConfig;
if (serverConfig.Tournament)
{
AntiHack.Instance.SetEnabled(false);
}
//Modules //Modules
_antistack = antistack; _antistack = antistack;

View File

@ -64,7 +64,7 @@ public abstract class Game implements Listener
//Game //Game
private GameType _gameType; private GameType _gameType;
private String[] _gameDesc; protected String[] _gameDesc;
//Map //Map
private ArrayList<String> _files; private ArrayList<String> _files;

View File

@ -156,8 +156,19 @@ public class Bridge extends TeamGame implements OreObsfucation
//Tournament //Tournament
if (Manager.IsTournamentServer()) if (Manager.IsTournamentServer())
{
QuitOut = false; QuitOut = false;
_gameDesc = new String[]
{
"Gather resources and prepare for combat.",
"After 10 minutes, The Bridges will emerge.",
"Special loot is located in the center.",
"Team with the most kills wins!"
};
}
_tournament = Manager.IsTournamentServer(); _tournament = Manager.IsTournamentServer();
} }