public AddingInventoryItemsEventArgs(Player ply, Subteams subteam, bool isAllowed = true, bool forceTeam = false) { Subteam = subteam; IsAllowed = isAllowed; ForceTeam = forceTeam; Player = ply; }
public SettingPlayerTeamEventArgs(Teams team, Subteams subclass, Player player, bool isAllowed = true) { Team = team; Subclass = subclass; Player = player; IsAllowed = isAllowed; }
public void ChangeTeam(Player p, Teams t, Subteams s) { var handler = new Events.General.SettingPlayerTeamEventArgs(t, s, p); handler.StartInvoke(); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Bots == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Bots"); } if (CacheTsVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "CacheTsVersion"); } if (Channels == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Channels"); } if (Dnd == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Dnd"); } if (Groups == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Groups"); } if (Ims == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Ims"); } if (LatestEventTs == null) { throw new ValidationException(ValidationRules.CannotBeNull, "LatestEventTs"); } if (NonThreadableChannels == null) { throw new ValidationException(ValidationRules.CannotBeNull, "NonThreadableChannels"); } if (ReadOnlyChannels == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ReadOnlyChannels"); } if (Self == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Self"); } if (Subteams == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Subteams"); } if (Team == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Team"); } if (ThreadOnlyChannels == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ThreadOnlyChannels"); } if (Url == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Url"); } if (Users == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Users"); } if (Channels != null) { if (Channels.Count < 1) { throw new ValidationException(ValidationRules.MinItems, "Channels", 1); } if (Channels.Count != System.Linq.Enumerable.Count(System.Linq.Enumerable.Distinct(Channels))) { throw new ValidationException(ValidationRules.UniqueItems, "Channels"); } } if (Dnd != null) { Dnd.Validate(); } if (Groups != null) { if (Groups.Count != System.Linq.Enumerable.Count(System.Linq.Enumerable.Distinct(Groups))) { throw new ValidationException(ValidationRules.UniqueItems, "Groups"); } } if (Ims != null) { if (Ims.Count < 1) { throw new ValidationException(ValidationRules.MinItems, "Ims", 1); } if (Ims.Count != System.Linq.Enumerable.Count(System.Linq.Enumerable.Distinct(Ims))) { throw new ValidationException(ValidationRules.UniqueItems, "Ims"); } } if (Mpims != null) { if (Mpims.Count != System.Linq.Enumerable.Count(System.Linq.Enumerable.Distinct(Mpims))) { throw new ValidationException(ValidationRules.UniqueItems, "Mpims"); } } if (Self != null) { Self.Validate(); } if (Subteams != null) { Subteams.Validate(); } if (Team != null) { Team.Validate(); } if (Users != null) { if (Users.Count < 1) { throw new ValidationException(ValidationRules.MinItems, "Users", 1); } if (Users.Count != System.Linq.Enumerable.Count(System.Linq.Enumerable.Distinct(Users))) { throw new ValidationException(ValidationRules.UniqueItems, "Users"); } foreach (var element in Users) { if (element != null) { element.Validate(); } } } }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { Player ply = Player.Get(sender as CommandSender); if (ply.CheckPermission("ATC.forceteam")) { if (arguments.ToList().Count == 0) { response = "<color=blue>forceteam <teamName> <subteamName> <playerId></color>"; return(false); } response = "<color=red>Error Team Does Not Exist</color>"; foreach (Teams t in MainPlugin.Singleton.Config.Teams) { if (t.Name == arguments.ToList()[0].ToLower()) { if (!t.Active && !ply.CheckPermission("ATC.bypass")) { response = "<color=red>Error you cant force team this team as you dont have the ATC.bypass Permission</color>"; return(false); } Teams team = null; foreach (var tm in MainPlugin.Singleton.Config.Teams) { if (tm.Name.ToLower() == arguments.ToList()[0].ToLower()) { team = tm; } } if (team == null) { response = "<color=red>Team not found</color>"; return(false); } Subteams steam = null; foreach (var sb in team.Subclasses) { if (sb.Name.ToLower() == arguments.ToList()[0].ToLower()) { steam = sb; } } if (steam == null) { response = "<color=red>SubClass not found</color>"; return(false); } response = "<color=red>Error Could not find subclass</color>"; foreach (Subteams st in t.Subclasses) { if (arguments.ToList()[1].ToLower() == st.Name) { response = "<color=red>Error Player Not Found</color>"; if (Player.Get(arguments.ToList()[2].ToLower()).IsVerified) { response = "<color=green>Changed players Team!!!</color>"; MainPlugin.Singleton.TmMethods.ChangeTeam(Player.Get(arguments.ToList()[2].ToLower()), team, st); return(true); } return(false); } } return(false); } } } else { response = "<color=red>You do not have permission to use this command aka you dont have ATC.forceteam</color>"; } return(false); }