public override void Handle(ServerPlayer player, string[] args) { if (args.Length < 1) { player.SendChat("No username provided."); return; } var toKick = FindPlayer(args[0]); if (toKick == null) { player.SendChat("Couldn't find the player."); return; } if (toKick.IsHost) { player.SendChat("You can't kick the host."); return; } toKick.Disconnect(MpDisconnectReason.Kick); }
public void SendCommand(CommandType cmd, int factionId, int mapId, byte[] data, ServerPlayer sourcePlayer = null) { if (sourcePlayer != null) { bool debugCmd = cmd == CommandType.DebugTools || cmd == CommandType.Sync && debugOnlySyncCmds.Contains(BitConverter.ToInt32(data, 0)); if (!debugMode && debugCmd) { return; } bool hostOnly = cmd == CommandType.Sync && hostOnlySyncCmds.Contains(BitConverter.ToInt32(data, 0)); if (!sourcePlayer.IsHost && hostOnly) { return; } } byte[] toSave = new ScheduledCommand(cmd, gameTimer, factionId, mapId, data).Serialize(); // todo cull target players if not global mapCmds.GetOrAddNew(mapId).Add(toSave); tmpMapCmds?.GetOrAddNew(mapId).Add(toSave); byte[] toSend = toSave.Append(new byte[] { 0 }); byte[] toSendSource = toSave.Append(new byte[] { 1 }); foreach (var player in PlayingPlayers) { player.conn.Send( Packets.Server_Command, sourcePlayer == player ? toSendSource : toSend ); } }
public void SendNoPermission(ServerPlayer player) { player.SendChat("You don't have permission."); }
public override void Handle(ServerPlayer player, string[] args) { player.SendChat("Do you mean /joinpoint?"); }
public abstract void Handle(ServerPlayer player, string[] args);