Give command fixes
- You can no longer try to give a player an invalid item. - The give command now gives the specified player the items, and not the player that issued the command
This commit is contained in:
parent
62f7d8d55d
commit
54a6338c40
@ -51,6 +51,23 @@ Global
|
||||
{FEE55B54-91B0-4325-A2C3-D576C0B7A81F}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = TrueCraft\TrueCraft.csproj
|
||||
Policies = $0
|
||||
$0.TextStylePolicy = $1
|
||||
$1.FileWidth = 120
|
||||
$1.inheritsSet = VisualStudio
|
||||
$1.inheritsScope = text/plain
|
||||
$1.scope = text/x-csharp
|
||||
$0.CSharpFormattingPolicy = $2
|
||||
$2.BeforeMethodDeclarationParentheses = False
|
||||
$2.BeforeMethodCallParentheses = False
|
||||
$2.BeforeConstructorDeclarationParentheses = False
|
||||
$2.BeforeIndexerDeclarationBracket = False
|
||||
$2.BeforeDelegateDeclarationParentheses = False
|
||||
$2.AfterDelegateDeclarationParameterComma = True
|
||||
$2.NewParentheses = False
|
||||
$2.SpacesBeforeBrackets = False
|
||||
$2.inheritsSet = Mono
|
||||
$2.inheritsScope = text/x-csharp
|
||||
$2.scope = text/x-csharp
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -41,7 +41,7 @@ namespace TrueCraft.Commands
|
||||
ICommand foundCommand = FindByName(alias) ?? FindByAlias(alias);
|
||||
if (foundCommand == null)
|
||||
{
|
||||
client.SendMessage("Unable to locate the command \"" + alias + "\". It might be in a different server!");
|
||||
client.SendMessage("Invalid command \"" + alias + "\".");
|
||||
return;
|
||||
}
|
||||
foundCommand.Handle(client, alias, arguments);
|
||||
|
@ -32,13 +32,23 @@ namespace TrueCraft.Commands
|
||||
Help(Client, Alias, Arguments);
|
||||
return;
|
||||
}
|
||||
// TODO: Send items to the client mentioned in the command, not the client issuing the command
|
||||
// TODO: Check to make sure an item with that ID actually exists
|
||||
|
||||
IRemoteClient receiver = Client.Server.Clients.SingleOrDefault(c => c.Username == Arguments[1]);
|
||||
short id;
|
||||
sbyte count;
|
||||
if (short.TryParse(Arguments[2], out id) && sbyte.TryParse(Arguments[3], out count))
|
||||
{
|
||||
var inventory = Client.Inventory as InventoryWindow;
|
||||
if (receiver == null) {
|
||||
Client.SendMessage("No client with the username \"" + Arguments[1] + "\" was found.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Client.Server.ItemRepository.GetItemProvider(id) == null) {
|
||||
Client.SendMessage("Invalid item id \"" + id + "\".");
|
||||
return;
|
||||
}
|
||||
|
||||
var inventory = receiver.Inventory as InventoryWindow;
|
||||
inventory.PickUpStack(new ItemStack(id, count));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user