void HandleLeave(Player p, string[] args) { string prefix = "%dParties> %S"; string noParty = prefix + "You are not in a party."; Team team = Team.GetData(p).Team; if (team == null) { p.Message(noParty); return; } // Handle '/party leave me alone', for example if (args.Length > 1) { team.Message(p, args.Join(" ")); return; } team.Action(p, "has left the party."); team.Remove(p.name); Team.GetData(p).Team = null; team.OwnerLeft(p); Team.SaveList(); }
void LeaveServer(Player p, string reason) { Team team = Team.GetData(p).Team; if (team == null) { return; } if (p.name.CaselessEq(team.Owner)) { team.OwnerLeft(p); return; } team.Action(p, "has left the party (disconnected)."); team.Remove(p.name); Team.GetData(p).Team = null; Team.SaveList(); }
void HandleKick(Player p, string[] args) { string prefix = "%dParties> %S"; string noParty = prefix + "You are not in a party."; Team team = Team.GetData(p).Team; if (team == null) { p.Message(noParty); return; } if (args.Length == 1) { p.Message(prefix + "You need to provide the name of the player to kick."); return; } if (!p.name.CaselessEq(team.Owner)) { p.Message(prefix + "Only the party owner can kick players from the party."); return; } if (team.Remove(args[1])) { team.Action(p, "kicked " + args[1] + " %Sfrom the party."); Player who = PlayerInfo.FindExact(args[1]); if (who != null) { Team.GetData(who).Team = null; } team.OwnerLeft(p); Team.SaveList(); } else { p.Message(prefix + "Player not found. You need to use their full account name."); } }