private static void ResolvedBans(BanInfo information) { if (information == null) { return; } Player target = Player.FindByUserId(information.Player.UserId); if (target == null) { return; } if (!target.Privileges.HasPrivilege("noban")) { target.Kick(information.Reason); } }
public void AddBan(BanInfo bi, Action <Exception, bool> callback) { callback(null, false); }
public void AddBan(BanInfo bi, Action<Exception, bool> callback) { callback(null, false); }
public override void Execute(Player player) { if (player != null && !player.Privileges.HasPrivilege("ban")) { WriteLine(player, "You have no ban privileges"); return; } Player target = Player.Find(Target); if (target == null) { WriteLine(player, "Couldn't find target player"); return; } if (target.Privileges.HasPrivilege("immunity")) { WriteLine(player, "Target has general immunity"); return; } if (target.Privileges.HasPrivilege("noban")) { WriteLine(player, "Target has ban immunity"); return; } TimeSpan duration; if (!TryParseDuration(out duration)) { WriteLine(player, "Duration was misformed"); } BanInfo bi = new BanInfo(player, target, duration, Reason); int userid = Player.GetUserID(player); Task.Factory.StartNew(() => { SharpMod.Database.AddBan(bi, (Exception exception, bool success) => { if (success) { OnSuccess(userid); } else { OnFailure(userid, exception); } }); }); }