Remove name support for prefixes
Searching by name causes a null exception
This commit is contained in:
parent
b23b6789f2
commit
d3e0acacaa
2 changed files with 9 additions and 8 deletions
|
|
@ -2497,7 +2497,7 @@ namespace TShockAPI
|
|||
{
|
||||
if (args.Parameters.Count < 1)
|
||||
{
|
||||
args.Player.SendMessage("Invalid syntax! Proper syntax: /item <item name/id> [item amount] [prefix name/id]", Color.Red);
|
||||
args.Player.SendMessage("Invalid syntax! Proper syntax: /item <item name/id> [item amount] [prefix id]", Color.Red);
|
||||
return;
|
||||
}
|
||||
if (args.Parameters[0].Length == 0)
|
||||
|
|
@ -2512,9 +2512,9 @@ namespace TShockAPI
|
|||
else if (args.Parameters.Count == 3)
|
||||
{
|
||||
int.TryParse(args.Parameters[1], out itemAmount);
|
||||
var found = TShock.Utils.GetPrefixByIdOrName(args.Parameters[2]);
|
||||
if (found.Count == 1)
|
||||
prefix = found[0];
|
||||
int.TryParse(args.Parameters[2], out prefix);
|
||||
if (prefix < 0 || prefix > 83)
|
||||
prefix = 0;
|
||||
}
|
||||
var items = TShock.Utils.GetItemByIdOrName(args.Parameters[0]);
|
||||
if (items.Count == 0)
|
||||
|
|
@ -2553,7 +2553,7 @@ namespace TShockAPI
|
|||
{
|
||||
if (args.Parameters.Count < 2)
|
||||
{
|
||||
args.Player.SendMessage("Invalid syntax! Proper syntax: /give <item type/id> <player> [item amount] [prefix id/name]", Color.Red);
|
||||
args.Player.SendMessage("Invalid syntax! Proper syntax: /give <item type/id> <player> [item amount] [prefix id]", Color.Red);
|
||||
return;
|
||||
}
|
||||
if (args.Parameters[0].Length == 0)
|
||||
|
|
@ -2577,9 +2577,9 @@ namespace TShockAPI
|
|||
else if (args.Parameters.Count == 2)
|
||||
{
|
||||
int.TryParse(args.Parameters[0], out itemAmount);
|
||||
var found = TShock.Utils.GetPrefixByIdOrName(args.Parameters[1]);
|
||||
if (found.Count == 1)
|
||||
prefix = found[0];
|
||||
int.TryParse(args.Parameters[1], out prefix);
|
||||
if (prefix < 0 || prefix > 83)
|
||||
prefix = 0;
|
||||
}
|
||||
|
||||
if (items.Count == 0)
|
||||
|
|
|
|||
|
|
@ -277,6 +277,7 @@ namespace TShockAPI
|
|||
Main.item[itemid].wet = Collision.WetCollision(Main.item[itemid].position, Main.item[itemid].width, Main.item[itemid].height);
|
||||
Main.item[itemid].stack = stack;
|
||||
Main.item[itemid].owner = Index;
|
||||
Main.item[itemid].prefix = (byte) prefix;
|
||||
NetMessage.SendData((int)PacketTypes.ItemDrop, -1, -1, "", itemid, 0f, 0f, 0f);
|
||||
NetMessage.SendData((int)PacketTypes.ItemOwner, -1, -1, "", itemid, 0f, 0f, 0f);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue