diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Check.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Check.java index ac338bfb..4d9b2765 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Check.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Check.java @@ -25,6 +25,7 @@ import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.linkage.Linked; +import de.steamwar.sql.GameModeConfig; import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserPerm; @@ -44,12 +45,19 @@ public class Check implements Listener { new StateDependentListener(ArenaMode.Check, FightState.All, this); } + private boolean checkPermission(SteamwarUser user) { + if (user.perms().contains(UserPerm.CHECK)) return true; + return GameModeConfig.getAll() + .stream() + .anyMatch(gameMode -> gameMode.Checkers.contains(user.getId())); + } + @EventHandler public void onJoin(PlayerJoinEvent e) { Player player = e.getPlayer(); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); - if (user.hasPerm(UserPerm.CHECK)) return; + if (!checkPermission(user)) return; SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID); if (user.getId() == schem.getOwner()) return; diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java index b0183aa5..289f22dc 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java @@ -85,7 +85,6 @@ public class CheckCommand extends SWCommand { if (user.perms().contains(UserPerm.CHECK)) return true; return GameModeConfig.getAll() .stream() - .filter(GameModeConfig::isActive) .anyMatch(gameMode -> gameMode.Checkers.contains(user.getId())); }