Added permission and checking for when an npc's home is updated. In order to set an npcs home a user needs the permission moveNPC

This commit is contained in:
Zack Piispanen 2011-12-10 05:33:11 -05:00
parent cb653f6237
commit 04cdd56d13
2 changed files with 14 additions and 0 deletions

View file

@ -116,6 +116,7 @@ namespace TShockAPI
{PacketTypes.SignNew, HandleSign},
{PacketTypes.PlayerSlot, HandlePlayerSlot},
{PacketTypes.TileGetSection, HandleGetSection},
{PacketTypes.UpdateNPCHome, UpdateNPCHome },
};
}
@ -759,5 +760,15 @@ namespace TShockAPI
args.Player.RequestedSection = true;
return false;
}
private static bool UpdateNPCHome( GetDataHandlerArgs args )
{
if (!args.Player.Group.HasPermission(Permissions.moveNPC))
{
args.Player.SendMessage("You do not have permission to relocate NPCs.", Color.Red);
return true;
}
return false;
}
}
}

View file

@ -141,6 +141,9 @@ namespace TShockAPI
[Description("User can change hardmode state.")]
public static readonly string hardmode;
[Description("User can change the homes of NPCs.")]
public static readonly string moveNPC;
static Permissions()
{
foreach (var field in typeof(Permissions).GetFields())