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:
parent
cb653f6237
commit
04cdd56d13
2 changed files with 14 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue