ServerEvents.commandRegistry(event => {
    const { commands: Commands, arguments: Arguments} = event

    event.register(
        Commands.literal("heroes_theft_toggle")
		.then(Commands.argument('on/off', Arguments.STRING.create(event))
				.suggests((ctx, builder) => {
			builder.suggest("on")
			builder.suggest("off")
			 return builder.buildFuture()
			 })
                    .executes(ctx => {
						const toggle_type = Arguments.STRING.getResult(ctx, "on/off")

						let player = ctx.source.player
						let username = player.getGameProfile().getName();
                        let server = ctx.source.getServer()
                        let position = ctx.source.getPosition()
                        let dimension = ctx.source.getLevel().getDimension()
                        
						if (toggle_type == "on") {
                        server.runCommandSilent(`execute as ${username} at @s run tag @s add Heroes.Theft.Enabled`)
						server.runCommandSilent(`execute as ${username} at @s run tellraw @s [\"\",{\"text\":\"You are now allowing others to steal your abilities freely.\",\"color\":\"white\"}]`)
                        }
						
						if (toggle_type == "off") {
                        server.runCommandSilent(`execute as ${username} at @s run tag @s remove Heroes.Theft.Enabled`)
						server.runCommandSilent(`execute as ${username} at @s run tellraw @s [\"\",{\"text\":\"You are not allowing others to steal your abilities freely.\",\"color\":\"white\"}]`)
                        }
						
						
                    return 1
                })
		)
    )
})