Disable gadgets if the game is in progress

This commit is contained in:
Sam 2017-09-10 18:55:03 +01:00 committed by cnr
parent e51487a949
commit f72c2d4ec0

View File

@ -75,6 +75,7 @@ import mineplex.core.events.EnableArcadeSpawnEvent;
import mineplex.core.explosion.Explosion;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.facebook.FacebookManager;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.event.ToggleMobsEvent;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -1696,6 +1697,16 @@ public class ArcadeManager extends MiniPlugin implements IRelation
getCosmeticManager().getGadgetManager().setGadgetEnabled(playerCount <= (GetGameHostManager().isEventServer() ? 120 : 40));
}
@EventHandler(priority = EventPriority.HIGH)
public void disableGadgetsInGame(GadgetEnableEvent event)
{
if (_game != null && _game.InProgress() && _game.GadgetsDisabled)
{
event.setShowMessage(false);
event.setCancelled(true);
}
}
/*public void saveBasicStats(final Game game)
{
if (!IsTournamentServer())