diff --git a/server/commands/hubs.py b/server/commands/hubs.py index d9b492fe..23bdc4e3 100644 --- a/server/commands/hubs.py +++ b/server/commands/hubs.py @@ -22,6 +22,7 @@ # Area Creation system "ooc_cmd_area_create", "ooc_cmd_area_remove", + "ooc_cmd_area_duplicate", "ooc_cmd_area_rename", "ooc_cmd_area_swap", "ooc_cmd_area_switch", @@ -321,6 +322,32 @@ def ooc_cmd_area_remove(client, arg): "Invalid number of arguments. Use /area_remove .") +@mod_only(hub_owners=True) +def ooc_cmd_area_duplicate(client, arg): + """ + Duplicate an area, copying all of its properties and evidence. + Usage: /area_duplicate + """ + args = arg.split() + + if len(args) == 1: + try: + area = client.area.area_manager.get_area_by_id(int(args[0])) + name = area.name + data = area.save() + new_area = client.area.area_manager.create_area() + new_area.load(data) + client.area.area_manager.broadcast_area_list() + client.send_ooc(f"Area {name} duplicated!") + except ValueError: + raise ArgumentError("Area ID must be a number.") + except (AreaError, ClientError): + raise + else: + raise ArgumentError( + "Invalid number of arguments. Use /area_duplicate .") + + @mod_only(area_owners=True) def ooc_cmd_area_rename(client, arg): """