Added config option to prevent people from spawning banned items.
This commit is contained in:
parent
c27dfddaaa
commit
50d9cb602d
3 changed files with 27 additions and 12 deletions
|
|
@ -359,9 +359,11 @@ namespace TShockAPI
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual void GiveItem(int type, string name, int width, int height, int stack, int prefix = 0)
|
||||
public virtual bool GiveItem(int type, string name, int width, int height, int stack, int prefix = 0)
|
||||
{
|
||||
int itemid = Item.NewItem((int) X, (int) Y, width, height, type, stack, true, prefix);
|
||||
if (TShock.Itembans.ItemIsBanned(name) && TShock.Config.PreventBannedItemSpawn)
|
||||
return false;
|
||||
// This is for special pickaxe/hammers/swords etc
|
||||
Main.item[itemid].SetDefaults(name);
|
||||
// The set default overrides the wet and stack set by NewItem
|
||||
|
|
@ -372,6 +374,7 @@ namespace TShockAPI
|
|||
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);
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void SendMessage(string msg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue