From ff579cba6dbdeeae83c3a1f809e501eaef98442e Mon Sep 17 00:00:00 2001 From: Madpeter Date: Wed, 29 Apr 2020 03:42:27 +0100 Subject: [PATCH] file rename, and update to shared code block --- Core/Commands/Parcel/ParcelSetParcelName.cs | 45 --------------------- Core/Commands/Parcel/SetParcelName.cs | 29 +++++++++++++ 2 files changed, 29 insertions(+), 45 deletions(-) delete mode 100644 Core/Commands/Parcel/ParcelSetParcelName.cs create mode 100644 Core/Commands/Parcel/SetParcelName.cs diff --git a/Core/Commands/Parcel/ParcelSetParcelName.cs b/Core/Commands/Parcel/ParcelSetParcelName.cs deleted file mode 100644 index 2f86ffd..0000000 --- a/Core/Commands/Parcel/ParcelSetParcelName.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using BetterSecondBotShared.logs; -using BetterSecondBotShared.Static; -using OpenMetaverse; - -namespace BSB.Commands.CMD_Parcel -{ - - public class SetParcelName : CoreCommand - { - public override string[] ArgTypes { get { return new[] { "String" }; } } - public override string[] ArgHints { get { return new[] { "The new name" }; } } - public override int MinArgs { get { return 1; } } - public override string Helpfile { get { return "Updates the current parcels name"; } } - - public override bool CallFunction(string[] args) - { - if (base.CallFunction(args) == true) - { - 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]; - if (parcel_static.has_parcel_perm(p, bot) == true) - { - p.Name = args[0]; - p.Update(bot.GetClient.Network.CurrentSim, false); - return true; - } - else - { - return Failed("Incorrect perms to control parcel"); - } - } - else - { - return Failed("Unable to find parcel in memory, please wait and try again"); - } - } - return false; - } - } -} diff --git a/Core/Commands/Parcel/SetParcelName.cs b/Core/Commands/Parcel/SetParcelName.cs new file mode 100644 index 0000000..02c557e --- /dev/null +++ b/Core/Commands/Parcel/SetParcelName.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Text; +using BetterSecondBotShared.logs; +using BetterSecondBotShared.Static; +using OpenMetaverse; + +namespace BSB.Commands.CMD_Parcel +{ + + public class SetParcelName : ParcelCommand_RequirePerms + { + public override string[] ArgTypes { get { return new[] { "String" }; } } + public override string[] ArgHints { get { return new[] { "The new name" }; } } + public override int MinArgs { get { return 1; } } + public override string Helpfile { get { return "Updates the current parcels name"; } } + + public override bool CallFunction(string[] args) + { + if (base.CallFunction(args) == true) + { + targetparcel.Name = args[0]; + targetparcel.Update(bot.GetClient.Network.CurrentSim, false); + return true; + } + return false; + } + } +}