adds a check to see if the parcel dataset has loaded before processing

This commit is contained in:
Madpeter 2020-04-27 02:26:25 +01:00
parent 53d95f0e2a
commit 8eff843938

View file

@ -55,6 +55,8 @@ namespace BSB.Commands.CMD_Parcel
if (get_flags.Count > 0) if (get_flags.Count > 0)
{ {
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition); int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
{
Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid]; Parcel p = bot.GetClient.Network.CurrentSim.Parcels[localid];
StringBuilder reply = new StringBuilder(); StringBuilder reply = new StringBuilder();
string addon = ""; string addon = "";
@ -66,12 +68,17 @@ namespace BSB.Commands.CMD_Parcel
reply.Append(cfg); reply.Append(cfg);
reply.Append("="); reply.Append("=");
reply.Append(p.Flags.HasFlag(flags[cfg]).ToString()); reply.Append(p.Flags.HasFlag(flags[cfg]).ToString());
if(addon != ",") addon = ","; if (addon != ",") addon = ",";
} }
} }
return bot.GetCommandsInterface.SmartCommandReply(target, reply.ToString(), CommandName); return bot.GetCommandsInterface.SmartCommandReply(target, reply.ToString(), CommandName);
} }
else else
{
Failed("Enhance your carm");
}
}
else
{ {
return Failed("No accepted flags"); return Failed("No accepted flags");
} }